Am Wed, 30 Dec 2020 15:17:36 +0100
schrieb Thibaut Cuvelier <tcuvel...@lyx.org>:

> On Wed, 30 Dec 2020 at 09:01, Yuriy Skalko <yuriy.ska...@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

We can do it.  For instance add the flag in ./development/cmake/config.h.cmake
        #cmakedefine LYX_EXTRA_CXXFLAGS 1
        #if defined(LYX_EXTRA_CXXFLAGS)
                #define ${LYX_EXTRA_CXXFLAGS}
        #endif
Now you could use
        $ cmake ... -DLYX_EXTRA_CXXFLAGS=__cplusplus
and the resulting config.h will contain
        #define LYX_EXTRA_CXXFLAGS 1
        #if defined(LYX_EXTRA_CXXFLAGS)
                #define __cplusplus
        #endif

> 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.

        Kornel

Attachment: pgpruiky7jMM0.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to