blob: 9664025a4111ee2a0fcbe664160b9b229bd73654 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
cmake_minimum_required(VERSION 3.3)
project(target_compile_features)
set(CMAKE_VERBOSE_MAKEFILE ON)
if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES)
add_executable(c_target_compile_features_specific main.c)
target_compile_features(c_target_compile_features_specific
PRIVATE c_restrict
)
add_library(c_lib_restrict_specific lib_restrict.c)
target_compile_features(c_lib_restrict_specific
PUBLIC c_restrict
)
add_executable(c_restrict_user_specific restrict_user.c)
target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)
endif()
if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES AND
NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
add_executable(c_target_compile_features_meta main.c)
target_compile_features(c_target_compile_features_meta
PRIVATE c_std_99
)
add_library(c_lib_restrict_meta lib_restrict.c)
target_compile_features(c_lib_restrict_meta
PUBLIC c_std_99
)
add_executable(c_restrict_user_meta restrict_user.c)
target_link_libraries(c_restrict_user_meta c_lib_restrict_meta)
endif()
if (cxx_auto_type IN_LIST CMAKE_CXX_COMPILE_FEATURES)
add_executable(cxx_target_compile_features_specific main.cpp)
target_compile_features(cxx_target_compile_features_specific
PRIVATE cxx_auto_type
)
add_library(cxx_lib_auto_type_specific lib_auto_type.cpp)
target_compile_features(cxx_lib_auto_type_specific
PUBLIC cxx_auto_type
)
add_executable(cxx_lib_user_specific lib_user.cpp)
target_link_libraries(cxx_lib_user_specific cxx_lib_auto_type_specific)
endif()
if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
add_executable(cxx_target_compile_features_meta main.cpp)
target_compile_features(cxx_target_compile_features_meta
PRIVATE cxx_std_11
)
add_library(cxx_lib_auto_type_meta lib_auto_type.cpp)
target_compile_features(cxx_lib_auto_type_meta
PUBLIC cxx_std_11
)
add_executable(cxx_lib_user_meta lib_user.cpp)
target_link_libraries(cxx_lib_user_meta cxx_lib_auto_type_meta)
endif()
|