diff options
Diffstat (limited to 'Tests')
41 files changed, 232 insertions, 20 deletions
diff --git a/Tests/CMakeCommands/target_link_options/CMakeLists.txt b/Tests/CMakeCommands/target_link_options/CMakeLists.txt index c66cd37..3bb6ff3 100644 --- a/Tests/CMakeCommands/target_link_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_options/CMakeLists.txt @@ -15,5 +15,12 @@ if (NOT result MATCHES "-PRIVATE_FLAG") endif() get_target_property(result target_link_options_2 INTERFACE_LINK_OPTIONS) if (NOT result MATCHES "-INTERFACE_FLAG") - message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property") + message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property of shared library") +endif() + +add_library(target_link_options_3 STATIC EXCLUDE_FROM_ALL LinkOptionsLib.c) +target_link_options(target_link_options_3 INTERFACE -INTERFACE_FLAG) +get_target_property(result target_link_options_3 INTERFACE_LINK_OPTIONS) +if (NOT result MATCHES "-INTERFACE_FLAG") + message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property of static library") endif() diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu index 7eecec1..2c7c388 100644 --- a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu +++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu @@ -3,6 +3,9 @@ #include <cuda_runtime.h> #include <iostream> +// this test only makes sense for versions of CUDA that ships +// static libraries that have separable compilation device symbols +#if __CUDACC_VER_MAJOR__ <= 9 __global__ void deviceCublasSgemm(int n, float alpha, float beta, const float* d_A, const float* d_B, float* d_C) @@ -22,6 +25,7 @@ __global__ void deviceCublasSgemm(int n, float alpha, float beta, cublasDestroy(cnpHandle); } +#endif int choose_cuda_device() { @@ -63,6 +67,7 @@ int main(int argc, char** argv) return 0; } +#if __CUDACC_VER_MAJOR__ <= 9 // initial values that will make sure that the cublasSgemm won't actually // do any work int n = 0; @@ -72,6 +77,7 @@ int main(int argc, char** argv) float* d_B = nullptr; float* d_C = nullptr; deviceCublasSgemm<<<1, 1>>>(n, alpha, beta, d_A, d_B, d_C); +#endif return 0; } diff --git a/Tests/FindPackageModeMakefileTest/foo.cpp b/Tests/FindPackageModeMakefileTest/foo.cpp index 6aea226..7cb9381 100644 --- a/Tests/FindPackageModeMakefileTest/foo.cpp +++ b/Tests/FindPackageModeMakefileTest/foo.cpp @@ -1,3 +1,5 @@ +#include "foo.h" + int foo() { return 1477; diff --git a/Tests/FindPackageModeMakefileTest/foo.h b/Tests/FindPackageModeMakefileTest/foo.h index 4ec598a..7051eda 100644 --- a/Tests/FindPackageModeMakefileTest/foo.h +++ b/Tests/FindPackageModeMakefileTest/foo.h @@ -1,6 +1,14 @@ #ifndef FOO_H #define FOO_H +#ifdef __cplusplus +extern "C" { +#endif + int foo(); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 0876871..3fd5541 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -188,7 +188,7 @@ find_package(ArchC 3.1 EXACT NAMES zot) find_package(ArchD 4.0 EXACT NAMES zot) unset(CMAKE_LIBRARY_ARCHITECTURE) -# Test <Package>_DIR environment variable. +# Test <PackageName>_DIR environment variable. # We erase the main prefix path to ensure the env var is used. set(CMAKE_PREFIX_PATH) set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1") diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 2027c4f..45798ce 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -61,8 +61,12 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) list(APPEND _abis_${_version} ${_abis}) endif() endforeach() - set(_abis_ ${_abis_${_latest_gcc}}) set(_abis_clang ${_abis_${_latest_clang}}) + if(_latest_gcc) + set(_abis_ ${_abis_${_latest_gcc}}) + else() + set(_abis_ ${_abis_clang}) + endif() if(_versions MATCHES "clang") set(_versions "clang" ${_versions}) endif() @@ -132,10 +136,11 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) set(stl_types none system - gnustl_static - gnustl_shared ) + if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gnu-libstdc++") + list(APPEND stl_types gnustl_static gnustl_shared) + endif() if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs") list(APPEND stl_types gabi++_static gabi++_shared) endif() diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index f931be1..aaa7c89 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -8,7 +8,6 @@ endif() foreach(f "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" - "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" ) @@ -61,10 +60,12 @@ execute_process( if(NOT _res EQUAL 0) message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}") endif() -if(NOT _out STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}") +string(REPLACE "--" "-" _out_check "${_out}") +if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}" + AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi")) message(SEND_ERROR "'gcc -dumpmachine' produced:\n" " ${_out}\n" - "which is not equal to CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n" + "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n" " ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}" ) endif() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b273c1e..91fed3e 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -35,4 +35,4 @@ run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad" "Ext" false "MONOLITHIC;COMPONENT") +run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "Ext" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake index 2634111..91608c9 100644 --- a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake @@ -1,4 +1,5 @@ -if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$") +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt") else() diff --git a/Tests/RunCMake/CPack/tests/EXT/create_package.cmake b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake new file mode 100644 index 0000000..e308ccb --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake @@ -0,0 +1,24 @@ +message("This script could run an external packaging tool") + +function(expect_variable VAR) + if(NOT ${VAR}) + message(FATAL_ERROR "${VAR} is unexpectedly not set") + endif() +endfunction() + +function(expect_file FILE) + if(NOT EXISTS "${FILE}") + message(FATAL_ERROR "${FILE} is unexpectedly missing") + endif() +endfunction() + +expect_variable(CPACK_COMPONENTS_ALL) +expect_variable(CPACK_TOPLEVEL_DIRECTORY) +expect_variable(CPACK_TEMPORARY_DIRECTORY) +expect_variable(CPACK_PACKAGE_DIRECTORY) +expect_variable(CPACK_PACKAGE_FILE_NAME) + +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt) diff --git a/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt new file mode 100644 index 0000000..40f2743 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt @@ -0,0 +1 @@ +^This script could run an external packaging tool$ diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake index 6bd3cb8..976cb6a 100644 --- a/Tests/RunCMake/CPack/tests/EXT/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake @@ -14,6 +14,9 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good") set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") set(CPACK_EXT_REQUESTED_VERSIONS "1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") + set(CPACK_EXT_ENABLE_STAGING 1) + set(CPACK_EXT_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake") endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) diff --git a/Tests/RunCMake/LinkStatic/LinkOptionsLib.c b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake index 0d29492..d3a8afb 100644 --- a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake +++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake @@ -1,3 +1,30 @@ include(RunCMake) run_cmake(LINK_SEARCH_STATIC) + + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + # Intel compiler does not reject bad flags or objects! + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(STATIC_LIBRARY_OPTIONS) + + run_cmake_target(STATIC_LIBRARY_OPTIONS basic StaticLinkOptions) + run_cmake_target(STATIC_LIBRARY_OPTIONS genex StaticLinkOptions_genex --config Release) + run_cmake_target(STATIC_LIBRARY_OPTIONS shared SharedLinkOptions) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake new file mode 100644 index 0000000..858ce06 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG'.") +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake new file mode 100644 index 0000000..8c1e96e --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake @@ -0,0 +1,4 @@ + +if (actual_stdout MATCHES "BADFLAG") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected flag 'BADFLAG'.") +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake new file mode 100644 index 0000000..587af1d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake @@ -0,0 +1,21 @@ + +enable_language(C) + +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_library(StaticLinkOptions STATIC LinkOptionsLib.c) +set_property(TARGET StaticLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj}) + +# static library with generator expression +add_library(StaticLinkOptions_genex STATIC LinkOptionsLib.c) +set_property(TARGET StaticLinkOptions_genex PROPERTY STATIC_LIBRARY_OPTIONS + $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> + "SHELL:" # produces no options + ) + +# shared library do not use property STATIC_LIBRARY_OPTIONS +add_library(SharedLinkOptions SHARED LinkOptionsLib.c) +set_property(TARGET SharedLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj}) diff --git a/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake new file mode 100644 index 0000000..da6f86a --- /dev/null +++ b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.12) +project(Test LANGUAGES C) + +# fake launcher executable +set(input_launcher_executable ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable "") + +# application and executable name +set(application_target "HelloApp") +set(application_name "Hello") +set(executable_name "Hello") + +# target built in "<root>/bin" +add_executable(${application_target} hello.c) +set_target_properties(${application_target} PROPERTIES + OUTPUT_NAME ${executable_name} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin + ) + +# configured launcher in "<root>" +set(configured_launcher_executable "${CMAKE_CURRENT_BINARY_DIR}/${application_name}") + +# create command to copy the launcher +add_custom_command( + DEPENDS + ${input_launcher_executable} + OUTPUT + ${configured_launcher_executable} + COMMAND + ${CMAKE_COMMAND} -E copy ${input_launcher_executable} ${configured_launcher_executable} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT + "Configuring application launcher: ${application_name}" + ) + +add_custom_target(Configure${application_name}Launcher ALL + DEPENDS + ${application_target} + ${input_launcher_executable} + ${configured_launcher_executable} + ) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index b6e6cd4..e0ddc9c 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -278,3 +278,10 @@ foreach(ninja_output_path_prefix "sub space" "sub") run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}") run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}") endforeach(ninja_output_path_prefix) + +function (run_PreventTargetAliasesDupBuildRule) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventTargetAliasesDupBuildRule-build) + run_cmake(PreventTargetAliasesDupBuildRule) + run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) +endfunction () +run_PreventTargetAliasesDupBuildRule() diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/export/ExportPropertiesUndefined.cmake b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake new file mode 100644 index 0000000..aa529f2 --- /dev/null +++ b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + EXPORT_PROPERTIES "NotDefinedProp" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 10ced90..46bb1fc 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(NoExportSet) run_cmake(ForbiddenToExportInterfaceProperties) run_cmake(ForbiddenToExportImportedProperties) run_cmake(ForbiddenToExportPropertyWithGenExp) +run_cmake(ExportPropertiesUndefined) diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake new file mode 100644 index 0000000..6c5ffdb --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake new file mode 100644 index 0000000..b68e451 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake @@ -0,0 +1,7 @@ + +if (actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Found 'BADFLAG_RELEASE' which was not expected.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake index f17195d..bb04841 100644 --- a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake @@ -22,6 +22,22 @@ add_executable(LinkOptions_consumer LinkOptionsExe.c) target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer) +# static library with INTERFACE_LINK_OPTIONS +add_library(LinkOptions_producer_static STATIC LinkOptionsLib.c) +target_link_options(LinkOptions_producer_static + INTERFACE ${pre}BADFLAG_INTERFACE${obj}) + +add_executable(LinkOptions_consumer_static LinkOptionsExe.c) +target_link_libraries(LinkOptions_consumer_static PRIVATE LinkOptions_producer_static) + + +# static library with generator expression +add_library(LinkOptions_static STATIC LinkOptionsLib.c) +target_link_options(LinkOptions_static PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> + "SHELL:" # produces no options + ) + + # shared library with generator expression add_library(LinkOptions_shared SHARED LinkOptionsLib.c) target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index 121a0ce..1eaa5d2 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -21,6 +21,8 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(LINK_OPTIONS basic LinkOptions) run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer) + run_cmake_target(LINK_OPTIONS interface-static LinkOptions_consumer_static) + run_cmake_target(LINK_OPTIONS static LinkOptions_static --config Release) run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) |