Path: blob/master/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
3152 views
cmake_minimum_required(VERSION 3.10)1project(target_compile_features)23set(CMAKE_VERBOSE_MAKEFILE ON)45if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES)6add_executable(c_target_compile_features_specific main.c)7target_compile_features(c_target_compile_features_specific8PRIVATE c_restrict9)1011add_library(c_lib_restrict_specific lib_restrict.c)12target_compile_features(c_lib_restrict_specific13PUBLIC c_restrict14)1516add_executable(c_restrict_user_specific restrict_user.c)17target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)18endif()1920if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES AND21NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")22add_executable(c_target_compile_features_meta main.c)23target_compile_features(c_target_compile_features_meta24PRIVATE c_std_9925)2627add_library(c_lib_restrict_meta lib_restrict.c)28target_compile_features(c_lib_restrict_meta29PUBLIC c_std_9930)3132add_executable(c_restrict_user_meta restrict_user.c)33target_link_libraries(c_restrict_user_meta c_lib_restrict_meta)34endif()3536if (cxx_auto_type IN_LIST CMAKE_CXX_COMPILE_FEATURES)37add_executable(cxx_target_compile_features_specific main.cpp)38target_compile_features(cxx_target_compile_features_specific39PRIVATE cxx_auto_type40)4142add_library(cxx_lib_auto_type_specific lib_auto_type.cpp)43target_compile_features(cxx_lib_auto_type_specific44PUBLIC cxx_auto_type45)4647add_executable(cxx_lib_user_specific lib_user.cpp)48target_link_libraries(cxx_lib_user_specific cxx_lib_auto_type_specific)49endif()5051if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES)52add_executable(cxx_target_compile_features_meta main.cpp)53target_compile_features(cxx_target_compile_features_meta54PRIVATE cxx_std_1155)5657add_library(cxx_lib_auto_type_meta lib_auto_type.cpp)58target_compile_features(cxx_lib_auto_type_meta59PUBLIC cxx_std_1160)6162add_executable(cxx_lib_user_meta lib_user.cpp)63target_link_libraries(cxx_lib_user_meta cxx_lib_auto_type_meta)64endif()656667