From db43205dc6d8129e0c18213ac5ebd2cfb505aa0e Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 12 Apr 2013 15:51:40 +0200 Subject: Fix ICC warning when defining both -ansi and -strict-ansi --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') 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 "") -- cgit v1.2.3