66 lines
2.0 KiB
CMake
Raw Normal View History

2018-08-09 18:06:22 +02:00
cmake_minimum_required(VERSION 3.3)
2015-04-27 22:25:09 +02:00
project(target_compile_features)
set(CMAKE_VERBOSE_MAKEFILE ON)
2017-07-20 19:35:53 +02:00
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
2015-04-27 22:25:09 +02:00
PRIVATE c_restrict
)
2017-07-20 19:35:53 +02:00
add_library(c_lib_restrict_specific lib_restrict.c)
target_compile_features(c_lib_restrict_specific
2015-04-27 22:25:09 +02:00
PUBLIC c_restrict
)
2017-07-20 19:35:53 +02:00
add_executable(c_restrict_user_specific restrict_user.c)
target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)
2015-04-27 22:25:09 +02:00
endif()
2018-08-09 18:06:22 +02:00
if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES AND
NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
2017-07-20 19:35:53 +02:00
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
2015-04-27 22:25:09 +02:00
PRIVATE cxx_auto_type
)
2017-07-20 19:35:53 +02:00
add_library(cxx_lib_auto_type_specific lib_auto_type.cpp)
target_compile_features(cxx_lib_auto_type_specific
2015-04-27 22:25:09 +02:00
PUBLIC cxx_auto_type
)
2017-07-20 19:35:53 +02:00
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)
2015-04-27 22:25:09 +02:00
endif()