Am Samstag, 11. Juni 2016 um 08:25:58, schrieb Georg Baum <georg.b...@post.rwth-aachen.de> > Guillaume Munch wrote: > > > Le 11/06/2016 03:00, Scott Kostyshak a écrit : > >> -- Using GCC version 4.2.1 > >> CMake Error at CMakeLists.txt:267 (message): > >> gcc >= 4.3 is required. > > > > From INSTALL: > > > > First of all, you will need a recent C++ compiler, where recent means > > that the compilers are close to C++11 standard conforming like gcc (at > > least 4.3) or clang. > > > > I do not know clang, but I am surprised, gcc 4.2 is very old. I > > requested to drop gcc 4.6 in a recent message. > > From config/lyxinclude.m4: > > dnl clang++ pretends to be g++ 4.2.1; this is not useful > > This is the reason why the version test now fails. > > I forgot to test cmake+clang when requiring a C++11 compiler. > clang+autotools work fine. This is beyond my cmake knowledge. Kornel, do you > have an idea how to fix this? autotools detect clang and then ignore the gcc > version, see LYX_PROG_CLANG and the line I quoted (both from > config/lyxinclude.m4). > > > Georg
Should we really ignore output of '${CMAKE_CXX_COMPILER} -dumpversion'? Some questions: 1.) What if the compiler is even older? or 2.) Should we in this case assume GCC_VERSION >= 4.9? One possible fix is appended. Kornel
signature.asc
Description: This is a digitally signed message part.
diff --git a/CMakeLists.txt b/CMakeLists.txt index fee89e1..95a89d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,16 +261,23 @@ endif() set(LYX_GCC11_MODE) if(UNIX OR MINGW) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) - message(STATUS "Using GCC version ${GCC_VERSION}") - if(GCC_VERSION VERSION_LESS 4.9) - if(GCC_VERSION VERSION_LESS 4.3) - message(FATAL_ERROR "gcc >= 4.3 is required.") - endif() - # <regex> in gcc is unusable in versions less than 4.9.0 - # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631 - set(LYX_USE_STD_REGEX 0) + if (CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$") + # ignore the GCC_VERSION for clang + # We pretend the compiler version >= 4.9 + message(STATUS "Using clang version ${GCC_VERSION}") + set(LYX_USE_STD_REGEX 1) else() - set(LYX_USE_STD_REGEX 1) + message(STATUS "Using GCC version ${GCC_VERSION}") + if(GCC_VERSION VERSION_LESS 4.9) + if(GCC_VERSION VERSION_LESS 4.3) + message(FATAL_ERROR "gcc >= 4.3 is required.") + endif() + # <regex> in gcc is unusable in versions less than 4.9.0 + # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631 + set(LYX_USE_STD_REGEX 0) + else() + set(LYX_USE_STD_REGEX 1) + endif() endif() set(LYX_GCC11_MODE "${CXX11_FLAG}") else()