From e53b4c9fb9c40bd13b3df40c2da745db63ac15b0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 12:31:35 -0400 Subject: Help: fix cross-linking from `Swift_LANGUAGE_VERSION` property --- Help/prop_tgt/Swift_LANGUAGE_VERSION.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst b/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst index afc6b31..d1d80a8 100644 --- a/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst +++ b/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst @@ -4,5 +4,6 @@ Swift_LANGUAGE_VERSION .. versionadded:: 3.16 This property sets the language version for the Swift sources in the target. If -one is not specified, it will default to ```` if -specified, otherwise it is the latest version supported by the compiler. +one is not specified, it will default to +:variable:`CMAKE_Swift_LANGUAGE_VERSION` if specified, otherwise it is the +latest version supported by the compiler. -- cgit v0.12 From 1d4a013dd12255f0922aecee5b7b8a2cb7ec9597 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:17:08 -0400 Subject: Help: fix agreement in `DLL_NAME_WITH_SOVERSION` docs --- Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst b/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst index 59ef00f..c86b218 100644 --- a/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst +++ b/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst @@ -3,8 +3,8 @@ DLL_NAME_WITH_SOVERSION .. versionadded:: 3.27 -This property control whether the :prop_tgt:`SOVERSION` target -property are added to the filename of generated DLL filenames +This property controls whether the :prop_tgt:`SOVERSION` target +property is added to the filename of generated DLL filenames for the Windows platform, which is selected when the :variable:`WIN32` variable is set. -- cgit v0.12 From d718262faa262dc2fdaf67294b224743b86c40d0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:17:24 -0400 Subject: cmTarget: handle `HIP_STANDARD` like other language standards --- Source/cmTarget.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 76a14b8..593a019 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2423,6 +2423,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const propC_STANDARD, propCXX_STANDARD, propCUDA_STANDARD, + propHIP_STANDARD, propOBJC_STANDARD, propOBJCXX_STANDARD, propLINK_LIBRARIES, @@ -2447,8 +2448,8 @@ cmValue cmTarget::GetProperty(const std::string& prop) const }; if (specialProps.count(prop)) { if (prop == propC_STANDARD || prop == propCXX_STANDARD || - prop == propCUDA_STANDARD || prop == propOBJC_STANDARD || - prop == propOBJCXX_STANDARD) { + prop == propCUDA_STANDARD || prop == propHIP_STANDARD || + prop == propOBJC_STANDARD || prop == propOBJCXX_STANDARD) { auto propertyIter = this->impl->LanguageStandardProperties.find(prop); if (propertyIter == this->impl->LanguageStandardProperties.end()) { return nullptr; -- cgit v0.12 From f81351607c343517f3fa48ca93dfaf2a33688c84 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:18:20 -0400 Subject: Tests/RunCMake/property_init: add skeleton for testing --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/property_init/CMakeLists.txt | 6 ++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 3 files changed, 8 insertions(+) create mode 100644 Tests/RunCMake/property_init/CMakeLists.txt create mode 100644 Tests/RunCMake/property_init/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 280b81e..f8b84b2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -536,6 +536,7 @@ add_RunCMake_test(option) add_RunCMake_test(PrintHelpers) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(project_injected) +add_RunCMake_test(property_init) add_RunCMake_test(DependencyProviders) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) diff --git a/Tests/RunCMake/property_init/CMakeLists.txt b/Tests/RunCMake/property_init/CMakeLists.txt new file mode 100644 index 0000000..9548deb --- /dev/null +++ b/Tests/RunCMake/property_init/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} NONE) + +include(util.cmake) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake new file mode 100644 index 0000000..837e952 --- /dev/null +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -0,0 +1 @@ +include(RunCMake) -- cgit v0.12 From 16c24cce4775d46787cc27fe49108271d6bcf167 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:20:12 -0400 Subject: Tests/RunCMake/property_init: add a function to check a property --- Tests/RunCMake/property_init/util.cmake | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Tests/RunCMake/property_init/util.cmake diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake new file mode 100644 index 0000000..52d0961 --- /dev/null +++ b/Tests/RunCMake/property_init/util.cmake @@ -0,0 +1,24 @@ +function (check_property target property expected) + if (NOT TARGET "${target}") + message(SEND_ERROR + "No such target '${target}'") + return () + endif () + + get_property(is_set TARGET "${target}" PROPERTY "${property}" SET) + if (is_set) + get_property(actual TARGET "${target}" PROPERTY "${property}") + endif () + if (expected STREQUAL "") + if (is_set) + message(SEND_ERROR + "Target '${target}' should not have '${property}' set at all, but is '${actual}'") + endif () + elseif (is_set AND NOT expected STREQUAL actual) + message(SEND_ERROR + "Target '${target}' should have '${property}' set to '${expected}', but is '${actual}'") + elseif (NOT is_set) + message(SEND_ERROR + "Target '${target}' should have '${property}' set to '${expected}', but is not set at all") + endif () +endfunction () -- cgit v0.12 From 7b9378be43ac244baefb03bd7ab34ae882d3c1f1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:21:49 -0400 Subject: Tests/RunCMake/property_init: add a function to parse property tables The tables will be triples of property / value / alias value. Parsing is a bit tricky, but is easier when `foreach (IN ZIP_LISTS)` with the values in their distinct list. --- Tests/RunCMake/property_init/util.cmake | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index 52d0961..41a200a 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -22,3 +22,32 @@ function (check_property target property expected) "Target '${target}' should have '${property}' set to '${expected}', but is not set at all") endif () endfunction () + +function (prepare_properties table output_properties output_expected output_alias) + set(_properties) + set(_expected) + set(_alias) + + set(variable "_properties") + foreach (item IN LISTS "${table}") + list(APPEND "${variable}" "${item}") + if (variable STREQUAL "_properties") + set(variable "_expected") + elseif (variable STREQUAL "_expected") + set(variable "_alias") + elseif (variable STREQUAL "_alias") + set(variable "_properties") + else () + message(FATAL_ERROR + "Failed to track property table parsing") + endif () + endforeach () + if (NOT variable STREQUAL "_properties") + message(FATAL_ERROR + "Table does not have a multiple of 3 items") + endif () + + set("${output_properties}" "${_properties}" PARENT_SCOPE) + set("${output_expected}" "${_expected}" PARENT_SCOPE) + set("${output_alias}" "${_alias}" PARENT_SCOPE) +endfunction () -- cgit v0.12 From 1c0963e9f2cd2b7a5ff5e02fc7c26e47232061f4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:26:53 -0400 Subject: Tests/RunCMake/property_init: add functions to make example targets --- Tests/RunCMake/property_init/CMakeLists.txt | 5 +++- Tests/RunCMake/property_init/library.c | 4 +++ Tests/RunCMake/property_init/main.c | 4 +++ Tests/RunCMake/property_init/util.cmake | 46 +++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/property_init/library.c create mode 100644 Tests/RunCMake/property_init/main.c diff --git a/Tests/RunCMake/property_init/CMakeLists.txt b/Tests/RunCMake/property_init/CMakeLists.txt index 9548deb..51883af 100644 --- a/Tests/RunCMake/property_init/CMakeLists.txt +++ b/Tests/RunCMake/property_init/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.12) -project(${RunCMake_TEST} NONE) +project(${RunCMake_TEST} C) + +set(main_sources main.c) +set(library_sources library.c) include(util.cmake) diff --git a/Tests/RunCMake/property_init/library.c b/Tests/RunCMake/property_init/library.c new file mode 100644 index 0000000..ad6a649 --- /dev/null +++ b/Tests/RunCMake/property_init/library.c @@ -0,0 +1,4 @@ +int foo(int arg) +{ + return arg; +} diff --git a/Tests/RunCMake/property_init/main.c b/Tests/RunCMake/property_init/main.c new file mode 100644 index 0000000..14917b7 --- /dev/null +++ b/Tests/RunCMake/property_init/main.c @@ -0,0 +1,4 @@ +int main(int argc, char* argv[]) +{ + return argc - 1; +} diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index 41a200a..e98c2d5 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -1,3 +1,49 @@ +set(all_target_types + "EXECUTABLE" + + "IMPORTED_EXECUTABLE" + + "INTERFACE" + "MODULE" + "OBJECT" + "SHARED" + "STATIC" + + "IMPORTED_INTERFACE" + "IMPORTED_MODULE" + "IMPORTED_OBJECT" + "IMPORTED_SHARED" + "IMPORTED_STATIC" + + "CUSTOM") + +function (make_target name type) + if (type STREQUAL "EXECUTABLE") + add_executable("${name}") + target_sources("${name}" PRIVATE ${main_sources}) + elseif (type STREQUAL "IMPORTED_EXECUTABLE") + add_executable("${name}" IMPORTED) + set_property(TARGET "${name}" PROPERTY IMPORTED_LOCATION "${CMAKE_COMMAND}") + elseif (type STREQUAL "CUSTOM") + add_custom_target("${name}" COMMAND "${CMAKE_EXECUTABLE}" -E echo "${name}") + elseif (type MATCHES "IMPORTED_") + string(REPLACE "IMPORTED_" "" type "${type}") + add_library("${name}" IMPORTED ${type}) + if (NOT type STREQUAL "INTERFACE") + set_property(TARGET "${name}" PROPERTY IMPORTED_LOCATION "${default_library_location}") + endif () + else () + add_library("${name}" ${type}) + target_sources("${name}" PRIVATE ${library_sources}) + endif () + + if (type MATCHES "EXECUTABLE") + add_executable("alias::${name}" ALIAS "${name}") + elseif (NOT type STREQUAL "CUSTOM") + add_library("alias::${name}" ALIAS "${name}") + endif () +endfunction () + function (check_property target property expected) if (NOT TARGET "${target}") message(SEND_ERROR -- cgit v0.12 From 721f1b608c7c0fffa1b217ff706080ab75af3adc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:28:39 -0400 Subject: Tests/RunCMake/property_init: add a function to test properties This function consumes a property table and tests against every kind of target: those for which the initialization happens and those that should ignore them. Also add a function that can build the pairs of target type lists required. --- Tests/RunCMake/property_init/util.cmake | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index e98c2d5..564a229 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -17,6 +17,12 @@ set(all_target_types "CUSTOM") +function (prepare_target_types name) + set("${name}" "${ARGN}" PARENT_SCOPE) + list(REMOVE_ITEM all_target_types ${ARGN}) + set("not_${name}" "${all_target_types}" PARENT_SCOPE) +endfunction () + function (make_target name type) if (type STREQUAL "EXECUTABLE") add_executable("${name}") @@ -97,3 +103,54 @@ function (prepare_properties table output_properties output_expected output_alia set("${output_expected}" "${_expected}" PARENT_SCOPE) set("${output_alias}" "${_alias}" PARENT_SCOPE) endfunction () + +# Contextual variables: +# iteration: make unique target names +# with_defaults: if set, do not set variables, but instead test internal +# default calculations +function (run_property_tests applied_types property_table) + prepare_properties("${property_table}" expected_properties expected_values expected_alias) + + if (NOT with_defaults) + foreach (property expected IN ZIP_LISTS expected_properties expected_values) + string(REPLACE "" ";" expected "${expected}") + set("CMAKE_${property}" "${expected}") + endforeach () + endif () + + foreach (target_type IN LISTS "${applied_types}") + set(target_name "${RunCMake_TEST}${iteration}-${target_type}") + if (with_defaults) + string(APPEND target_name "-defaults") + endif () + make_target("${target_name}" "${target_type}") + foreach (property expected alias IN ZIP_LISTS expected_properties expected_values expected_alias) + string(REPLACE "" ";" expected "${expected}") + check_property("${target_name}" "${property}" "${expected}") + if (NOT target_type STREQUAL "CUSTOM") + if (alias STREQUAL "") + check_property("alias::${target_name}" "${property}" "${expected}") + elseif (alias STREQUAL "") + check_property("alias::${target_name}" "${property}" "") + else () + message(FATAL_ERROR + "Invalid `alias` entry for property '${property}': '${alias}'") + endif () + endif () + endforeach () + endforeach () + + foreach (target_type IN LISTS "not_${applied_types}") + set(target_name "${RunCMake_TEST}${iteration}-${target_type}-unset") + if (with_defaults) + string(APPEND target_name "-defaults") + endif () + make_target("${target_name}" "${target_type}") + foreach (property IN LISTS expected_properties) + check_property("${target_name}" "${property}" "") + if (NOT target_type STREQUAL "CUSTOM") + check_property("alias::${target_name}" "${property}" "") + endif () + endforeach () + endforeach () +endfunction () -- cgit v0.12 From 82507e80eb9060c5e1a3d60c46d42630e0173030 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:30:57 -0400 Subject: Tests/RunCMake/property_init: test 'always' properties All targets get these targets initialized. --- Tests/RunCMake/property_init/Always.cmake | 15 +++++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 Tests/RunCMake/property_init/Always.cmake diff --git a/Tests/RunCMake/property_init/Always.cmake b/Tests/RunCMake/property_init/Always.cmake new file mode 100644 index 0000000..db23563 --- /dev/null +++ b/Tests/RunCMake/property_init/Always.cmake @@ -0,0 +1,15 @@ +set(properties + # property expected alias + # Test a property which should never be initialized. + "notset" "" "" + + # Build graph properties + "VERIFY_INTERFACE_HEADER_SETS" "TRUE" "" + + # Metadata + "FOLDER" "folder" "" + ) + +prepare_target_types(always ${all_target_types}) + +run_property_tests(always properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 837e952..fb3579d 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -1 +1,3 @@ include(RunCMake) + +run_cmake(Always) -- cgit v0.12 From 5bad24935cb9f224181c20fc4fc394d58c54921f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:34:11 -0400 Subject: Tests/RunCMake/property_init: test 'can_compile' properties --- Tests/RunCMake/property_init/CompileSources.cmake | 274 ++++++++++++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 275 insertions(+) create mode 100644 Tests/RunCMake/property_init/CompileSources.cmake diff --git a/Tests/RunCMake/property_init/CompileSources.cmake b/Tests/RunCMake/property_init/CompileSources.cmake new file mode 100644 index 0000000..e8c5554 --- /dev/null +++ b/Tests/RunCMake/property_init/CompileSources.cmake @@ -0,0 +1,274 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Compilation properties + "COMPILE_WARNING_AS_ERROR" "ON" "" + "INTERPROCEDURAL_OPTIMIZATION" "OFF" "" + "NO_SYSTEM_FROM_IMPORTED" "ON" "" + "VISIBILITY_INLINES_HIDDEN" "ON" "" + ## Features + ### PCH + "DISABLE_PRECOMPILE_HEADERS" "ON" "" + "PCH_WARN_INVALID" "OFF" "" + "PCH_INSTANTIATE_TEMPLATES" "OFF" "" + ## Platforms + ### Android + "ANDROID_API" "9" "" + "ANDROID_API_MIN" "9" "" + "ANDROID_ARCH" "arm64-v8a" "" + "ANDROID_ASSETS_DIRECTORIES" "${dir}" "" + "ANDROID_JAVA_SOURCE_DIR" "${dir}" "" + "ANDROID_STL_TYPE" "system" "" + ### macOS + "OSX_ARCHITECTURES" "arm64" "" + ### Windows + "MSVC_DEBUG_INFORMATION_FORMAT" "Embedded" "" + "MSVC_RUNTIME_LIBRARY" "MultiThreaded" "" + "VS_JUST_MY_CODE_DEBUGGING" "ON" "" + ### OpenWatcom + "WATCOM_RUNTIME_LIBRARY" "MultiThreaded" "" + ## Language + ### CUDA + "CUDA_SEPARABLE_COMPILATION" "ON" "" + "CUDA_ARCHITECTURES" "naive" "" + ### Fortran + "Fortran_FORMAT" "FREE" "" + "Fortran_MODULE_DIRECTORY" "${dir}" "" + "Fortran_COMPILER_LAUNCHER" "ccache" "" + "Fortran_PREPROCESS" "ON" "" + "Fortran_VISIBILITY_PRESET" "hidden" "" + ### HIP + "HIP_ARCHITECTURES" "gfx801" "" + ### ISPC + "ISPC_COMPILER_LAUNCHER" "ccache" "" + "ISPC_HEADER_DIRECTORY" "${dir}" "" + "ISPC_HEADER_SUFFIX" "_i.h" "" + "ISPC_INSTRUCTION_SETS" "avx2-i32x4" "" + ### Swift + "Swift_LANGUAGE_VERSION" "2.3" "" + "Swift_MODULE_DIRECTORY" "${dir}" "" + ### moc + "AUTOMOC" "OFF" "" + "AUTOMOC_COMPILER_PREDEFINES" "OFF" "" + "AUTOMOC_MACRO_NAMES" "MOC_CLASS" "" + "AUTOMOC_MOC_OPTIONS" "-v" "" + "AUTOMOC_PATH_PREFIX" "moc_" "" + "AUTOMOC_EXECUTABLE" "automoc" "" + ### uic + "AUTOUIC" "OFF" "" + "AUTOUIC_OPTIONS" "-v" "" + "AUTOUIC_SEARCH_PATHS" "${dir}" "" + "AUTOUIC_EXECUTABLE" "autouic" "" + ### rcc + "AUTORCC" "OFF" "" + "AUTORCC_OPTIONS" "-v" "" + "AUTORCC_EXECUTABLE" "autorcc" "" + + # Linking properties + "LINK_SEARCH_START_STATIC" "-Bstatic" "" + "LINK_SEARCH_END_STATIC" "-Bdynamic" "" + ## Dependent library lookup + "MACOSX_RPATH" "@loader_path/" "" + ### Build + "BUILD_RPATH" "../lib" "" + "BUILD_RPATH_USE_ORIGIN" "ON" "" + "SKIP_BUILD_RPATH" "ON" "" + "BUILD_WITH_INSTALL_RPATH" "ON" "" + "BUILD_WITH_INSTALL_NAME_DIR" "@rpath/" "" + ### Install + "INSTALL_NAME_DIR" "@rpath/" "" + "INSTALL_REMOVE_ENVIRONMENT_RPATH" "ON" "" + "INSTALL_RPATH" "@rpath/" "" + "INSTALL_RPATH_USE_LINK_PATH" "ON" "" + ## Platforms + ### Android + "ANDROID_JAR_DIRECTORIES" "${dir}" "" + "ANDROID_JAR_DEPENDENCIES" "${dir}/foo.jar" "" + "ANDROID_NATIVE_LIB_DIRECTORIES" "${dir}" "" + "ANDROID_NATIVE_LIB_DEPENDENCIES" "${dir}/native.a" "" + "ANDROID_PROGUARD" "ON" "" + "ANDROID_PROGUARD_CONFIG_PATH" "proguard.props" "" + "ANDROID_SECURE_PROPS_PATH" "secure.props" "" + ### iOS + "IOS_INSTALL_COMBINED" "ON" "" + ### Windows + "GNUtoMS" "ON" "" + "WIN32_EXECUTABLE" "OFF" "" + ## Languages + ### C + "C_LINKER_LAUNCHER" "ccache" "" + ### C++ + "CXX_LINKER_LAUNCHER" "ccache" "" + ### CUDA + "CUDA_RESOLVE_DEVICE_SYMBOLS" "ON" "" + "CUDA_RUNTIME_LIBRARY" "Static" "" + ### HIP + "HIP_RUNTIME_LIBRARY" "SHARED" "" + ### Objective C + "OBJC_LINKER_LAUNCHER" "ccache" "" + ### Objective C++ + "OBJCXX_LINKER_LAUNCHER" "ccache" "" + + # Static analysis + ## C + "C_CLANG_TIDY" "clang-tidy" "" + "C_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + "C_CPPLINT" "cpplint" "" + "C_CPPCHECK" "cppcheck" "" + "C_INCLUDE_WHAT_YOU_USE" "iwyu" "" + ## C++ + "CXX_CLANG_TIDY" "clang-tidy" "" + "CXX_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + "CXX_CPPLINT" "cpplint" "" + "CXX_CPPCHECK" "cppcheck" "" + "CXX_INCLUDE_WHAT_YOU_USE" "iwyu" "" + ## Objective C + "OBJC_CLANG_TIDY" "clang-tidy" "" + "OBJC_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + ## Objective C++ + "OBJCXX_CLANG_TIDY" "clang-tidy" "" + "OBJCXX_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + ## Linking + "LINK_WHAT_YOU_USE" "lwyu" "" + + # Build graph properties + "LINK_DEPENDS_NO_SHARED" "OFF" "" + "UNITY_BUILD" "OFF" "" + "UNITY_BUILD_UNIQUE_ID" "unity" "" + "UNITY_BUILD_BATCH_SIZE" "10" "" + "UNITY_BUILD_MODE" "GROUP" "" + "OPTIMIZE_DEPENDENCIES" "ON" "" + ## Android + "ANDROID_ANT_ADDITIONAL_OPTIONS" "-v" "" + "ANDROID_PROCESS_MAX" "2" "" + "ANDROID_SKIP_ANT_STEP" "ON" "" + ## Autogen + "AUTOGEN_ORIGIN_DEPENDS" "OFF" "" + "AUTOGEN_PARALLEL" "ON" "" + "AUTOGEN_USE_SYSTEM_INCLUDE" "ON" "" + ## moc + "AUTOMOC_DEPEND_FILTERS" "FIRSTSECOND" "" + ## C++ + "CXX_SCAN_FOR_MODULES" "ON" "" + ## Ninja + "JOB_POOL_COMPILE" "compile_pool" "" + "JOB_POOL_LINK" "link_pool" "" + "JOB_POOL_PRECOMPILE_HEADER" "pch_pool" "" + ## Visual Studio + "VS_NO_COMPILE_BATCHING" "ON" "" + "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION" "10.0.10240.0" "" + + # Output location properties + "ARCHIVE_OUTPUT_DIRECTORY" "${dir}" "" + "COMPILE_PDB_OUTPUT_DIRECTORY" "${dir}" "" + "LIBRARY_OUTPUT_DIRECTORY" "${dir}" "" + "PDB_OUTPUT_DIRECTORY" "${dir}" "" + "RUNTIME_OUTPUT_DIRECTORY" "${dir}" "" + + # macOS bundle properties + "FRAMEWORK" "OFF" "" + "FRAMEWORK_MULTI_CONFIG_POSTFIX" ".mcpostfix" "" + "MACOSX_BUNDLE" "OFF" "" + + # Usage requirement properties + "LINK_INTERFACE_LIBRARIES" "c" "" + + # Metadata + "EXPORT_COMPILE_COMMANDS" "OFF" "" + ) + +if (CMAKE_HOST_APPLE) # compile-guarded in CMake + if (CMAKE_GENERATOR STREQUAL "Xcode") + list(APPEND properties + # property expected alias + # Xcode properties + "XCODE_SCHEME_ADDRESS_SANITIZER" "ON" "" + "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN" "ON" "" + "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING" "ON" "" + "XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE" "ON" "" + "XCODE_SCHEME_THREAD_SANITIZER" "ON" "" + "XCODE_SCHEME_THREAD_SANITIZER_STOP" "ON" "" + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER" "ON" "" + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "ON" "" + "XCODE_SCHEME_LAUNCH_CONFIGURATION" "ON" "" + "XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "ON" "" + "XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "ON" "" + "XCODE_SCHEME_WORKING_DIRECTORY" "ON" "" + "XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER" "ON" "" + "XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP" "ON" "" + "XCODE_SCHEME_MALLOC_SCRIBBLE" "ON" "" + "XCODE_SCHEME_MALLOC_GUARD_EDGES" "ON" "" + "XCODE_SCHEME_GUARD_MALLOC" "ON" "" + "XCODE_SCHEME_LAUNCH_MODE" "ON" "" + "XCODE_SCHEME_ZOMBIE_OBJECTS" "ON" "" + "XCODE_SCHEME_MALLOC_STACK" "ON" "" + "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE" "ON" "" + "XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS" "ON" "" + "XCODE_SCHEME_ENVIRONMENT" "ON" "" + "XCODE_LINK_BUILD_PHASE_MODE" "BUILT_ONLY" "" + ) + endif () +endif () + +macro (add_language_properties lang std) + list(APPEND properties + # property expected alias + "${lang}_COMPILER_LAUNCHER" "ccache" "" + "${lang}_STANDARD" "${std}" "" + "${lang}_STANDARD_REQUIRED" "TRUE" "" + "${lang}_EXTENSIONS" "FALSE" "" + "${lang}_VISIBILITY_PRESET" "hidden" "" + ) +endmacro () + +# Mock up knowing the standard flag. This doesn't actually build, so nothing +# should care at this point. +set(CMAKE_Cc_std_11_STANDARD_COMPILE_OPTION "-std=c11") + +add_language_properties(C c_std_11) +add_language_properties(CXX cxx_std_11) +add_language_properties(CUDA cuda_std_11) +add_language_properties(HIP hip_std_11) +add_language_properties(OBJC c_std_99) +add_language_properties(OBJCXX cxx_std_11) + +# Set up pools for properties set above. +if (CMAKE_GENERATOR MATCHES "Ninja") + set_property(GLOBAL APPEND + PROPERTY + JOB_POOLS + compile_pool=1 + link_pool=1 + pch_pool=1) +endif () + +prepare_target_types(can_compile_sources + EXECUTABLE SHARED STATIC MODULE OBJECT) + +run_property_tests(can_compile_sources properties) + +set(properties_with_defaults + # property expected alias + "PCH_WARN_INVALID" "ON" "" + "PCH_INSTANTIATE_TEMPLATES" "ON" "" + "ISPC_HEADER_SUFFIX" "_ispc.h" "" + "SKIP_BUILD_RPATH" "OFF" "" + "BUILD_WITH_INSTALL_RPATH" "OFF" "" + "INSTALL_RPATH" "" "" + "INSTALL_RPATH_USE_LINK_PATH" "OFF" "" + "UNITY_BUILD_BATCH_SIZE" "8" "" + "UNITY_BUILD_MODE" "BATCH" "" + ) + +if (CMAKE_HOST_APPLE) + if (CMAKE_GENERATOR STREQUAL "Xcode") + list(APPEND properties_with_defaults + # property expected alias + "XCODE_LINK_BUILD_PHASE_MODE" "NONE" "" + ) + endif () +endif () + +set(with_defaults 1) +run_property_tests(can_compile_sources properties_with_defaults) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index fb3579d..ce66ff1 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(Always) +run_cmake(CompileSources) -- cgit v0.12 From a6ebd68aa7917fda6afd06064b862118ef26f6dd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:35:19 -0400 Subject: Tests/RunCMake/property_init: test 'executable' properties --- Tests/RunCMake/property_init/Executable.cmake | 25 +++++++++++++++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 26 insertions(+) create mode 100644 Tests/RunCMake/property_init/Executable.cmake diff --git a/Tests/RunCMake/property_init/Executable.cmake b/Tests/RunCMake/property_init/Executable.cmake new file mode 100644 index 0000000..ede0e4b --- /dev/null +++ b/Tests/RunCMake/property_init/Executable.cmake @@ -0,0 +1,25 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Compilation properties + ## Platforms + ### Windows + "VS_DEBUGGER_COMMAND" "vsdbg" "" + "VS_DEBUGGER_COMMAND_ARGUMENTS" "/?" "" + "VS_DEBUGGER_ENVIRONMENT" "env=val" "" + "VS_DEBUGGER_WORKING_DIRECTORY" "${dir}" "" + + # Linking properties + ## Platforms + ### Android + "ANDROID_GUI" "OFF" "" + + # Metadata + "CROSSCOMPILING_EMULATOR" "emu" "" + ) + +prepare_target_types(executable + EXECUTABLE + IMPORTED_EXECUTABLE) +run_property_tests(executable properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index ce66ff1..b8c155f 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -2,3 +2,4 @@ include(RunCMake) run_cmake(Always) run_cmake(CompileSources) +run_cmake(Executable) -- cgit v0.12 From a048be7e3a3c25afd87bd999916e23f541c3db38 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:36:05 -0400 Subject: Tests/RunCMake/property_init: test 'imported' properties --- Tests/RunCMake/property_init/ImportedTargets.cmake | 9 +++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 10 insertions(+) create mode 100644 Tests/RunCMake/property_init/ImportedTargets.cmake diff --git a/Tests/RunCMake/property_init/ImportedTargets.cmake b/Tests/RunCMake/property_init/ImportedTargets.cmake new file mode 100644 index 0000000..0b51998 --- /dev/null +++ b/Tests/RunCMake/property_init/ImportedTargets.cmake @@ -0,0 +1,9 @@ +set(properties + # property expected alias + "SYSTEM" "ON" "" + ) + +prepare_target_types(imported + IMPORTED_EXECUTABLE IMPORTED_INTERFACE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +set(with_defaults 1) +run_property_tests(imported properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index b8c155f..6ac4ceb 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -3,3 +3,4 @@ include(RunCMake) run_cmake(Always) run_cmake(CompileSources) run_cmake(Executable) +run_cmake(ImportedTargets) -- cgit v0.12 From bb469aef2d4aceaf347962ec790e486e71108963 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:45:07 -0400 Subject: Tests/RunCMake/property_init: add `per_config` table builder helper --- Tests/RunCMake/property_init/util.cmake | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index 564a229..7edc6f9 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -23,6 +23,41 @@ function (prepare_target_types name) set("not_${name}" "${all_target_types}" PARENT_SCOPE) endfunction () +function (per_config variable) + prepare_properties("${property_table}" properties expected_values expected_alias) + + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if (is_multi_config) + set(configs "${CMAKE_CONFIGURATION_TYPES}") + else () + if (NOT CMAKE_BUILD_TYPE STREQUAL "") + set(configs "${CMAKE_BUILD_TYPE}") + endif () + endif () + + foreach (property expected alias IN ZIP_LISTS expected_properties expected_values expected_alias) + if (property MATCHES "^_") + set(prepend 1) + elseif (property MATCHES "_$") + set(prepend 0) + else () + message(SEND_ERROR + "Per-config properties must have a `_` at one end of their name: '${property}'") + endif () + foreach (config IN LISTS configs) + if (prepend) + list(APPEND "${variable}" + "${config}_${property}" "${value}/${config}" "${alias}") + else () + list(APPEND "${variable}" + "${property}_${config}" "${value}/${config}" "${alias}") + endif () + endforeach () + endforeach () + + set("${variable}" "${${variable}}" PARENT_SCOPE) +endfunction () + function (make_target name type) if (type STREQUAL "EXECUTABLE") add_executable("${name}") -- cgit v0.12 From 313c6a9c7435626d1cfbf1e7dd57a22b56c795a4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:36:52 -0400 Subject: Tests/RunCMake/property_init: test 'library_with_artifact' properties --- Tests/RunCMake/property_init/LibraryArtifact.cmake | 10 ++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 11 insertions(+) create mode 100644 Tests/RunCMake/property_init/LibraryArtifact.cmake diff --git a/Tests/RunCMake/property_init/LibraryArtifact.cmake b/Tests/RunCMake/property_init/LibraryArtifact.cmake new file mode 100644 index 0000000..942b433 --- /dev/null +++ b/Tests/RunCMake/property_init/LibraryArtifact.cmake @@ -0,0 +1,10 @@ +per_config(properties + # property expected alias + # Linking properties + "_POSTFIX" "test" "" + ) + +prepare_target_types(library_with_artifact + MODULE SHARED STATIC + IMPORTED_MODULE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(library_with_artifact properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 6ac4ceb..4a54db4 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(Always) run_cmake(CompileSources) run_cmake(Executable) run_cmake(ImportedTargets) +run_cmake(LibraryArtifact) -- cgit v0.12 From c1ff120e420006575d21aa937d9a26e3fe4e4943 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:37:27 -0400 Subject: Tests/RunCMake/property_init: test 'linkable' properties --- Tests/RunCMake/property_init/Linkable.cmake | 12 ++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 13 insertions(+) create mode 100644 Tests/RunCMake/property_init/Linkable.cmake diff --git a/Tests/RunCMake/property_init/Linkable.cmake b/Tests/RunCMake/property_init/Linkable.cmake new file mode 100644 index 0000000..e5d75d1 --- /dev/null +++ b/Tests/RunCMake/property_init/Linkable.cmake @@ -0,0 +1,12 @@ +per_config(properties + # property expected alias + # Linking properties + ## Platforms + ### macOS + "FRAMEWORK_MULTI_CONFIG_POSTFIX_" ".fw" "" + ) + +prepare_target_types(linkable + EXECUTABLE SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(linkable properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 4a54db4..dde6a9f 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -5,3 +5,4 @@ run_cmake(CompileSources) run_cmake(Executable) run_cmake(ImportedTargets) run_cmake(LibraryArtifact) +run_cmake(Linkable) -- cgit v0.12 From 0b56e3fedd25e76de344baf1d5c2249e475afe9a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:39:12 -0400 Subject: Tests/RunCMake/property_init: test 'normal_non_imported' properties --- Tests/RunCMake/property_init/NonImportedNormalTarget.cmake | 9 +++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 10 insertions(+) create mode 100644 Tests/RunCMake/property_init/NonImportedNormalTarget.cmake diff --git a/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake b/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake new file mode 100644 index 0000000..cf3b726 --- /dev/null +++ b/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake @@ -0,0 +1,9 @@ +set(properties + # property expected alias + # Linking properties + "LINK_LIBRARIES_ONLY_TARGETS" "OFF" "" + ) + +prepare_target_types(normal_non_imported + EXECUTABLE SHARED STATIC MODULE OBJECT INTERFACE) +run_property_tests(normal_non_imported properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index dde6a9f..c76957d 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(Executable) run_cmake(ImportedTargets) run_cmake(LibraryArtifact) run_cmake(Linkable) +run_cmake(NonImportedNormalTarget) -- cgit v0.12 From bc318ceb7f8a046edddd0288e085e6323ba7da4f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:39:42 -0400 Subject: Tests/RunCMake/property_init: test 'non_imported' properties --- Tests/RunCMake/property_init/NonImportedTarget.cmake | 11 +++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 12 insertions(+) create mode 100644 Tests/RunCMake/property_init/NonImportedTarget.cmake diff --git a/Tests/RunCMake/property_init/NonImportedTarget.cmake b/Tests/RunCMake/property_init/NonImportedTarget.cmake new file mode 100644 index 0000000..7e2e22c --- /dev/null +++ b/Tests/RunCMake/property_init/NonImportedTarget.cmake @@ -0,0 +1,11 @@ +set(properties + # property expected alias + # Compilation properties + ## Language + ### CSharp + "DOTNET_SDK" "Microsoft.NET.Sdk" "" + ) + +prepare_target_types(non_imported + EXECUTABLE SHARED STATIC MODULE OBJECT INTERFACE CUSTOM) +run_property_tests(non_imported properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index c76957d..8aff7de 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -7,3 +7,4 @@ run_cmake(ImportedTargets) run_cmake(LibraryArtifact) run_cmake(Linkable) run_cmake(NonImportedNormalTarget) +run_cmake(NonImportedTarget) -- cgit v0.12 From 141049cf1654410efd961f424b65a5df6dd6fd5a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:40:18 -0400 Subject: Tests/RunCMake/property_init: test 'normal' properties --- Tests/RunCMake/property_init/NormalTarget.cmake | 10 ++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 11 insertions(+) create mode 100644 Tests/RunCMake/property_init/NormalTarget.cmake diff --git a/Tests/RunCMake/property_init/NormalTarget.cmake b/Tests/RunCMake/property_init/NormalTarget.cmake new file mode 100644 index 0000000..99507cf --- /dev/null +++ b/Tests/RunCMake/property_init/NormalTarget.cmake @@ -0,0 +1,10 @@ +per_config(properties + # property expected alias + # Usage requirement properties + "MAP_IMPORTED_CONFIG_" "Release" "" + ) + +prepare_target_types(normal + EXECUTABLE INTERFACE MODULE OBJECT SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_INTERFACE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(normal properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 8aff7de..be531db 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(LibraryArtifact) run_cmake(Linkable) run_cmake(NonImportedNormalTarget) run_cmake(NonImportedTarget) +run_cmake(NormalTarget) -- cgit v0.12 From 653a32aa72ab1191d281a05b966eb599d473eedb Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:40:57 -0400 Subject: Tests/RunCMake/property_init: test 'pic_targets' properties --- Tests/RunCMake/property_init/PICTargets.cmake | 21 +++++++++++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 22 insertions(+) create mode 100644 Tests/RunCMake/property_init/PICTargets.cmake diff --git a/Tests/RunCMake/property_init/PICTargets.cmake b/Tests/RunCMake/property_init/PICTargets.cmake new file mode 100644 index 0000000..6c99505 --- /dev/null +++ b/Tests/RunCMake/property_init/PICTargets.cmake @@ -0,0 +1,21 @@ +set(properties + # property expected alias + # Compilation properties + "POSITION_INDEPENDENT_CODE" "True" "" + ) + +prepare_target_types(pic_targets + EXECUTABLE MODULE OBJECT SHARED STATIC + IMPORTED_MODULE IMPORTED_SHARED) +run_property_tests(pic_targets properties) + +set(APPEND properties_with_defaults + # property expected alias + "POSITION_INDEPENDENT_CODE" "True" "" + ) + +prepare_target_types(pic_default_targets + MODULE SHARED + IMPORTED_MODULE IMPORTED_SHARED) +set(with_defaults 1) +run_property_tests(pic_default_targets properties_with_defaults) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index be531db..6b4475c 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -9,3 +9,4 @@ run_cmake(Linkable) run_cmake(NonImportedNormalTarget) run_cmake(NonImportedTarget) run_cmake(NormalTarget) +run_cmake(PICTargets) -- cgit v0.12 From 02972ed9e830929a1a719e619e492de4b6b0f72e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:41:40 -0400 Subject: Tests/RunCMake/property_init: test 'shared_library' properties --- Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + Tests/RunCMake/property_init/SharedLibrary.cmake | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 Tests/RunCMake/property_init/SharedLibrary.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 6b4475c..214f279 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -10,3 +10,4 @@ run_cmake(NonImportedNormalTarget) run_cmake(NonImportedTarget) run_cmake(NormalTarget) run_cmake(PICTargets) +run_cmake(SharedLibrary) diff --git a/Tests/RunCMake/property_init/SharedLibrary.cmake b/Tests/RunCMake/property_init/SharedLibrary.cmake new file mode 100644 index 0000000..49715a4 --- /dev/null +++ b/Tests/RunCMake/property_init/SharedLibrary.cmake @@ -0,0 +1,12 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Linking properties + "DLL_NAME_WITH_SOVERSION" "OFF" "" + ) + +prepare_target_types(shared_library + SHARED + IMPORTED_SHARED) +run_property_tests(shared_library properties) -- cgit v0.12 From 5f1bf85f84991ea3e5973ddb904b5b0419303d89 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:43:29 -0400 Subject: Tests/RunCMake/property_init: test 'with_artifact' properties --- Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + .../RunCMake/property_init/TargetsWithArtifact.cmake | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Tests/RunCMake/property_init/TargetsWithArtifact.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 214f279..791d719 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cmake(NonImportedTarget) run_cmake(NormalTarget) run_cmake(PICTargets) run_cmake(SharedLibrary) +run_cmake(TargetsWithArtifact) diff --git a/Tests/RunCMake/property_init/TargetsWithArtifact.cmake b/Tests/RunCMake/property_init/TargetsWithArtifact.cmake new file mode 100644 index 0000000..0c19ea3 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithArtifact.cmake @@ -0,0 +1,19 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +per_config(properties + # property expected alias + # Compilation properties + "INTERPROCEDURAL_OPTIMIZATION_" "OFF" "" + + # Output location properties + "ARCHIVE_OUTPUT_DIRECTORY_" "${dir}" "" + "COMPILE_PDB_OUTPUT_DIRECTORY_" "${dir}" "" + "LIBRARY_OUTPUT_DIRECTORY_" "${dir}" "" + "PDB_OUTPUT_DIRECTORY_" "${dir}" "" + "RUNTIME_OUTPUT_DIRECTORY_" "${dir}" "" + ) + +prepare_target_types(with_artifact + EXECUTABLE MODULE SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_MODULE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(with_artifact properties) -- cgit v0.12 From efad4391e58175d36dc1b12611e504b0a339aae0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:43:41 -0400 Subject: Tests/RunCMake/property_init: test 'with_commands' properties --- Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + Tests/RunCMake/property_init/TargetsWithCommands.cmake | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 Tests/RunCMake/property_init/TargetsWithCommands.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 791d719..02b48c8 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -12,3 +12,4 @@ run_cmake(NormalTarget) run_cmake(PICTargets) run_cmake(SharedLibrary) run_cmake(TargetsWithArtifact) +run_cmake(TargetsWithCommands) diff --git a/Tests/RunCMake/property_init/TargetsWithCommands.cmake b/Tests/RunCMake/property_init/TargetsWithCommands.cmake new file mode 100644 index 0000000..4db0ca3 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithCommands.cmake @@ -0,0 +1,13 @@ +set(properties + # property expected alias + # Compilation properties + ## Language + ### CSharp + "DOTNET_TARGET_FRAMEWORK" "netcoreapp2.1" "" + "DOTNET_TARGET_FRAMEWORK_VERSION" "v4.5" "" + ) + +prepare_target_types(with_commands + EXECUTABLE MODULE OBJECT SHARED STATIC CUSTOM + IMPORTED_EXECUTABLE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(with_commands properties) -- cgit v0.12 From b66c494ca465766a6a46fc508d0ddd02b667873c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:44:42 -0400 Subject: Tests/RunCMake/property_init: test 'with_exports' properties --- Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + .../property_init/TargetsWithExports.cmake | 51 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Tests/RunCMake/property_init/TargetsWithExports.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 02b48c8..310da72 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -13,3 +13,4 @@ run_cmake(PICTargets) run_cmake(SharedLibrary) run_cmake(TargetsWithArtifact) run_cmake(TargetsWithCommands) +run_cmake(TargetsWithExports) diff --git a/Tests/RunCMake/property_init/TargetsWithExports.cmake b/Tests/RunCMake/property_init/TargetsWithExports.cmake new file mode 100644 index 0000000..9b2e213 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithExports.cmake @@ -0,0 +1,51 @@ +set(properties + # property expected alias + # Linking properties + ## Platforms + ### AIX + "AIX_EXPORT_ALL_SYMBOLS" "OFF" "" + ### Windows + "WINDOWS_EXPORT_ALL_SYMBOLS" "OFF" "" + ) + +prepare_target_types(symbol_export_target + EXECUTABLE SHARED + IMPORTED_EXECUTABLE IMPORTED_SHARED) +run_property_tests(symbol_export_target properties) + +# `ENABLE_EXPORTS` has a more complicated initialization. +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "" + ) + +prepare_target_types(executable + EXECUTABLE + IMPORTED_EXECUTABLE) +set(iteration "-ENABLE_EXPORTS") +run_property_tests(executable_target properties) + +set(with_defaults 1) + +set(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS OFF) +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "" + ) + +set(iteration "-SHARED_LIBRARY_ENABLE_EXPORTS") +run_property_tests(shared_library_target properties) +unset(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS) + +set(CMAKE_EXECUTABLE_ENABLE_EXPORTS OFF) +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "" + ) + +set(iteration "-EXECUTABLE_ENABLE_EXPORTS") +run_property_tests(executable_target properties) +unset(CMAKE_EXECUTABLE_ENABLE_EXPORTS) -- cgit v0.12