Skip to content

Commit 1257b41

Browse files
authored
Use target_compile_features to specify the C++11 requirement (#645)
1 parent a3fbc9f commit 1257b41

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CMakeModules/CompilerSettings.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434
# GCC
3535
if(CMAKE_COMPILER_IS_GNUCXX)
36-
add_definitions(-std=c++11 -W -Wall -Wextra -Wpedantic)
36+
add_definitions(-W -Wall -Wextra -Wpedantic)
3737
if(FCL_TREAT_WARNINGS_AS_ERRORS)
3838
add_definitions(-Werror)
3939
endif()
4040
endif()
4141

4242
# Clang
4343
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
44-
add_definitions(-std=c++11 -W -Wall -Wextra)
44+
add_definitions(-W -Wall -Wextra)
4545
if(FCL_TREAT_WARNINGS_AS_ERRORS)
4646
add_definitions(-Werror)
4747
endif()
@@ -53,7 +53,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
5353
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
5454
message(FATAL_ERROR "AppleClang version must be at least 6.1!")
5555
endif()
56-
add_definitions(-std=c++11 -W -Wall -Wextra)
56+
add_definitions(-W -Wall -Wextra)
5757
if(FCL_TREAT_WARNINGS_AS_ERRORS)
5858
add_definitions(-Werror)
5959
endif()
@@ -77,7 +77,7 @@ else()
7777
set(IS_ICPC 0)
7878
endif()
7979
if(IS_ICPC)
80-
add_definitions(-std=c++11 -wd191 -wd411 -wd654 -wd1125 -wd1292 -wd1565 -wd1628 -wd2196)
80+
add_definitions(-wd191 -wd411 -wd654 -wd1125 -wd1292 -wd1565 -wd1628 -wd2196)
8181
set(CMAKE_AR "xiar" CACHE STRING "Intel archiver" FORCE)
8282
set(CMAKE_CXX_FLAGS "-pthread" CACHE STRING "Default compile flags" FORCE)
8383
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG"
@@ -97,7 +97,7 @@ else()
9797
set(IS_XLC 0)
9898
endif()
9999
if(IS_XLC)
100-
add_definitions(-std=c++11 -qpic -q64 -qmaxmem=-1)
100+
add_definitions(-qpic -q64 -qmaxmem=-1)
101101
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -q64")
102102
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -q64")
103103
endif()

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ endif()
5050
# Be sure to pass to the consumer the set of SIMD used in the compilation
5151
target_compile_options(${PROJECT_NAME} PUBLIC ${SSE_FLAGS})
5252

53+
# At least C++11 is required
54+
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
55+
5356
set_target_properties(${PROJECT_NAME} PROPERTIES
5457
VERSION ${FCL_VERSION}
5558
SOVERSION ${FCL_ABI_VERSION})

0 commit comments

Comments
 (0)