Fix compiler flags check.
This commit is contained in:
parent
da9aeab810
commit
089974eb92
@ -11,10 +11,13 @@ endif ()
|
||||
project(FORMAT)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag(-std=c++11 HAVE_STD_CPP11_FLAG)
|
||||
if (NOT HAVE_STD_CPP11_FLAG)
|
||||
check_cxx_compiler_flag(-std=c++0x HAVE_STD_CPP11_FLAG)
|
||||
endif ()
|
||||
foreach (flag -std=c++11 -std=c++0x)
|
||||
check_cxx_compiler_flag(${flag} HAVE_STD_CPP11_FLAG)
|
||||
if (HAVE_STD_CPP11_FLAG)
|
||||
set(CPP11_FLAG ${flag})
|
||||
break ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
@ -40,7 +43,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
"-Wall -Wextra -pedantic")
|
||||
endif ()
|
||||
if (HAVE_STD_CPP11_FLAG)
|
||||
set_target_properties(format PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
set_target_properties(format PROPERTIES COMPILE_FLAGS ${CPP11_FLAG})
|
||||
# Test compilation with default flags.
|
||||
add_library(testformat format.cc)
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user