mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 09:28:21 +00:00
Fix handling of -std=c++11 flag.
This commit is contained in:
parent
3159170383
commit
ba176c3cb3
@ -11,13 +11,15 @@ endif ()
|
|||||||
project(FORMAT)
|
project(FORMAT)
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
foreach (flag -std=c++11 -std=c++0x)
|
check_cxx_compiler_flag(-std=c++11 HAVE_STD_CPP11_FLAG)
|
||||||
check_cxx_compiler_flag(${flag} HAVE_STD_CPP11_FLAG)
|
|
||||||
if (HAVE_STD_CPP11_FLAG)
|
if (HAVE_STD_CPP11_FLAG)
|
||||||
set(CPP11_FLAG ${flag})
|
set(CPP11_FLAG -std=c++11)
|
||||||
break ()
|
else ()
|
||||||
|
check_cxx_compiler_flag(-std=c++0x HAVE_STD_CPP0X_FLAG)
|
||||||
|
if (HAVE_STD_CPP0X_FLAG)
|
||||||
|
set(CPP11_FLAG -std=c++0x)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
@ -42,7 +44,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set_target_properties(format PROPERTIES COMPILE_FLAGS
|
set_target_properties(format PROPERTIES COMPILE_FLAGS
|
||||||
"-Wall -Wextra -pedantic")
|
"-Wall -Wextra -pedantic")
|
||||||
endif ()
|
endif ()
|
||||||
if (HAVE_STD_CPP11_FLAG)
|
if (CPP11_FLAG)
|
||||||
set_target_properties(format PROPERTIES COMPILE_FLAGS ${CPP11_FLAG})
|
set_target_properties(format PROPERTIES COMPILE_FLAGS ${CPP11_FLAG})
|
||||||
# Test compilation with default flags.
|
# Test compilation with default flags.
|
||||||
file(GLOB src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*.cc test/*.h)
|
file(GLOB src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*.cc test/*.h)
|
||||||
@ -92,8 +94,8 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set_target_properties(format-test PROPERTIES COMPILE_FLAGS
|
set_target_properties(format-test PROPERTIES COMPILE_FLAGS
|
||||||
"-Wall -Wextra -pedantic -Wno-long-long -Wno-variadic-macros")
|
"-Wall -Wextra -pedantic -Wno-long-long -Wno-variadic-macros")
|
||||||
endif ()
|
endif ()
|
||||||
if (HAVE_STD_CPP11_FLAG)
|
if (CPP11_FLAG)
|
||||||
set_target_properties(format-test PROPERTIES COMPILE_FLAGS "-std=c++11")
|
set_target_properties(format-test PROPERTIES COMPILE_FLAGS ${CPP11_FLAG})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (HAVE_OPEN)
|
if (HAVE_OPEN)
|
||||||
@ -134,8 +136,9 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/format-benchmark/tinyformat_test.cpp)
|
|||||||
endif ()
|
endif ()
|
||||||
set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_DEFINITIONS
|
set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_DEFINITIONS
|
||||||
"SPEED_TEST;HAVE_FORMAT;_SCL_SECURE_NO_WARNINGS;${PROFILE_DEFS}")
|
"SPEED_TEST;HAVE_FORMAT;_SCL_SECURE_NO_WARNINGS;${PROFILE_DEFS}")
|
||||||
if (HAVE_STD_CPP11_FLAG)
|
if (CPP11_FLAG)
|
||||||
set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_FLAGS "-std=c++11")
|
set_target_properties(tinyformat_speed_test
|
||||||
|
PROPERTIES COMPILE_FLAGS ${CPP11_FLAG})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_custom_target(speed_test
|
add_custom_target(speed_test
|
||||||
|
Loading…
Reference in New Issue
Block a user