Compilation error with MSVC 19

Thibaut Cuvelier tcuvelier at lyx.org
Wed Dec 30 14:17:36 UTC 2020


On Wed, 30 Dec 2020 at 09:01, Yuriy Skalko <yuriy.skalko at gmail.com> wrote:

> > Here is a newer version of the patch that does not use _HAS_CXX17, as it
> > should not really be relied upon (
> >
> https://stackoverflow.com/questions/52379233/is-has-cxx17-marco-usable-in-custom-project-headers-to-enable-c17-language
> ).
>
> I think the right way will be using only standard-compliant
> "__cplusplus" in sources and adding the option "/Zc:__cplusplus" for
> MSVC compiler in the build scripts so it handle __cplusplus in
> standard-compliant way:
>
>
> https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160
>

It seems that it's not that easy to pass this flag through CMake, and the
devs are not really willing to do something about it:
https://gitlab.kitware.com/cmake/cmake/-/issues/18837

I tried several things to get the flag at the right position through CMake,
but I can't get it to work (using the technique of
https://stackoverflow.com/questions/57102212/cannot-set-cplusplus-to-c17-standard-with-visual-studio-and-cmake
/ https://gitlab.kitware.com/cmake/cmake/-/issues/18837#note_722441 and
https://peter.bloomfield.online/report-__cplusplus-correctly-with-cmake-and-visual-studio/).
I'm attaching three attempts: the CMake variable CMAKE_CXX_FLAGS is
modified but the new flag never appears anywhere.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201230/d656cf41/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvc-z.patch
Type: application/octet-stream
Size: 475 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201230/d656cf41/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvc-z2.patch
Type: application/octet-stream
Size: 501 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201230/d656cf41/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvc-z3.patch
Type: application/octet-stream
Size: 609 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201230/d656cf41/attachment-0002.obj>


More information about the lyx-devel mailing list