ref: a9440fd60a68ffa5a2496e26dffaa0486c0ddf2a
parent: 711abe313df4fa4dbb3bc3bae24a5700386902ea
author: robs <robs>
date: Sun Aug 3 15:31:03 EDT 2008
use same logic as configure.ac for gcc version check
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,12 +5,14 @@
if(CMAKE_COMPILER_IS_GNUCC)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE ver)
- string(REGEX REPLACE "[^0-9]+" "" ver "${ver}")
- if(${ver} LESS 430)
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" major "${ver}")
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" minor "${ver}")
+ math(EXPR ver "100 * ${major} + ${minor}")
+ if(${ver} LESS 403)
add_definitions(-Wconversion)
- else(${ver} LESS 430)
+ else(${ver} LESS 403)
add_definitions(-Wtraditional-conversion)
- endif(${ver} LESS 430)
+ endif(${ver} LESS 403)
add_definitions(-Werror)
endif(CMAKE_COMPILER_IS_GNUCC)