Do not use GCC_MINOR in CMakeLists.txt

"gcc -dumpversion" with GCC >= 7 only prints "7", thus GCC_MINOR is not defined.
That results in:

CMake Error at CMakeLists.txt:86 (list):
list index: 1 out of range (-1, 0)
This commit is contained in:
Fabian Vogt
2017-07-03 16:53:29 +02:00
committed by GitHub
parent bac4bef373
commit 04052ceb86
+1 -2
View File
@@ -83,9 +83,8 @@ IF( MINGW OR UNIX )
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION})
list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR)
list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR)
message(STATUS Compiler: ${COMPILER} " Major:" ${GCC_MAJOR} " Minor:" ${GCC_MINOR})
message(STATUS Compiler: ${COMPILER} " Major:" ${GCC_MAJOR})
IF ( CYGWIN OR ( ${GCC_MAJOR} GREATER 5 ))
ADD_DEFINITIONS( -std=gnu++98 ) # to support snprintf