diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-05-06 08:15:54 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-05-06 08:15:54 +0000 |
commit | 23f073625d4e4457ac4e7e144a552aad5c4f1f63 (patch) | |
tree | d2c5e6e686a3334b36ce3012fbb9795b4d21fe94 /CMakeLists.txt | |
parent | 834eb5bfc8deb95179936ea8d854bfee287c1cc9 (diff) |
add -Wextra only if compiler supports it
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b430a7aa..ffbf23d85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ endif(EIGEN_SVN_REVISION) cmake_minimum_required(VERSION 2.6.2) +include(CheckCXXCompilerFlag) + set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) option(EIGEN_BUILD_TESTS "Build tests" OFF) @@ -34,7 +36,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_SYSTEM_NAME MATCHES Linux) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wextra -fno-exceptions -fno-check-new -fno-common -fstrict-aliasing") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common -fstrict-aliasing") + + check_cxx_compiler_flag("-Wextra" COMPILER_SUPPORT_WEXTRA) + if(COMPILER_SUPPORT_WEXTRA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + endif() + if(NOT EIGEN_TEST_LIB) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") endif(NOT EIGEN_TEST_LIB) |