aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-04-12 15:51:40 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-04-12 15:51:40 +0200
commitdb43205dc6d8129e0c18213ac5ebd2cfb505aa0e (patch)
tree0386faf1434a253d7221a7e80da6f8fa2ceaf739 /CMakeLists.txt
parent9816e8532ef40986e549a201bf7f0f774305501d (diff)
Fix ICC warning when defining both -ansi and -strict-ansi
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0257e7383..835eeb5ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,7 +130,6 @@ if(NOT MSVC)
endif()
ei_add_cxx_compiler_flag("-pedantic")
- ei_add_cxx_compiler_flag("-strict-ansi") # ICC
ei_add_cxx_compiler_flag("-Wall")
ei_add_cxx_compiler_flag("-Wextra")
#ei_add_cxx_compiler_flag("-Weverything") # clang
@@ -153,7 +152,13 @@ if(NOT MSVC)
ei_add_cxx_compiler_flag("-fstrict-aliasing")
# The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails
- ei_add_cxx_compiler_flag("-ansi")
+ # Moreover we should not set both -strict-ansi and -ansi
+ check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI)
+ if(COMPILER_SUPPORT_STRICTANSI)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi")
+ else()
+ ei_add_cxx_compiler_flag("-ansi")
+ endif()
set(CMAKE_REQUIRED_FLAGS "")