Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
3152 views
1
cmake_minimum_required(VERSION 3.10)
2
project(target_compile_features)
3
4
set(CMAKE_VERBOSE_MAKEFILE ON)
5
6
if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES)
7
add_executable(c_target_compile_features_specific main.c)
8
target_compile_features(c_target_compile_features_specific
9
PRIVATE c_restrict
10
)
11
12
add_library(c_lib_restrict_specific lib_restrict.c)
13
target_compile_features(c_lib_restrict_specific
14
PUBLIC c_restrict
15
)
16
17
add_executable(c_restrict_user_specific restrict_user.c)
18
target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)
19
endif()
20
21
if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES AND
22
NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
23
add_executable(c_target_compile_features_meta main.c)
24
target_compile_features(c_target_compile_features_meta
25
PRIVATE c_std_99
26
)
27
28
add_library(c_lib_restrict_meta lib_restrict.c)
29
target_compile_features(c_lib_restrict_meta
30
PUBLIC c_std_99
31
)
32
33
add_executable(c_restrict_user_meta restrict_user.c)
34
target_link_libraries(c_restrict_user_meta c_lib_restrict_meta)
35
endif()
36
37
if (cxx_auto_type IN_LIST CMAKE_CXX_COMPILE_FEATURES)
38
add_executable(cxx_target_compile_features_specific main.cpp)
39
target_compile_features(cxx_target_compile_features_specific
40
PRIVATE cxx_auto_type
41
)
42
43
add_library(cxx_lib_auto_type_specific lib_auto_type.cpp)
44
target_compile_features(cxx_lib_auto_type_specific
45
PUBLIC cxx_auto_type
46
)
47
48
add_executable(cxx_lib_user_specific lib_user.cpp)
49
target_link_libraries(cxx_lib_user_specific cxx_lib_auto_type_specific)
50
endif()
51
52
if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
53
add_executable(cxx_target_compile_features_meta main.cpp)
54
target_compile_features(cxx_target_compile_features_meta
55
PRIVATE cxx_std_11
56
)
57
58
add_library(cxx_lib_auto_type_meta lib_auto_type.cpp)
59
target_compile_features(cxx_lib_auto_type_meta
60
PUBLIC cxx_std_11
61
)
62
63
add_executable(cxx_lib_user_meta lib_user.cpp)
64
target_link_libraries(cxx_lib_user_meta cxx_lib_auto_type_meta)
65
endif()
66
67