diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-26 19:43:57 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-26 19:43:57 (GMT) |
commit | b8937a992b956b16a9181737f695ca118c5eea49 (patch) | |
tree | 02b30e7d14f767c28e0ef69af3351f343d7bf8c9 /Tests/RunCMake | |
parent | d13bd6ec3d7232b4b62d3106684f4f57951f3b28 (diff) | |
parent | 9fa7afe7d332ced27264f1ef7c921aa1d95bc476 (diff) | |
download | CMake-b8937a992b956b16a9181737f695ca118c5eea49.zip CMake-b8937a992b956b16a9181737f695ca118c5eea49.tar.gz CMake-b8937a992b956b16a9181737f695ca118c5eea49.tar.bz2 |
Merge branch 'release' into ninja-multi-per-config-sources
Diffstat (limited to 'Tests/RunCMake')
1471 files changed, 11145 insertions, 620 deletions
diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 45798ce..c4b1a00 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -18,15 +18,33 @@ function(run_Android case) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(${case}) - run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .) + set(configs ".") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(configs Release Debug) + endif() + foreach(config IN LISTS configs) + set(build_suffix) + set(config_arg) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(build_suffix "-${config}") + set(config_arg --config "${config}") + endif() + run_cmake_command(${case}-build${build_suffix} ${CMAKE_COMMAND} --build . ${config_arg}) + endforeach() endfunction() +set(RunCMake_GENERATOR_PLATFORM_OLD "${RunCMake_GENERATOR_PLATFORM}") + +if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") +endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSROOT=${CMAKE_CURRENT_SOURCE_DIR} ) run_cmake(BadSYSROOT) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") foreach(ndk IN LISTS TEST_ANDROID_NDK) # Load available toolchain versions and abis. @@ -70,6 +88,9 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) if(_versions MATCHES "clang") set(_versions "clang" ${_versions}) endif() + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(_versions "clang") + endif() list(REMOVE_DUPLICATES _versions) list(SORT _versions) set(_versions ";${_versions}") @@ -77,44 +98,58 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) list(REMOVE_DUPLICATES _abis_${vers}) endforeach() + set(ndk_arg -DCMAKE_ANDROID_NDK=${ndk}) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(ndk_arg) + endif() + # Test failure cases. message(STATUS "ndk='${ndk}'") + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARCH_ABI=badabi ) run_cmake(ndk-badabi) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "x86") + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_ARM_MODE=0 ) run_cmake(ndk-badarm) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") + endif() if("armeabi" IN_LIST _abis_) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARM_NEON=0 ) run_cmake(ndk-badneon) endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=badver ) run_cmake(ndk-badver) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=1.0 ) run_cmake(ndk-badvernum) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_STL_TYPE=badstl ) run_cmake(ndk-badstl) @@ -122,7 +157,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) # Find a sysroot to test. file(GLOB _sysroots "${ndk}/platforms/android-[0-9][0-9]/arch-arm") - if(_sysroots) + if(_sysroots AND "armeabi" IN_LIST _abis_) list(GET _sysroots 0 _sysroot) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android @@ -131,6 +166,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) run_cmake(ndk-sysroot-armeabi) unset(RunCMake_TEST_OPTIONS) endif() + set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") # Find available STLs. set(stl_types @@ -157,23 +193,41 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) armeabi-v6 armeabi-v7a arm64-v8a - mips - mips64 x86 x86_64 ) + if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") + list(APPEND abi_names mips mips64) + endif() + set(abi_to_arch_armeabi ARM) + set(abi_to_arch_armeabi-v6 ARM) + set(abi_to_arch_armeabi-v7a ARM) + set(abi_to_arch_arm64-v8a ARM64) + set(abi_to_arch_x86 x86) + set(abi_to_arch_x86_64 x64) # Test all combinations. foreach(vers IN LISTS _versions) foreach(stl IN LISTS stl_types) - foreach(config Release Debug) + set(configs Release Debug) + set(foreach_list "${configs}") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(foreach_list ".") + endif() + foreach(config IN LISTS foreach_list) # Test this combination for all available abis. - message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}' config='${config}'") + set(config_status " config='${config}'") + set(build_type_arg "-DCMAKE_BUILD_TYPE=${config}") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(config_status) + string(REPLACE ";" "\\\\;" build_type_arg "-DCMAKE_CONFIGURATION_TYPES=${configs}") + endif() + message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}'${config_status}") set(RunCMake_TEST_OPTIONS - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=${vers} -DCMAKE_ANDROID_STL_TYPE=${stl} - -DCMAKE_BUILD_TYPE=${config} + "${build_type_arg}" ) foreach(abi IN LISTS abi_names) # Skip ABIs not supported by this compiler. @@ -182,6 +236,9 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) endif() # Run the tests for this combination. + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "${abi_to_arch_${abi}}") + endif() if("${abi}" STREQUAL "armeabi") run_Android(ndk-armeabi-thumb) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi -DCMAKE_ANDROID_ARM_MODE=0 run_Android(ndk-armeabi-arm -DCMAKE_ANDROID_ARM_MODE=1) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi @@ -191,6 +248,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) run_Android(ndk-${abi}-neon -DCMAKE_ANDROID_ARCH_ABI=${abi} -DCMAKE_ANDROID_ARM_NEON=1) endif() endif() + set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") endforeach() unset(RunCMake_TEST_OPTIONS) endforeach() diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index d96ab86..32412aa 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -96,7 +96,7 @@ add_executable(android_c android.c) add_executable(android_cxx android.cxx) add_library(android_cxx_lib SHARED android_lib.cxx) -set(objdump "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}objdump") +set(objdump "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}objdump${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}") if(NOT EXISTS "${objdump}") message(FATAL_ERROR "Expected tool missing:\n ${objdump}") endif() diff --git a/Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt b/Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-x86-stderr.txt b/Tests/RunCMake/Android/ndk-x86-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-x86_64-stderr.txt b/Tests/RunCMake/Android/ndk-x86_64-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86_64-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/BundleUtilities/ExecutableScripts.cmake b/Tests/RunCMake/BundleUtilities/ExecutableScripts.cmake new file mode 100644 index 0000000..78a9b66 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/ExecutableScripts.cmake @@ -0,0 +1,18 @@ +include(BundleUtilities) + +set(BU_CHMOD_BUNDLE_ITEMS ON) + +function(check_script script) + fixup_bundle_item(${script} ${script} "" "") +endfunction() + +# Should not throw any errors +# Shell script +set(script_sh_EMBEDDED_ITEM ${CMAKE_CURRENT_LIST_DIR}/test.app/script.sh) +check_script(${CMAKE_CURRENT_LIST_DIR}/test.app/script.sh) +# Batch script +set(script_bat_EMBEDDED_ITEM ${CMAKE_CURRENT_LIST_DIR}/test.app/script.bat) +check_script(${CMAKE_CURRENT_LIST_DIR}/test.app/script.bat) +# Shell script without extension +set(script_EMBEDDED_ITEM ${CMAKE_CURRENT_LIST_DIR}/test.app/script) +check_script(${CMAKE_CURRENT_LIST_DIR}/test.app/script) diff --git a/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake b/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake index 14aaff1..df28102 100644 --- a/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake +++ b/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake @@ -9,3 +9,4 @@ run_cmake(CMP0080-WARN) run_cmake_command(CMP0080-COMMAND-OLD ${CMAKE_COMMAND} -DCMP0080_VALUE:STRING=OLD -P ${RunCMake_SOURCE_DIR}/CMP0080-COMMAND.cmake) run_cmake_command(CMP0080-COMMAND-NEW ${CMAKE_COMMAND} -DCMP0080_VALUE:STRING=NEW -P ${RunCMake_SOURCE_DIR}/CMP0080-COMMAND.cmake) run_cmake_command(CMP0080-COMMAND-WARN ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/CMP0080-COMMAND.cmake) +run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake) diff --git a/Tests/RunCMake/BundleUtilities/test.app/script b/Tests/RunCMake/BundleUtilities/test.app/script new file mode 100755 index 0000000..23bf47c --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/test.app/script @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World" diff --git a/Tests/RunCMake/BundleUtilities/test.app/script.bat b/Tests/RunCMake/BundleUtilities/test.app/script.bat new file mode 100755 index 0000000..dbb0ec2 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/test.app/script.bat @@ -0,0 +1,3 @@ +@echo off + +echo "Hello world" diff --git a/Tests/RunCMake/BundleUtilities/test.app/script.sh b/Tests/RunCMake/BundleUtilities/test.app/script.sh new file mode 100755 index 0000000..23bf47c --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/test.app/script.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World" diff --git a/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt index 048762d..a446211 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt @@ -1,4 +1,11 @@ -^CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\): +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. ++ +CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\): The OLD behavior for policy CMP0019 will be removed from a future version of CMake. diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt index 1e4b47d..f7b9c0e 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt @@ -1,3 +1,10 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. ++ CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0019 is not set: Do not re-expand variables in include and link information. Run "cmake --help-policy CMP0019" for policy details. Use diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt index 6a6a0c7..87404d3 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt @@ -1,3 +1,10 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. ++ CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt index 2f7dfbf..5d75720 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt @@ -1,4 +1,11 @@ -^CMake Warning \(dev\) in CMakeLists.txt: +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. ++ +CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake index 650c8a5..ae62e79 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake +++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake @@ -1,6 +1,7 @@ enable_language(CXX) +cmake_policy(SET CMP0111 OLD) add_library(someimportedlib SHARED IMPORTED) get_target_property(_loc someimportedlib LOCATION) diff --git a/Tests/RunCMake/CMP0026/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/CMP0026/CMakeLists.txt +++ b/Tests/RunCMake/CMP0026/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0027/CMakeLists.txt b/Tests/RunCMake/CMP0027/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/CMP0027/CMakeLists.txt +++ b/Tests/RunCMake/CMP0027/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0028/CMakeLists.txt b/Tests/RunCMake/CMP0028/CMakeLists.txt index 144cdb4..4f867df 100644 --- a/Tests/RunCMake/CMP0028/CMakeLists.txt +++ b/Tests/RunCMake/CMP0028/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir diff --git a/Tests/RunCMake/CMP0037/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/CMP0037/CMakeLists.txt +++ b/Tests/RunCMake/CMP0037/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0041/CMakeLists.txt b/Tests/RunCMake/CMP0041/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/CMP0041/CMakeLists.txt +++ b/Tests/RunCMake/CMP0041/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0042/CMakeLists.txt b/Tests/RunCMake/CMP0042/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/CMP0042/CMakeLists.txt +++ b/Tests/RunCMake/CMP0042/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0043/CMakeLists.txt b/Tests/RunCMake/CMP0043/CMakeLists.txt index d027f3e..cc8a6f8 100644 --- a/Tests/RunCMake/CMP0043/CMakeLists.txt +++ b/Tests/RunCMake/CMP0043/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir diff --git a/Tests/RunCMake/CMP0045/CMakeLists.txt b/Tests/RunCMake/CMP0045/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/CMP0045/CMakeLists.txt +++ b/Tests/RunCMake/CMP0045/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake new file mode 100644 index 0000000..564169d --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake @@ -0,0 +1,9 @@ +# Prevent duplicate errors on some platforms. +set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder") + +add_library(unknown_lib UNKNOWN IMPORTED) +add_library(static_lib STATIC IMPORTED) +add_library(shared_lib SHARED IMPORTED) + +add_executable(executable main.cpp) +target_link_libraries(executable unknown_lib static_lib shared_lib) diff --git a/Tests/RunCMake/interface_library/whitelist-result.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/whitelist-result.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt new file mode 100644 index 0000000..ba5d936 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt @@ -0,0 +1,7 @@ +CMake Error in CMakeLists.txt: + IMPORTED_LOCATION not set for imported target "static_lib"( configuration + ".+")?. ++ +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration + ".+")?. diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake b/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake new file mode 100644 index 0000000..d0c8dd3 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0111 NEW) +include(CMP0111-Common.cmake) diff --git a/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake b/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake new file mode 100644 index 0000000..d00847a --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0111 OLD) +include(CMP0111-Common.cmake) diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt new file mode 100644 index 0000000..3abca0a --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt @@ -0,0 +1,29 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target missing its location property + fails during generation. Run "cmake --help-policy CMP0111" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration + ".+")?. +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target missing its location property + fails during generation. Run "cmake --help-policy CMP0111" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + IMPORTED_LOCATION not set for imported target "static_lib"( configuration + ".+")?. +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target missing its location property + fails during generation. Run "cmake --help-policy CMP0111" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration + ".+")?. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake b/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake new file mode 100644 index 0000000..0efe48c --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake @@ -0,0 +1 @@ +include(CMP0111-Common.cmake) diff --git a/Tests/RunCMake/CMP0111/CMakeLists.txt b/Tests/RunCMake/CMP0111/CMakeLists.txt new file mode 100644 index 0000000..9f19a75 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.17) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0111/RunCMakeTest.cmake b/Tests/RunCMake/CMP0111/RunCMakeTest.cmake new file mode 100644 index 0000000..02e420a --- /dev/null +++ b/Tests/RunCMake/CMP0111/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0111-OLD) +run_cmake(CMP0111-NEW) +run_cmake(CMP0111-WARN) diff --git a/Tests/RunCMake/CMP0111/main.cpp b/Tests/RunCMake/CMP0111/main.cpp new file mode 100644 index 0000000..5047a34 --- /dev/null +++ b/Tests/RunCMake/CMP0111/main.cpp @@ -0,0 +1,3 @@ +int main() +{ +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ec4c7b5..7b85061 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -124,6 +124,7 @@ if(CMake_TEST_CUDA) PROPERTY LABELS "CUDA") endif() add_RunCMake_test(CMP0106) +add_RunCMake_test(CMP0111) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -166,6 +167,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) -DPSEUDO_BC=$<TARGET_FILE:pseudo_BC> -DPSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify> -DPSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind> + -DPSEUDO_CUDA_MEMCHECK=$<TARGET_FILE:pseudo_cuda-memcheck> -DPSEUDO_BC_NOLOG=$<TARGET_FILE:pseudonl_BC> -DPSEUDO_PURIFY_NOLOG=$<TARGET_FILE:pseudonl_purify> -DPSEUDO_VALGRIND_NOLOG=$<TARGET_FILE:pseudonl_valgrind> @@ -209,6 +211,7 @@ add_RunCMake_test(DisallowedCommands) if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(ExportCompileCommands) endif() +add_RunCMake_test(ExcludeFromAll) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) @@ -235,6 +238,9 @@ add_RunCMake_test(GenEx-GENEX_EVAL) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) +if(XCODE_VERSION) + set(GeneratorToolset_ARGS -DXCODE_VERSION=${XCODE_VERSION}) +endif() add_RunCMake_test(GeneratorToolset) add_RunCMake_test(GetPrerequisites) add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}) @@ -290,6 +296,7 @@ add_RunCMake_test(add_dependencies) add_RunCMake_test(add_executable) add_RunCMake_test(add_library) add_RunCMake_test(add_subdirectory) +add_RunCMake_test(add_test) add_RunCMake_test(build_command) add_executable(exit_code exit_code.c) set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>) @@ -301,9 +308,14 @@ add_RunCMake_test(export) add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) +add_RunCMake_test(cmake_path) add_RunCMake_test(continue) add_executable(color_warning color_warning.c) -add_RunCMake_test(ctest_build -DCOLOR_WARNING=$<TARGET_FILE:color_warning>) +add_executable(fake_build_command fake_build_command.c) +add_RunCMake_test(ctest_build + -DCOLOR_WARNING=$<TARGET_FILE:color_warning> + -DFAKE_BUILD_COMMAND_EXE=$<TARGET_FILE:fake_build_command> +) add_RunCMake_test(ctest_cmake_error) add_RunCMake_test(ctest_configure) if(COVERAGE_COMMAND) @@ -318,6 +330,7 @@ add_RunCMake_test(ctest_update) add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) add_RunCMake_test(file) +add_RunCMake_test(file-CHMOD) add_RunCMake_test(find_file) add_RunCMake_test(find_library -DCYGWIN=${CYGWIN}) add_RunCMake_test(find_package) @@ -381,6 +394,7 @@ function(add_RunCMake_test_try_compile) CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_STANDARD_DEFAULT CMake_TEST_CUDA + CMake_TEST_ISPC CMake_TEST_FILESYSTEM_1S CMAKE_OBJC_STANDARD_DEFAULT CMAKE_OBJCXX_STANDARD_DEFAULT @@ -391,7 +405,7 @@ function(add_RunCMake_test_try_compile) endforeach() add_RunCMake_test(try_compile) set_property(TEST RunCMake.try_compile APPEND - PROPERTY LABELS "CUDA") + PROPERTY LABELS "CUDA;ISPC") endfunction() add_RunCMake_test_try_compile() @@ -403,11 +417,12 @@ add_RunCMake_test(while) add_RunCMake_test(CMP0004) add_RunCMake_test(TargetPolicies) add_RunCMake_test(alias_targets) -add_RunCMake_test(interface_library) +add_RunCMake_test(InterfaceLibrary) add_RunCMake_test(no_install_prefix) add_RunCMake_test(configure_file) add_RunCMake_test(CTestTimeout -DTIMEOUT=${CTestTestTimeout_TIME}) add_RunCMake_test(CTestTimeoutAfterMatch) +add_RunCMake_test(DependencyGraph -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}) # ctresalloc links against CMakeLib and CTestLib, which means it can't be built # if CMake_TEST_EXTERNAL_CMAKE is activated (the compiler might be different.) @@ -523,14 +538,29 @@ add_RunCMake_test(target_compile_features) add_RunCMake_test(target_compile_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test(target_include_directories) add_RunCMake_test(target_sources) +add_RunCMake_test(CheckCompilerFlag -DCMake_TEST_CUDA=${CMake_TEST_CUDA} + -DCMake_TEST_ISPC=${CMake_TEST_ISPC}) +add_RunCMake_test(CheckSourceCompiles -DCMake_TEST_CUDA=${CMake_TEST_CUDA} + -DCMake_TEST_ISPC=${CMake_TEST_ISPC}) +add_RunCMake_test(CheckSourceRuns -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) +set_property(TEST RunCMake.CheckCompilerFlag + RunCMake.CheckSourceCompiles + RunCMake.CheckSourceRuns + APPEND PROPERTY LABELS "CUDA") +set_property(TEST RunCMake.CheckSourceCompiles + RunCMake.CheckCompilerFlag + APPEND PROPERTY LABELS "ISPC") add_RunCMake_test(CheckModules) add_RunCMake_test(CheckIPOSupported) if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)" AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU")) add_RunCMake_test(CheckLinkerFlag -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} - -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}) + -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID} + -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) + set_property(TEST RunCMake.CheckLinkerFlag APPEND PROPERTY LABELS "CUDA") endif() + add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) add_RunCMake_test(CommandLineTar) @@ -545,7 +575,10 @@ add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG} -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT} + -DCMake_TEST_ISPC=${CMake_TEST_ISPC} ) +set_property(TEST RunCMake.install APPEND + PROPERTY LABELS "ISPC") add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} @@ -555,6 +588,9 @@ add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES add_RunCMake_test(CPackCommandLine) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) +if(XCODE_VERSION) + set(ExternalProject_ARGS -DXCODE_VERSION=${XCODE_VERSION}) +endif() add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) @@ -623,6 +659,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(DEFINED CMake_TEST_CUDA) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() + if(DEFINED CMake_TEST_ISPC) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC}) + endif() if(CMAKE_Fortran_COMPILER) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1) endif() @@ -631,8 +670,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") endif() add_RunCMake_test(CompilerLauncher) set_property(TEST RunCMake.CompilerLauncher APPEND - PROPERTY LABELS "CUDA") + PROPERTY LABELS "CUDA;ISPC") add_RunCMake_test(ctest_labels_for_subprojects) + add_RunCMake_test(CompilerArgs) endif() set(cpack_tests @@ -698,8 +738,8 @@ add_RunCMake_test(AutoExportDll add_RunCMake_test(AndroidMK) if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) - if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja") - message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators") + if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja|Visual Studio 1[456]") + message(FATAL_ERROR "Android tests supported only by Makefile, Ninja, and Visual Studio >= 14 generators") endif() foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) if(CMake_${v}) @@ -725,5 +765,12 @@ endif() add_RunCMake_test("CTestCommandExpandLists") -add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) +add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} + -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}) + add_RunCMake_test("UnityBuild") +add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}) + +if(WIN32) + add_RunCMake_test(Win32GenEx) +endif() diff --git a/Tests/RunCMake/interface_library/target_commands-result.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/target_commands-result.txt +++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-result.txt diff --git a/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-stderr.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-stderr.txt new file mode 100644 index 0000000..a3b79b6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists\.txt:[0-9]+ \(project\): + Generator + + [^ +]* + + does not support platform specification, but platform + + a + + was specified\.$ diff --git a/Tests/RunCMake/CMakePresets/ArchToolsetStrategyIgnore.cmake b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyIgnore.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyIgnore.cmake diff --git a/Tests/RunCMake/interface_library/invalid_signature-result.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/invalid_signature-result.txt +++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-result.txt diff --git a/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-stderr.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-stderr.txt new file mode 100644 index 0000000..a3b79b6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists\.txt:[0-9]+ \(project\): + Generator + + [^ +]* + + does not support platform specification, but platform + + a + + was specified\.$ diff --git a/Tests/RunCMake/CMakePresets/CMakeLists.txt.in b/Tests/RunCMake/CMakePresets/CMakeLists.txt.in new file mode 100644 index 0000000..67c2d48 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +set(RunCMake_SOURCE_DIR [==[@RunCMake_SOURCE_DIR@]==]) +include("${RunCMake_SOURCE_DIR}/${RunCMake_TEST}.cmake") diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in new file mode 100644 index 0000000..a8f89ff --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -0,0 +1,489 @@ +/* + * Block comment + */ +{ + // Inline comment + "version": 1, + "cmakeMinimumRequired": { + "major": 3, + "minor": 18, + "patch": 0 + }, + "vendor": { + "example.com/ExampleIDE/1.0": true + }, + "configurePresets": [ + { + "name": "Good", + "displayName": "Good Preset", + "description": "This preset is meant to test most of the fields when set correctly.", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cmakeExecutable": "/path/does/not/exist/cmake", + "vendor": { + "example.com/ExampleIDE/1.0": { + "transmogrify": true + } + }, + "cacheVariables": { + "TEST_SOURCE_DIR": { + "type": "PATH", + "value": "${sourceDir}" + }, + "TEST_SOURCE_PARENT_DIR": { + "type": "PATH", + "value": "${sourceParentDir}" + }, + "TEST_SOURCE_LIST": { + "type": "FILEPATH", + "value": "${sourceDir}/CMakeLists.txt" + }, + "TEST_TRUE": { + "type": "BOOL", + "value": "TRUE" + }, + "TEST_OFF": { + "type": "BOOL", + "value": "OFF" + }, + "TEST_BOOL_TRUE": true, + "TEST_BOOL_FALSE": false, + "TEST_TYPED_BOOL_TRUE": { + "type": "STRING", + "value": true + }, + "TEST_TYPED_BOOL_FALSE": { + "type": "STRING", + "value": false + }, + "TEST_UNTYPED_BOOL_TRUE": { + "value": true + }, + "TEST_UNTYPED_BOOL_FALSE": { + "value": false + }, + "TEST_PRESET_NAME": { + "type": "STRING", + "value": "x${presetName}x" + }, + "TEST_GENERATOR": { + "value": "x${generator}x" + }, + "TEST_DOLLAR": { + "value": "${dollar}" + }, + "TEST_SOURCE_DIR_NAME": "${sourceDirName}", + "TEST_ENV_REF": "$env{TEST_ENV_REF}", + "TEST_ENV": "$env{TEST_ENV}", + "TEST_D_ENV_REF": "$env{TEST_D_ENV_REF}", + "TEST_ENV_OVERRIDE": "$env{TEST_ENV_OVERRIDE}", + "TEST_PENV": "$env{TEST_PENV}", + "TEST_ENV_REF_PENV": "$env{TEST_ENV_REF_PENV}", + "TEST_ENV_REF_P": "$penv{TEST_ENV_REF}", + "TEST_ENV_P": "$penv{TEST_ENV}", + "TEST_D_ENV_REF_P": "$penv{TEST_D_ENV_REF}", + "TEST_ENV_OVERRIDE_P": "$penv{TEST_ENV_OVERRIDE}", + "TEST_PENV_P": "$penv{TEST_PENV}", + "TEST_ENV_REF_PENV_P": "$penv{TEST_ENV_REF_PENV}", + "TEST_MULTIPLE_MACROS": "${presetName} ${generator}", + "TEST_EXPANSION": "\\${presetName} ${dollar}{dollar} $unknown{namespace} $en{NOT_ENV} $enve{NOT_ENV} $ \\$ $a", + "TEST_TRAILING_DOLLAR": "a $", + "TEST_TRAILING_BACKSLASH": "a \\", + "TEST_TRAILING_UNKNOWN_NAMESPACE": "$unknown{namespace", + "TEST_OVERRIDE_1": { + "type": "STRING", + "value": "Default value" + }, + "TEST_OVERRIDE_2": "Default value", + "TEST_OVERRIDE_3": { + "type": "STRING", + "value": "Default value" + }, + "TEST_OVERRIDE_4": { + "type": "STRING", + "value": "Default value" + }, + "TEST_UNDEF": "undef" + }, + "environment": { + "TEST_ENV_REF": "$env{TEST_ENV}", + "TEST_ENV": "Environment variable", + "TEST_D_ENV_REF": "x$env{TEST_ENV_REF}x", + "TEST_ENV_OVERRIDE": "Overridden environment variable", + "TEST_ENV_REF_PENV": "prefix+$penv{TEST_ENV_REF_PENV}", + "TEST_PENV": null + } + }, + { + "name": "GoodNoArgs", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "GoodBinaryUp", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/../GoodBinaryUp-build" + }, + { + "name": "GoodBinaryRelative", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "build" + }, + { + "name": "Good Spaces", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "GoodWindowsBackslash", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}\\build" + }, + { + "name": "GoodBinaryCmdLine", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "GoodGeneratorCmdLine", + "generator": "Invalid Generator", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "InvalidGeneratorCmdLine", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "GoodNoS", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "GoodInheritanceParentBase", + "hidden": true, + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "TEST_VARIABLE": { + "type": "STRING", + "value": "Some string" + } + }, + "environment": { + "TEST_ENV": "Some environment variable" + } + }, + { + "name": "GoodInheritanceParent", + "inherits": "GoodInheritanceParentBase" + }, + { + "name": "GoodInheritanceChildBase", + "hidden": true + }, + { + "name": "GoodInheritanceChild", + "inherits": "GoodInheritanceChildBase", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "TEST_VARIABLE": { + "type": "STRING", + "value": "Some string" + } + }, + "environment": { + "TEST_ENV": "Some environment variable" + } + }, + { + "name": "GoodInheritanceOverrideBase", + "hidden": true, + "generator": "Invalid Generator", + "binaryDir": "${sourceDir}/../GoodInheritanceBase-build", + "cacheVariables": { + "PARENT_VARIABLE": { + "type": "STRING", + "value": "Parent variable" + }, + "OVERRIDDEN_VARIABLE": { + "type": "BOOL", + "value": "ON" + }, + "DELETED_VARIABLE": "This variable will be deleted" + }, + "environment": { + "PARENT_ENV": "Parent environment variable", + "OVERRIDDEN_ENV": "This environment variable will be overridden", + "DELETED_ENV": "This environment variable will be deleted" + } + }, + { + "name": "GoodInheritanceOverride", + "inherits": "GoodInheritanceOverrideBase", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "OVERRIDDEN_VARIABLE": { + "type": "STRING", + "value": "Overridden variable" + }, + "CHILD_VARIABLE": { + "type": "STRING", + "value": "Child variable" + }, + "DELETED_VARIABLE": null + }, + "environment": { + "OVERRIDDEN_ENV": "Overridden environment variable", + "CHILD_ENV": "Child environment variable", + "DELETED_ENV": null + } + }, + { + "name": "GoodInheritanceOverrideDummy", + "inherits": "GoodInheritanceOverride" + }, + { + "name": "GoodInheritanceMulti1", + "hidden": true, + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "FIRST_VARIABLE": { + "type": "STRING", + "value": "First variable" + }, + "OVERRIDDEN_VARIABLE": { + "type": "STRING", + "value": "Overridden variable" + } + }, + "environment": { + "FIRST_ENV": "First environment variable", + "OVERRIDDEN_ENV": "Overridden environment variable" + } + }, + { + "name": "GoodInheritanceMulti2", + "hidden": true, + "generator": "Invalid Generator", + "binaryDir": "${sourceDir}/../GoodInheritanceMulti2-build", + "cacheVariables": { + "SECOND_VARIABLE": { + "type": "STRING", + "value": "Second variable" + }, + "OVERRIDDEN_VARIABLE": { + "type": "BOOL", + "value": "ON" + } + }, + "environment": { + "SECOND_ENV": "Second environment variable", + "OVERRIDDEN_ENV": "This will be overridden" + } + }, + { + "name": "GoodInheritanceMulti", + "inherits": [ + "GoodInheritanceMulti1", + "GoodInheritanceMulti2" + ] + }, + { + "name": "GoodInheritanceMultiSecond1", + "hidden": true + }, + { + "name": "GoodInheritanceMultiSecond2", + "hidden": true, + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "GoodInheritanceMultiSecond", + "inherits": [ + "GoodInheritanceMultiSecond1", + "GoodInheritanceMultiSecond2" + ] + }, + { + "name": "GoodInheritanceMacroBase", + "hidden": true, + "cacheVariables": { + "PRESET_NAME": "${presetName}" + } + }, + { + "name": "GoodInheritanceMacro", + "inherits": "GoodInheritanceMacroBase", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "VendorMacro", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "$vendor{unknown.unknownMacro}" + }, + { + "name": "InvalidGenerator", + "generator": "Invalid Generator", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "UseHiddenPreset", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "hidden": true + }, + { + "name": "VisualStudioGeneratorArch", + "generator": "@RunCMake_GENERATOR@ Win64", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "VisualStudioWin32", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": "Win32" + }, + { + "name": "VisualStudioWin64", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": "x64" + }, + { + "name": "VisualStudioWin32Override", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": "Win32" + }, + { + "name": "VisualStudioToolset", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "toolset": "Test Toolset" + }, + { + "name": "VisualStudioToolsetOverride", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "toolset": "Invalid Toolset" + }, + { + "name": "VisualStudioInheritanceParentBase", + "hidden": true, + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": "Test Platform", + "toolset": "Test Toolset" + }, + { + "name": "VisualStudioInheritanceParent", + "inherits": "VisualStudioInheritanceParentBase" + }, + { + "name": "VisualStudioInheritanceChildBase", + "hidden": true + }, + { + "name": "VisualStudioInheritanceChild", + "inherits": "VisualStudioInheritanceChildBase", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": "Test Platform", + "toolset": "Test Toolset" + }, + { + "name": "VisualStudioInheritanceOverrideBase", + "hidden": true, + "architecture": "Invalid Platform", + "toolset": "Invalid Toolset" + }, + { + "name": "VisualStudioInheritanceOverride", + "inherits": "VisualStudioInheritanceOverrideBase", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": "Test Platform", + "toolset": "Test Toolset" + }, + { + "name": "VisualStudioInheritanceMulti1", + "hidden": true, + "architecture": "Test Platform", + "toolset": "Test Toolset" + }, + { + "name": "VisualStudioInheritanceMulti2", + "hidden": true, + "architecture": "Invalid Platform", + "toolset": "Invalid Toolset" + }, + { + "name": "VisualStudioInheritanceMulti", + "inherits": [ + "VisualStudioInheritanceMulti1", + "VisualStudioInheritanceMulti2" + ], + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "VisualStudioInheritanceMultiSecond1", + "hidden": true + }, + { + "name": "VisualStudioInheritanceMultiSecond2", + "hidden": true, + "architecture": "Test Platform", + "toolset": "Test Toolset" + }, + { + "name": "VisualStudioInheritanceMultiSecond", + "inherits": [ + "VisualStudioInheritanceMultiSecond1", + "VisualStudioInheritanceMultiSecond2" + ], + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "ArchToolsetStrategyNone", + "generator": "@RunCMake_GENERATOR@", + "architecture": "a", + "toolset": "a", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "ArchToolsetStrategyBase", + "generator": "@RunCMake_GENERATOR@", + "architecture": { + "value": "a", + "strategy": "external" + }, + "toolset": { + "value": "a", + "strategy": "external" + }, + "binaryDir": "${sourceDir}/build" + }, + { + "name": "ArchToolsetStrategyDefault", + "inherits": "ArchToolsetStrategyBase", + "architecture": { + "strategy": "set" + }, + "toolset": { + "strategy": "set" + } + }, + { + "name": "ArchToolsetStrategyIgnore", + "inherits": "ArchToolsetStrategyBase" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/CacheOverride.cmake b/Tests/RunCMake/CMakePresets/CacheOverride.cmake new file mode 100644 index 0000000..d0ebe17 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CacheOverride.cmake @@ -0,0 +1,2 @@ +set(TEST_OVERRIDE_3 "Overridden value" CACHE STRING "") +set(TEST_OVERRIDE_4 "Overridden value" CACHE INTERNAL "") diff --git a/Tests/RunCMake/interface_library/invalid_name-result.txt b/Tests/RunCMake/CMakePresets/CyclicInheritance0-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/invalid_name-result.txt +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance0-result.txt diff --git a/Tests/RunCMake/CMakePresets/CyclicInheritance0-stderr.txt b/Tests/RunCMake/CMakePresets/CyclicInheritance0-stderr.txt new file mode 100644 index 0000000..895afcb --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance0-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/CyclicInheritance0: Cyclic preset inheritance$ diff --git a/Tests/RunCMake/CMakePresets/CyclicInheritance0.json.in b/Tests/RunCMake/CMakePresets/CyclicInheritance0.json.in new file mode 100644 index 0000000..3468936 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance0.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "CyclicInheritance0", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "CyclicInheritance0" + ] + } + ] +} diff --git a/Tests/RunCMake/interface_library/global-interface-result.txt b/Tests/RunCMake/CMakePresets/CyclicInheritance1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/global-interface-result.txt +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance1-result.txt diff --git a/Tests/RunCMake/CMakePresets/CyclicInheritance1-stderr.txt b/Tests/RunCMake/CMakePresets/CyclicInheritance1-stderr.txt new file mode 100644 index 0000000..1e59e92 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance1-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/CyclicInheritance1: Cyclic preset inheritance$ diff --git a/Tests/RunCMake/CMakePresets/CyclicInheritance1.json.in b/Tests/RunCMake/CMakePresets/CyclicInheritance1.json.in new file mode 100644 index 0000000..fabd4af --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance1.json.in @@ -0,0 +1,21 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "CyclicInheritance0", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "CyclicInheritance1" + ] + }, + { + "name": "CyclicInheritance1", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "CyclicInheritance0" + ] + } + ] +} diff --git a/Tests/RunCMake/interface_library/add_custom_command-TARGET-result.txt b/Tests/RunCMake/CMakePresets/CyclicInheritance2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/add_custom_command-TARGET-result.txt +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance2-result.txt diff --git a/Tests/RunCMake/CMakePresets/CyclicInheritance2-stderr.txt b/Tests/RunCMake/CMakePresets/CyclicInheritance2-stderr.txt new file mode 100644 index 0000000..56e630b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance2-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/CyclicInheritance2: Cyclic preset inheritance$ diff --git a/Tests/RunCMake/CMakePresets/CyclicInheritance2.json.in b/Tests/RunCMake/CMakePresets/CyclicInheritance2.json.in new file mode 100644 index 0000000..0e1d7d4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CyclicInheritance2.json.in @@ -0,0 +1,29 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "CyclicInheritance0", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "CyclicInheritance1" + ] + }, + { + "name": "CyclicInheritance1", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "CyclicInheritance2" + ] + }, + { + "name": "CyclicInheritance2", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "CyclicInheritance0" + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/Debug-stderr.txt b/Tests/RunCMake/CMakePresets/Debug-stderr.txt new file mode 100644 index 0000000..7fdb8b3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Debug-stderr.txt @@ -0,0 +1 @@ + find_package considered the following locations for the Config module: diff --git a/Tests/RunCMake/CMakePresets/Debug-stdout.txt b/Tests/RunCMake/CMakePresets/Debug-stdout.txt new file mode 100644 index 0000000..7d1f388 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Debug-stdout.txt @@ -0,0 +1,4 @@ +-- Generating [^ +]*/Tests/RunCMake/CMakePresets/Debug/build + Called from: \[1\][^ +]*/Tests/RunCMake/CMakePresets/Debug/CMakeLists\.txt diff --git a/Tests/RunCMake/CMakePresets/Debug.cmake b/Tests/RunCMake/CMakePresets/Debug.cmake new file mode 100644 index 0000000..19c7db2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Debug.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/DebugBase.cmake) +if(NOT EXISTS "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt") + message(SEND_ERROR "Debugging try_compile() did not work") +endif() diff --git a/Tests/RunCMake/CMakePresets/Debug.json.in b/Tests/RunCMake/CMakePresets/Debug.json.in new file mode 100644 index 0000000..500700e --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Debug.json.in @@ -0,0 +1,19 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "NoDebug", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "Debug", + "inherits": "NoDebug", + "debug": { + "output": true, + "find": true, + "tryCompile": true + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/DebugBase.cmake b/Tests/RunCMake/CMakePresets/DebugBase.cmake new file mode 100644 index 0000000..870f31c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DebugBase.cmake @@ -0,0 +1,3 @@ +enable_language(C) +try_compile(_result ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/main.c) +find_package(ThisPackageHopefullyDoesNotExist CONFIG) diff --git a/Tests/RunCMake/CMakePresets/DisableWarningFlags.cmake b/Tests/RunCMake/CMakePresets/DisableWarningFlags.cmake new file mode 100644 index 0000000..5de7687 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DisableWarningFlags.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/WarningsBase.cmake) diff --git a/Tests/RunCMake/CMakePresets/DocumentationExample.cmake b/Tests/RunCMake/CMakePresets/DocumentationExample.cmake new file mode 100644 index 0000000..d459e9e --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DocumentationExample.cmake @@ -0,0 +1,5 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(FIRST_CACHE_VARIABLE "BOOL" "OFF") +test_variable(SECOND_CACHE_VARIABLE "UNINITIALIZED" "ON") +test_environment_variable(MY_ENVIRONMENT_VARIABLE "Test") diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt b/Tests/RunCMake/CMakePresets/DuplicatePresets-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt +++ b/Tests/RunCMake/CMakePresets/DuplicatePresets-result.txt diff --git a/Tests/RunCMake/CMakePresets/DuplicatePresets-stderr.txt b/Tests/RunCMake/CMakePresets/DuplicatePresets-stderr.txt new file mode 100644 index 0000000..c9361ae --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DuplicatePresets-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/DuplicatePresets: Duplicate presets$ diff --git a/Tests/RunCMake/CMakePresets/DuplicatePresets.json.in b/Tests/RunCMake/CMakePresets/DuplicatePresets.json.in new file mode 100644 index 0000000..cf388e7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DuplicatePresets.json.in @@ -0,0 +1,15 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "DuplicatePresets", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "DuplicatePresets", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt b/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt +++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt new file mode 100644 index 0000000..749d306 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyCacheKey: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in b/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in new file mode 100644 index 0000000..ea9c9e4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EmptyCacheKey", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "": "value" + } + } + ] +} diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt +++ b/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt new file mode 100644 index 0000000..723ac21 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyEnv: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv.json.in b/Tests/RunCMake/CMakePresets/EmptyEnv.json.in new file mode 100644 index 0000000..ef0d575 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnv.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EmptyEnv", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "MY_VAR": "$env{}" + } + } + ] +} diff --git a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-result.txt b/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-result.txt +++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt new file mode 100644 index 0000000..365f537 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyEnvKey: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in b/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in new file mode 100644 index 0000000..d87c159 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EmptyEnvKey", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "environment": { + "": "value" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt new file mode 100644 index 0000000..880cee6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyPenv: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv.json.in b/Tests/RunCMake/CMakePresets/EmptyPenv.json.in new file mode 100644 index 0000000..9081fe5 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenv.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EmptyPenv", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "MY_VAR": "$penv{}" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName-result.txt b/Tests/RunCMake/CMakePresets/EmptyPresetName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPresetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt new file mode 100644 index 0000000..6970674 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName.json.in b/Tests/RunCMake/CMakePresets/EmptyPresetName.json.in new file mode 100644 index 0000000..fd4bedd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPresetName.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/EnvCycle-result.txt b/Tests/RunCMake/CMakePresets/EnvCycle-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EnvCycle-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt b/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt new file mode 100644 index 0000000..1d22b87 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EnvCycle: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/EnvCycle.json.in b/Tests/RunCMake/CMakePresets/EnvCycle.json.in new file mode 100644 index 0000000..25a1349 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EnvCycle.json.in @@ -0,0 +1,14 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EnvCycle", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "environment": { + "ENV_1": "$env{ENV_2}", + "ENV_2": "$env{ENV_1}" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ErrorDeprecated-result.txt b/Tests/RunCMake/CMakePresets/ErrorDeprecated-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorDeprecated-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt new file mode 100644 index 0000000..964a504 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt @@ -0,0 +1,7 @@ +^CMake Deprecation Error at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): + Deprecation warning +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/ErrorDeprecated\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMakePresets/ErrorDeprecated.cmake b/Tests/RunCMake/CMakePresets/ErrorDeprecated.cmake new file mode 100644 index 0000000..5de7687 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorDeprecated.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/WarningsBase.cmake) diff --git a/Tests/RunCMake/CMakePresets/ErrorDev-result.txt b/Tests/RunCMake/CMakePresets/ErrorDev-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorDev-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt new file mode 100644 index 0000000..f76478c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error \(dev\) at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): + Dev warning +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/ErrorDev\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This error is for project developers\. Use -Wno-error=dev to suppress it\.$ diff --git a/Tests/RunCMake/CMakePresets/ErrorDev.cmake b/Tests/RunCMake/CMakePresets/ErrorDev.cmake new file mode 100644 index 0000000..5de7687 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorDev.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/WarningsBase.cmake) diff --git a/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated-result.txt b/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated-stderr.txt new file mode 100644 index 0000000..3221345 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated.json.in b/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated.json.in new file mode 100644 index 0000000..664b3ee --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorNoWarningDeprecated.json.in @@ -0,0 +1,16 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "ErrorNoWarningDeprecated", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "warnings": { + "deprecated": false + }, + "errors": { + "deprecated": true + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ErrorNoWarningDev-result.txt b/Tests/RunCMake/CMakePresets/ErrorNoWarningDev-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorNoWarningDev-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ErrorNoWarningDev-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorNoWarningDev-stderr.txt new file mode 100644 index 0000000..d2ddb90 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorNoWarningDev-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/ErrorNoWarningDev: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/ErrorNoWarningDev.json.in b/Tests/RunCMake/CMakePresets/ErrorNoWarningDev.json.in new file mode 100644 index 0000000..d681b2a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ErrorNoWarningDev.json.in @@ -0,0 +1,16 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "ErrorNoWarningDev", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "warnings": { + "dev": false + }, + "errors": { + "dev": true + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ExtraPresetField-result.txt b/Tests/RunCMake/CMakePresets/ExtraPresetField-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraPresetField-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ExtraPresetField-stderr.txt b/Tests/RunCMake/CMakePresets/ExtraPresetField-stderr.txt new file mode 100644 index 0000000..559e3c2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraPresetField-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/ExtraPresetField: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/ExtraPresetField.json.in b/Tests/RunCMake/CMakePresets/ExtraPresetField.json.in new file mode 100644 index 0000000..b529758 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraPresetField.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "ExtraPresetField", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "invalid": true + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ExtraRootField-result.txt b/Tests/RunCMake/CMakePresets/ExtraRootField-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraRootField-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ExtraRootField-stderr.txt b/Tests/RunCMake/CMakePresets/ExtraRootField-stderr.txt new file mode 100644 index 0000000..bb281be --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraRootField-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/ExtraRootField: Invalid root object$ diff --git a/Tests/RunCMake/CMakePresets/ExtraRootField.json.in b/Tests/RunCMake/CMakePresets/ExtraRootField.json.in new file mode 100644 index 0000000..bcfa68b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraRootField.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "ExtraRootField", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ], + "invalid": true +} diff --git a/Tests/RunCMake/CMakePresets/ExtraVariableField-result.txt b/Tests/RunCMake/CMakePresets/ExtraVariableField-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraVariableField-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ExtraVariableField-stderr.txt b/Tests/RunCMake/CMakePresets/ExtraVariableField-stderr.txt new file mode 100644 index 0000000..9b346e7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraVariableField-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/ExtraVariableField: Invalid CMake variable definition$ diff --git a/Tests/RunCMake/CMakePresets/ExtraVariableField.json.in b/Tests/RunCMake/CMakePresets/ExtraVariableField.json.in new file mode 100644 index 0000000..a810560 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ExtraVariableField.json.in @@ -0,0 +1,16 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "ExtraVariableField", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "EXTRA": { + "value": "", + "invalid": true + } + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/Good-stdout.txt b/Tests/RunCMake/CMakePresets/Good-stdout.txt new file mode 100644 index 0000000..75003c7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Good-stdout.txt @@ -0,0 +1,53 @@ +Preset CMake variables: + + TEST_BOOL_FALSE:BOOL="FALSE" + TEST_BOOL_TRUE:BOOL="TRUE" + TEST_DOLLAR="\$" + TEST_D_ENV_REF="xEnvironment variablex" + TEST_D_ENV_REF_P="" + TEST_ENV="Environment variable" + TEST_ENV_OVERRIDE="Overridden environment variable" + TEST_ENV_OVERRIDE_P="This environment variable will be overridden" + TEST_ENV_P="" + TEST_ENV_REF="Environment variable" + TEST_ENV_REF_P="" + TEST_ENV_REF_PENV="prefix\+suffix" + TEST_ENV_REF_PENV_P="suffix" + TEST_EXPANSION="\\Good \${dollar} \$unknown{namespace} \$en{NOT_ENV} \$enve{NOT_ENV} \$ \\\$ \$a" + TEST_GENERATOR="x[^ +]*x" + TEST_MULTIPLE_MACROS="Good [^ +]*" + TEST_OFF:BOOL="OFF" + TEST_OVERRIDE_3:STRING="Default value" + TEST_OVERRIDE_4:STRING="Default value" + TEST_PENV="Process environment variable" + TEST_PENV_P="Process environment variable" + TEST_PRESET_NAME:STRING="xGoodx" + TEST_SOURCE_DIR:PATH="[^ +]*/Tests/RunCMake/CMakePresets/Good" + TEST_SOURCE_DIR_NAME="Good" + TEST_SOURCE_LIST:FILEPATH="[^ +]*/Tests/RunCMake/CMakePresets/Good/CMakeLists\.txt" + TEST_SOURCE_PARENT_DIR:PATH="[^ +]*/Tests/RunCMake/CMakePresets" + TEST_TRAILING_BACKSLASH="a \\" + TEST_TRAILING_DOLLAR="a \$" + TEST_TRAILING_UNKNOWN_NAMESPACE="\$unknown{namespace" + TEST_TRUE:BOOL="TRUE" + TEST_TYPED_BOOL_FALSE:STRING="FALSE" + TEST_TYPED_BOOL_TRUE:STRING="TRUE" + TEST_UNTYPED_BOOL_FALSE="FALSE" + TEST_UNTYPED_BOOL_TRUE="TRUE" + +Preset environment variables: + + TEST_D_ENV_REF="xEnvironment variablex" + TEST_ENV="Environment variable" + TEST_ENV_OVERRIDE="Overridden environment variable" + TEST_ENV_REF="Environment variable" + TEST_ENV_REF_PENV="prefix\+suffix" + +(-- Selecting Windows SDK version [^ +]* +)?-- Configuring done diff --git a/Tests/RunCMake/CMakePresets/Good.cmake b/Tests/RunCMake/CMakePresets/Good.cmake new file mode 100644 index 0000000..73a618d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Good.cmake @@ -0,0 +1,52 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +get_filename_component(_parent_dir "${CMAKE_SOURCE_DIR}" DIRECTORY) +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") +test_variable(CMAKE_GENERATOR "" "${RunCMake_GENERATOR}") +test_variable(TEST_SOURCE_DIR "PATH" "${CMAKE_SOURCE_DIR}") +test_variable(TEST_SOURCE_PARENT_DIR "PATH" "${_parent_dir}") +test_variable(TEST_SOURCE_LIST "FILEPATH" "${CMAKE_SOURCE_DIR}/CMakeLists.txt") +test_variable(TEST_TRUE "BOOL" "TRUE") +test_variable(TEST_OFF "BOOL" "OFF") +test_variable(TEST_BOOL_TRUE "BOOL" "TRUE") +test_variable(TEST_BOOL_FALSE "BOOL" "FALSE") +test_variable(TEST_TYPED_BOOL_TRUE "STRING" "TRUE") +test_variable(TEST_TYPED_BOOL_FALSE "STRING" "FALSE") +test_variable(TEST_UNTYPED_BOOL_TRUE "UNINITIALIZED" "TRUE") +test_variable(TEST_UNTYPED_BOOL_FALSE "UNINITIALIZED" "FALSE") +test_variable(TEST_PRESET_NAME "STRING" "xGoodx") +test_variable(TEST_GENERATOR "UNINITIALIZED" "x${CMAKE_GENERATOR}x") +test_variable(TEST_DOLLAR "UNINITIALIZED" "$") +test_variable(TEST_SOURCE_DIR_NAME "UNINITIALIZED" "Good") +test_variable(TEST_ENV_REF "UNINITIALIZED" "Environment variable") +test_variable(TEST_ENV "UNINITIALIZED" "Environment variable") +test_variable(TEST_D_ENV_REF "UNINITIALIZED" "xEnvironment variablex") +test_variable(TEST_ENV_OVERRIDE "UNINITIALIZED" "Overridden environment variable") +test_variable(TEST_PENV "UNINITIALIZED" "Process environment variable") +test_variable(TEST_ENV_REF_PENV "UNINITIALIZED" "prefix+suffix") +test_variable(TEST_ENV_REF_P "UNINITIALIZED" "") +test_variable(TEST_ENV_P "UNINITIALIZED" "") +test_variable(TEST_D_ENV_REF_P "UNINITIALIZED" "") +test_variable(TEST_ENV_OVERRIDE_P "UNINITIALIZED" "This environment variable will be overridden") +test_variable(TEST_PENV_P "UNINITIALIZED" "Process environment variable") +test_variable(TEST_ENV_REF_PENV_P "UNINITIALIZED" "suffix") +test_variable(TEST_MULTIPLE_MACROS "UNINITIALIZED" "Good ${CMAKE_GENERATOR}") +test_variable(TEST_EXPANSION "UNINITIALIZED" "\\Good \${dollar} \$unknown{namespace} \$en{NOT_ENV} \$enve{NOT_ENV} $ \\$ $a") +test_variable(TEST_TRAILING_DOLLAR "UNINITIALIZED" "a $") +test_variable(TEST_TRAILING_BACKSLASH "UNINITIALIZED" "a \\") +test_variable(TEST_TRAILING_UNKNOWN_NAMESPACE "UNINITIALIZED" "\$unknown{namespace") +test_variable(TEST_OVERRIDE_1 "UNINITIALIZED" "Overridden value") +test_variable(TEST_OVERRIDE_2 "STRING" "Overridden value") +test_variable(TEST_OVERRIDE_3 "STRING" "Default value") +test_variable(TEST_OVERRIDE_4 "INTERNAL" "Overridden value") + +if(DEFINED TEST_UNDEF OR DEFINED CACHE{TEST_UNDEF}) + message(SEND_ERROR "TEST_UNDEF should not be defined") +endif() + +test_environment_variable(TEST_ENV_REF "Environment variable") +test_environment_variable(TEST_ENV "Environment variable") +test_environment_variable(TEST_D_ENV_REF "xEnvironment variablex") +test_environment_variable(TEST_ENV_OVERRIDE "Overridden environment variable") +test_environment_variable(TEST_PENV "Process environment variable") +test_environment_variable(TEST_ENV_REF_PENV "prefix+suffix") diff --git a/Tests/RunCMake/CMakePresets/GoodBOM.cmake b/Tests/RunCMake/CMakePresets/GoodBOM.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodBOM.cmake diff --git a/Tests/RunCMake/CMakePresets/GoodBOM.json.in b/Tests/RunCMake/CMakePresets/GoodBOM.json.in new file mode 100644 index 0000000..2152511 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodBOM.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "GoodBOM", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodBinaryCmdLine.cmake b/Tests/RunCMake/CMakePresets/GoodBinaryCmdLine.cmake new file mode 100644 index 0000000..9f928fe --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodBinaryCmdLine.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +get_filename_component(_parent "${CMAKE_SOURCE_DIR}" DIRECTORY) +test_variable(CMAKE_BINARY_DIR "" "${_parent}/GoodBinaryCmdLine-build") diff --git a/Tests/RunCMake/CMakePresets/GoodBinaryRelative.cmake b/Tests/RunCMake/CMakePresets/GoodBinaryRelative.cmake new file mode 100644 index 0000000..49e7a25 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodBinaryRelative.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") diff --git a/Tests/RunCMake/CMakePresets/GoodBinaryUp.cmake b/Tests/RunCMake/CMakePresets/GoodBinaryUp.cmake new file mode 100644 index 0000000..f7fb224 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodBinaryUp.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +get_filename_component(_parent "${CMAKE_SOURCE_DIR}" DIRECTORY) +test_variable(CMAKE_BINARY_DIR "" "${_parent}/GoodBinaryUp-build") diff --git a/Tests/RunCMake/CMakePresets/GoodGeneratorCmdLine.cmake b/Tests/RunCMake/CMakePresets/GoodGeneratorCmdLine.cmake new file mode 100644 index 0000000..4319e72 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodGeneratorCmdLine.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_GENERATOR "" "${RunCMake_GENERATOR}") diff --git a/Tests/RunCMake/CMakePresets/GoodInheritanceChild.cmake b/Tests/RunCMake/CMakePresets/GoodInheritanceChild.cmake new file mode 100644 index 0000000..cfc93be --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInheritanceChild.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") +test_variable(TEST_VARIABLE "STRING" "Some string") + +test_environment_variable(TEST_ENV "Some environment variable") diff --git a/Tests/RunCMake/CMakePresets/GoodInheritanceMacro.cmake b/Tests/RunCMake/CMakePresets/GoodInheritanceMacro.cmake new file mode 100644 index 0000000..96fede0 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInheritanceMacro.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(PRESET_NAME "UNINITIALIZED" "GoodInheritanceMacro") diff --git a/Tests/RunCMake/CMakePresets/GoodInheritanceMulti.cmake b/Tests/RunCMake/CMakePresets/GoodInheritanceMulti.cmake new file mode 100644 index 0000000..6430f4d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInheritanceMulti.cmake @@ -0,0 +1,10 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") +test_variable(FIRST_VARIABLE "STRING" "First variable") +test_variable(SECOND_VARIABLE "STRING" "Second variable") +test_variable(OVERRIDDEN_VARIABLE "STRING" "Overridden variable") + +test_environment_variable(FIRST_ENV "First environment variable") +test_environment_variable(SECOND_ENV "Second environment variable") +test_environment_variable(OVERRIDDEN_ENV "Overridden environment variable") diff --git a/Tests/RunCMake/CMakePresets/GoodInheritanceMultiSecond.cmake b/Tests/RunCMake/CMakePresets/GoodInheritanceMultiSecond.cmake new file mode 100644 index 0000000..49e7a25 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInheritanceMultiSecond.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") diff --git a/Tests/RunCMake/CMakePresets/GoodInheritanceOverride.cmake b/Tests/RunCMake/CMakePresets/GoodInheritanceOverride.cmake new file mode 100644 index 0000000..5231803 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInheritanceOverride.cmake @@ -0,0 +1,18 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") +test_variable(PARENT_VARIABLE "STRING" "Parent variable") +test_variable(OVERRIDDEN_VARIABLE "STRING" "Overridden variable") +test_variable(CHILD_VARIABLE "STRING" "Child variable") + +if(DEFINED DELETED_VARIABLE OR DEFINED CACHE{DELETED_VARIABLE}) + message(SEND_ERROR "DELETED_VARIABLE should not be defined") +endif() + +test_environment_variable(PARENT_ENV "Parent environment variable") +test_environment_variable(CHILD_ENV "Child environment variable") +test_environment_variable(OVERRIDDEN_ENV "Overridden environment variable") + +if(DEFINED ENV{DELETED_ENV}) + message(SEND_ERROR "DELETED_ENV should not be defined") +endif() diff --git a/Tests/RunCMake/CMakePresets/GoodInheritanceParent.cmake b/Tests/RunCMake/CMakePresets/GoodInheritanceParent.cmake new file mode 100644 index 0000000..cfc93be --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInheritanceParent.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") +test_variable(TEST_VARIABLE "STRING" "Some string") + +test_environment_variable(TEST_ENV "Some environment variable") diff --git a/Tests/RunCMake/CMakePresets/GoodNoArgs.cmake b/Tests/RunCMake/CMakePresets/GoodNoArgs.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodNoArgs.cmake diff --git a/Tests/RunCMake/CMakePresets/GoodNoS.cmake b/Tests/RunCMake/CMakePresets/GoodNoS.cmake new file mode 100644 index 0000000..1d3b2ff --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodNoS.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +get_filename_component(_parent "${CMAKE_SOURCE_DIR}" DIRECTORY) +test_variable(CMAKE_BINARY_DIR "" "${_parent}/GoodNoS-build") diff --git a/Tests/RunCMake/CMakePresets/GoodSpaces.cmake b/Tests/RunCMake/CMakePresets/GoodSpaces.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodSpaces.cmake diff --git a/Tests/RunCMake/CMakePresets/GoodUserFromMain.cmake b/Tests/RunCMake/CMakePresets/GoodUserFromMain.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserFromMain.cmake diff --git a/Tests/RunCMake/CMakePresets/GoodUserFromMain.json.in b/Tests/RunCMake/CMakePresets/GoodUserFromMain.json.in new file mode 100644 index 0000000..348443e --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserFromMain.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "GoodUserFromMain", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodUserFromMainUser.json.in b/Tests/RunCMake/CMakePresets/GoodUserFromMainUser.json.in new file mode 100644 index 0000000..77b4ef6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserFromMainUser.json.in @@ -0,0 +1,4 @@ +{ + "version": 1, + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/GoodUserFromUser.cmake b/Tests/RunCMake/CMakePresets/GoodUserFromUser.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserFromUser.cmake diff --git a/Tests/RunCMake/CMakePresets/GoodUserFromUser.json.in b/Tests/RunCMake/CMakePresets/GoodUserFromUser.json.in new file mode 100644 index 0000000..77b4ef6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserFromUser.json.in @@ -0,0 +1,4 @@ +{ + "version": 1, + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/GoodUserFromUserUser.json.in b/Tests/RunCMake/CMakePresets/GoodUserFromUserUser.json.in new file mode 100644 index 0000000..83196be --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserFromUserUser.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "GoodUserFromUser", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodUserOnly.cmake b/Tests/RunCMake/CMakePresets/GoodUserOnly.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserOnly.cmake diff --git a/Tests/RunCMake/CMakePresets/GoodUserOnlyUser.json.in b/Tests/RunCMake/CMakePresets/GoodUserOnlyUser.json.in new file mode 100644 index 0000000..274f4c7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodUserOnlyUser.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "GoodUserOnly", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodWindowsBackslash.cmake b/Tests/RunCMake/CMakePresets/GoodWindowsBackslash.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodWindowsBackslash.cmake diff --git a/Tests/RunCMake/CMakePresets/HighVersion-result.txt b/Tests/RunCMake/CMakePresets/HighVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HighVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/HighVersion-stderr.txt b/Tests/RunCMake/CMakePresets/HighVersion-stderr.txt new file mode 100644 index 0000000..d8622f2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HighVersion-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/HighVersion: Unrecognized "version" field$ diff --git a/Tests/RunCMake/CMakePresets/HighVersion.json.in b/Tests/RunCMake/CMakePresets/HighVersion.json.in new file mode 100644 index 0000000..8107842 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HighVersion.json.in @@ -0,0 +1,4 @@ +{ + "version": 1000, + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-result.txt b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt new file mode 100644 index 0000000..4a4d4ce --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in new file mode 100644 index 0000000..9ec2cee --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidArchitectureStrategy", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": { + "strategy": {} + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidGenerator-result.txt b/Tests/RunCMake/CMakePresets/InvalidGenerator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidGenerator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidGenerator-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidGenerator-stderr.txt new file mode 100644 index 0000000..c7dd19b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidGenerator-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Could not create named generator Invalid Generator + +Generators diff --git a/Tests/RunCMake/CMakePresets/InvalidGeneratorCmdLine-result.txt b/Tests/RunCMake/CMakePresets/InvalidGeneratorCmdLine-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidGeneratorCmdLine-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidGeneratorCmdLine-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidGeneratorCmdLine-stderr.txt new file mode 100644 index 0000000..c7dd19b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidGeneratorCmdLine-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Could not create named generator Invalid Generator + +Generators diff --git a/Tests/RunCMake/CMakePresets/InvalidInheritance-result.txt b/Tests/RunCMake/CMakePresets/InvalidInheritance-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidInheritance-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidInheritance-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidInheritance-stderr.txt new file mode 100644 index 0000000..97f3876 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidInheritance-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidInheritance: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidInheritance.json.in b/Tests/RunCMake/CMakePresets/InvalidInheritance.json.in new file mode 100644 index 0000000..77bd9a3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidInheritance.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidInheritance", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "NoExist" + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir-result.txt b/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir-stderr.txt new file mode 100644 index 0000000..2fe8c66 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir.json.in b/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir.json.in new file mode 100644 index 0000000..2bb95d9 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetBinaryDir.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidPresetBinaryDir", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": [] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetGenerator-result.txt b/Tests/RunCMake/CMakePresets/InvalidPresetGenerator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetGenerator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetGenerator-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidPresetGenerator-stderr.txt new file mode 100644 index 0000000..9572875 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetGenerator-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidPresetGenerator: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetGenerator.json.in b/Tests/RunCMake/CMakePresets/InvalidPresetGenerator.json.in new file mode 100644 index 0000000..95e6e65 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetGenerator.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidPresetGenerator", + "generator": [], + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetName-result.txt b/Tests/RunCMake/CMakePresets/InvalidPresetName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidPresetName-stderr.txt new file mode 100644 index 0000000..8f6ff7c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetName-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidPresetName: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetName.json.in b/Tests/RunCMake/CMakePresets/InvalidPresetName.json.in new file mode 100644 index 0000000..08361da --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetName.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": [], + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetVendor-result.txt b/Tests/RunCMake/CMakePresets/InvalidPresetVendor-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetVendor-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetVendor-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidPresetVendor-stderr.txt new file mode 100644 index 0000000..89a424a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetVendor-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidPresetVendor: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidPresetVendor.json.in b/Tests/RunCMake/CMakePresets/InvalidPresetVendor.json.in new file mode 100644 index 0000000..2a5d9ba --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresetVendor.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidPresetVendor", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "vendor": true + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidPresets-result.txt b/Tests/RunCMake/CMakePresets/InvalidPresets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidPresets-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidPresets-stderr.txt new file mode 100644 index 0000000..2b0f560 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresets-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidPresets: Invalid "configurePresets" field$ diff --git a/Tests/RunCMake/CMakePresets/InvalidPresets.json.in b/Tests/RunCMake/CMakePresets/InvalidPresets.json.in new file mode 100644 index 0000000..facfd57 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidPresets.json.in @@ -0,0 +1,4 @@ +{ + "version": 1, + "configurePresets": {} +} diff --git a/Tests/RunCMake/CMakePresets/InvalidRoot-result.txt b/Tests/RunCMake/CMakePresets/InvalidRoot-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidRoot-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidRoot-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidRoot-stderr.txt new file mode 100644 index 0000000..e5c434d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidRoot-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidRoot: Invalid root object$ diff --git a/Tests/RunCMake/CMakePresets/InvalidRoot.json.in b/Tests/RunCMake/CMakePresets/InvalidRoot.json.in new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidRoot.json.in @@ -0,0 +1 @@ +[] diff --git a/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-result.txt b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt new file mode 100644 index 0000000..fab3766 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy.json.in b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy.json.in new file mode 100644 index 0000000..7d2ab1f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidToolsetStrategy", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "toolset": { + "strategy": {} + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidVariableValue-result.txt b/Tests/RunCMake/CMakePresets/InvalidVariableValue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVariableValue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidVariableValue-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidVariableValue-stderr.txt new file mode 100644 index 0000000..0ab07c3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVariableValue-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidVariableValue: Invalid CMake variable definition$ diff --git a/Tests/RunCMake/CMakePresets/InvalidVariableValue.json.in b/Tests/RunCMake/CMakePresets/InvalidVariableValue.json.in new file mode 100644 index 0000000..55c7644 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVariableValue.json.in @@ -0,0 +1,15 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidVariableValue", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "VAR": { + "value": [] + } + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidVariables-result.txt b/Tests/RunCMake/CMakePresets/InvalidVariables-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVariables-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidVariables-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidVariables-stderr.txt new file mode 100644 index 0000000..6d9102a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVariables-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidVariables: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/InvalidVariables.json.in b/Tests/RunCMake/CMakePresets/InvalidVariables.json.in new file mode 100644 index 0000000..30dcaf0 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVariables.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "InvalidVariables", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": [] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidVendor-result.txt b/Tests/RunCMake/CMakePresets/InvalidVendor-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVendor-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidVendor-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidVendor-stderr.txt new file mode 100644 index 0000000..af923f0 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVendor-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidVendor: Invalid root object$ diff --git a/Tests/RunCMake/CMakePresets/InvalidVendor.json.in b/Tests/RunCMake/CMakePresets/InvalidVendor.json.in new file mode 100644 index 0000000..2315b72 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVendor.json.in @@ -0,0 +1,5 @@ +{ + "version": 1, + "vendor": true, + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidVersion-result.txt b/Tests/RunCMake/CMakePresets/InvalidVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidVersion-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidVersion-stderr.txt new file mode 100644 index 0000000..7e0fcfd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVersion-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidVersion: Invalid "version" field$ diff --git a/Tests/RunCMake/CMakePresets/InvalidVersion.json.in b/Tests/RunCMake/CMakePresets/InvalidVersion.json.in new file mode 100644 index 0000000..e6e19bc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidVersion.json.in @@ -0,0 +1,4 @@ +{ + "version": "1.0", + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/JSONParseError-result.txt b/Tests/RunCMake/CMakePresets/JSONParseError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/JSONParseError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt new file mode 100644 index 0000000..a43bf77 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error$ diff --git a/Tests/RunCMake/CMakePresets/JSONParseError.json.in b/Tests/RunCMake/CMakePresets/JSONParseError.json.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/JSONParseError.json.in diff --git a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt new file mode 100644 index 0000000..1758f33 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt @@ -0,0 +1,6 @@ +^Not searching for unused variables given on the command line\. +Available presets: + + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresets.json.in b/Tests/RunCMake/CMakePresets/ListPresets.json.in new file mode 100644 index 0000000..2ef3797 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresets.json.in @@ -0,0 +1,36 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "zzzzzz", + "displayName": "Sleepy", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/zzzzzz" + }, + { + "name": "aaaaaaaa", + "displayName": "Screaming", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/aaaaaaaa" + }, + { + "name": "mmmmmm", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/mmmmmm" + }, + { + "name": "invalid-generator", + "generator": "Invalid Generator", + "binaryDir": "${sourceDir}/build/invalid" + }, + { + "name": "invalid-macro", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "$vendor{noexist}" + }, + { + "name": "ListPresetsHidden", + "hidden": true + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ListPresetsHidden-result.txt b/Tests/RunCMake/CMakePresets/ListPresetsHidden-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsHidden-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stderr.txt b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stderr.txt new file mode 100644 index 0000000..1403814 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Cannot use hidden preset in [^ +]*/Tests/RunCMake/CMakePresets/ListPresetsHidden: "ListPresetsHidden"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt new file mode 100644 index 0000000..1758f33 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt @@ -0,0 +1,6 @@ +^Not searching for unused variables given on the command line\. +Available presets: + + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-result.txt b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stderr.txt b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stderr.txt new file mode 100644 index 0000000..eea1b99 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: No such preset in [^ +]*/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset: "ListPresetsNoSuchPreset"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt new file mode 100644 index 0000000..1758f33 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt @@ -0,0 +1,6 @@ +^Not searching for unused variables given on the command line\. +Available presets: + + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt new file mode 100644 index 0000000..1758f33 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt @@ -0,0 +1,6 @@ +^Not searching for unused variables given on the command line\. +Available presets: + + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm"$ diff --git a/Tests/RunCMake/CMakePresets/LowVersion-result.txt b/Tests/RunCMake/CMakePresets/LowVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/LowVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/LowVersion-stderr.txt b/Tests/RunCMake/CMakePresets/LowVersion-stderr.txt new file mode 100644 index 0000000..92b3723 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/LowVersion-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/LowVersion: Unrecognized "version" field$ diff --git a/Tests/RunCMake/CMakePresets/LowVersion.json.in b/Tests/RunCMake/CMakePresets/LowVersion.json.in new file mode 100644 index 0000000..e03afa9 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/LowVersion.json.in @@ -0,0 +1,4 @@ +{ + "version": 0, + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredEmpty.cmake b/Tests/RunCMake/CMakePresets/MinimumRequiredEmpty.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredEmpty.cmake diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredEmpty.json.in b/Tests/RunCMake/CMakePresets/MinimumRequiredEmpty.json.in new file mode 100644 index 0000000..37740ef --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredEmpty.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "cmakeMinimumRequired": {}, + "configurePresets": [ + { + "name": "MinimumRequiredEmpty", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid-result.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid-stderr.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid-stderr.txt new file mode 100644 index 0000000..6548caf --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid: Invalid "cmakeMinimumRequired" field$ diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid.json.in b/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid.json.in new file mode 100644 index 0000000..da79603 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredInvalid.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "cmakeMinimumRequired": "3.18", + "configurePresets": [ + { + "name": "MinimumRequiredInvalid", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredMajor-result.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredMajor-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredMajor-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredMajor-stderr.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredMajor-stderr.txt new file mode 100644 index 0000000..6036fe3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredMajor-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/MinimumRequiredMajor: "cmakeMinimumRequired" version too new$ diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredMajor.json.in b/Tests/RunCMake/CMakePresets/MinimumRequiredMajor.json.in new file mode 100644 index 0000000..a17cdf6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredMajor.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "cmakeMinimumRequired": { + "major": 1000 + }, + "configurePresets": [ + { + "name": "MinimumRequiredMajor", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredMinor-result.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredMinor-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredMinor-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredMinor-stderr.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredMinor-stderr.txt new file mode 100644 index 0000000..bdee4cd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredMinor-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/MinimumRequiredMinor: "cmakeMinimumRequired" version too new$ diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredMinor.json.in b/Tests/RunCMake/CMakePresets/MinimumRequiredMinor.json.in new file mode 100644 index 0000000..33a8816 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredMinor.json.in @@ -0,0 +1,14 @@ +{ + "version": 1, + "cmakeMinimumRequired": { + "major": @CMAKE_MAJOR_VERSION@, + "minor": 1000 + }, + "configurePresets": [ + { + "name": "MinimumRequiredMinor", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredPatch-result.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredPatch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredPatch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredPatch-stderr.txt b/Tests/RunCMake/CMakePresets/MinimumRequiredPatch-stderr.txt new file mode 100644 index 0000000..b5d3a39 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredPatch-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/MinimumRequiredPatch: "cmakeMinimumRequired" version too new$ diff --git a/Tests/RunCMake/CMakePresets/MinimumRequiredPatch.json.in b/Tests/RunCMake/CMakePresets/MinimumRequiredPatch.json.in new file mode 100644 index 0000000..4a53f8d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/MinimumRequiredPatch.json.in @@ -0,0 +1,15 @@ +{ + "version": 1, + "cmakeMinimumRequired": { + "major": @CMAKE_MAJOR_VERSION@, + "minor": @CMAKE_MINOR_VERSION@, + "patch": 50000000 + }, + "configurePresets": [ + { + "name": "MinimumRequiredPatch", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoCMakePresets-result.txt b/Tests/RunCMake/CMakePresets/NoCMakePresets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoCMakePresets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoCMakePresets-stderr.txt b/Tests/RunCMake/CMakePresets/NoCMakePresets-stderr.txt new file mode 100644 index 0000000..c807ffc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoCMakePresets-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoCMakePresets: File not found$ diff --git a/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt b/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt new file mode 100644 index 0000000..c23ab89 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt @@ -0,0 +1,2 @@ +-- Configuring done +-- Generating done diff --git a/Tests/RunCMake/CMakePresets/NoDebug.cmake b/Tests/RunCMake/CMakePresets/NoDebug.cmake new file mode 100644 index 0000000..f2b3d4a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoDebug.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/DebugBase.cmake) +if(EXISTS "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt") + message(SEND_ERROR "Not debugging try_compile() did not work") +endif() diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgument-result.txt b/Tests/RunCMake/CMakePresets/NoPresetArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt new file mode 100644 index 0000000..aef30d2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No preset specified for --preset$ diff --git a/Tests/RunCMake/CMakePresets/NoPresetBinaryDir-result.txt b/Tests/RunCMake/CMakePresets/NoPresetBinaryDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetBinaryDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoPresetBinaryDir-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetBinaryDir-stderr.txt new file mode 100644 index 0000000..b525fc3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetBinaryDir-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoPresetBinaryDir: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/NoPresetBinaryDir.json.in b/Tests/RunCMake/CMakePresets/NoPresetBinaryDir.json.in new file mode 100644 index 0000000..8989cfd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetBinaryDir.json.in @@ -0,0 +1,9 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "NoPresetBinaryDir", + "generator": "@RunCMake_GENERATOR@" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoPresetGenerator-result.txt b/Tests/RunCMake/CMakePresets/NoPresetGenerator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetGenerator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoPresetGenerator-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetGenerator-stderr.txt new file mode 100644 index 0000000..6c0c9f7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetGenerator-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoPresetGenerator: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/NoPresetGenerator.json.in b/Tests/RunCMake/CMakePresets/NoPresetGenerator.json.in new file mode 100644 index 0000000..74f83b7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetGenerator.json.in @@ -0,0 +1,9 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "NoPresetGenerator", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoPresetName-result.txt b/Tests/RunCMake/CMakePresets/NoPresetName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetName-stderr.txt new file mode 100644 index 0000000..0ee338a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetName-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoPresetName: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/NoPresetName.json.in b/Tests/RunCMake/CMakePresets/NoPresetName.json.in new file mode 100644 index 0000000..373591d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetName.json.in @@ -0,0 +1,9 @@ +{ + "version": 1, + "configurePresets": [ + { + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoPresets-result.txt b/Tests/RunCMake/CMakePresets/NoPresets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoPresets-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresets-stderr.txt new file mode 100644 index 0000000..5ff3d33 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresets-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: No such preset in [^ +]*/Tests/RunCMake/CMakePresets/NoPresets: "NoPresets"$ diff --git a/Tests/RunCMake/CMakePresets/NoPresets-stdout.txt b/Tests/RunCMake/CMakePresets/NoPresets-stdout.txt new file mode 100644 index 0000000..cb01a02 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresets-stdout.txt @@ -0,0 +1 @@ +^Not searching for unused variables given on the command line\.$ diff --git a/Tests/RunCMake/CMakePresets/NoPresets.json.in b/Tests/RunCMake/CMakePresets/NoPresets.json.in new file mode 100644 index 0000000..61a2092 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresets.json.in @@ -0,0 +1,3 @@ +{ + "version": 1 +} diff --git a/Tests/RunCMake/CMakePresets/NoSuchMacro-result.txt b/Tests/RunCMake/CMakePresets/NoSuchMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoSuchMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt b/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt new file mode 100644 index 0000000..7dafe62 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoSuchMacro: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/NoSuchMacro.json.in b/Tests/RunCMake/CMakePresets/NoSuchMacro.json.in new file mode 100644 index 0000000..94d0b76 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoSuchMacro.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "NoSuchMacro", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${noexist}" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoSuchPreset-result.txt b/Tests/RunCMake/CMakePresets/NoSuchPreset-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoSuchPreset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoSuchPreset-stderr.txt b/Tests/RunCMake/CMakePresets/NoSuchPreset-stderr.txt new file mode 100644 index 0000000..9a2d0d5 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoSuchPreset-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: No such preset in [^ +]*/Tests/RunCMake/CMakePresets/NoSuchPreset: "NoSuchPreset"$ diff --git a/Tests/RunCMake/CMakePresets/NoVariableValue-result.txt b/Tests/RunCMake/CMakePresets/NoVariableValue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoVariableValue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoVariableValue-stderr.txt b/Tests/RunCMake/CMakePresets/NoVariableValue-stderr.txt new file mode 100644 index 0000000..cdab32f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoVariableValue-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoVariableValue: Invalid CMake variable definition$ diff --git a/Tests/RunCMake/CMakePresets/NoVariableValue.json.in b/Tests/RunCMake/CMakePresets/NoVariableValue.json.in new file mode 100644 index 0000000..482700d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoVariableValue.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "NoVariableValue", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "VAR": {} + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoVersion-result.txt b/Tests/RunCMake/CMakePresets/NoVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoVersion-stderr.txt b/Tests/RunCMake/CMakePresets/NoVersion-stderr.txt new file mode 100644 index 0000000..d4f07e4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoVersion-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/NoVersion: No "version" field$ diff --git a/Tests/RunCMake/CMakePresets/NoVersion.json.in b/Tests/RunCMake/CMakePresets/NoVersion.json.in new file mode 100644 index 0000000..3fe8332 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoVersion.json.in @@ -0,0 +1,3 @@ +{ + "configurePresets": [] +} diff --git a/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt b/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt new file mode 100644 index 0000000..a16d362 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt @@ -0,0 +1,23 @@ +^CMake Warning \(dev\) at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): + Dev warning +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/NoWarningFlags\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. + +CMake Deprecation Warning at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): + Deprecation warning +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/NoWarningFlags\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Warning: + Manually-specified variables were not used by the project: + + RunCMake_GENERATOR + UNUSED_VARIABLE$ diff --git a/Tests/RunCMake/CMakePresets/NoWarningFlags.cmake b/Tests/RunCMake/CMakePresets/NoWarningFlags.cmake new file mode 100644 index 0000000..5de7687 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoWarningFlags.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/WarningsBase.cmake) diff --git a/Tests/RunCMake/CMakePresets/PresetNotObject-result.txt b/Tests/RunCMake/CMakePresets/PresetNotObject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/PresetNotObject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/PresetNotObject-stderr.txt b/Tests/RunCMake/CMakePresets/PresetNotObject-stderr.txt new file mode 100644 index 0000000..6604a14 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/PresetNotObject-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/PresetNotObject: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/PresetNotObject.json.in b/Tests/RunCMake/CMakePresets/PresetNotObject.json.in new file mode 100644 index 0000000..d5892fc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/PresetNotObject.json.in @@ -0,0 +1,6 @@ +{ + "version": 1, + "configurePresets": [ + [] + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake new file mode 100644 index 0000000..bd84510 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -0,0 +1,257 @@ +cmake_minimum_required(VERSION 3.19) # CMP0053 + +include(RunCMake) + +# Fix Visual Studio generator name +if(RunCMake_GENERATOR MATCHES "^(Visual Studio [0-9]+ [0-9]+) ") + set(RunCMake_GENERATOR "${CMAKE_MATCH_1}") +endif() + +set(RunCMake-check-file check.cmake) + +function(validate_schema file expected_result) + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" "${RunCMake_SOURCE_DIR}/validate_schema.py" "${file}" + RESULT_VARIABLE _result + OUTPUT_VARIABLE _output + ERROR_VARIABLE _error + ) + if(NOT _result STREQUAL expected_result) + string(REPLACE "\n" "\n" _output_p "${_output}") + string(REPLACE "\n" "\n" _error_p "${_error}") + string(APPEND RunCMake_TEST_FAILED "Expected result of validating ${file}: ${expected_result}\nActual result: ${_result}\nOutput:\n${_output_p}\nError:\n${_error_p}") + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(run_cmake_presets name) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}") + set(_source_arg "${RunCMake_TEST_SOURCE_DIR}") + if(CMakePresets_RELATIVE_SOURCE) + set(_source_arg "../${name}") + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY) + + if(NOT CMakePresets_FILE) + set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/${name}.json.in") + endif() + if(EXISTS "${CMakePresets_FILE}") + configure_file("${CMakePresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" @ONLY) + endif() + + if(NOT CMakeUserPresets_FILE) + set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/${name}User.json.in") + endif() + if(EXISTS "${CMakeUserPresets_FILE}") + configure_file("${CMakeUserPresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" @ONLY) + endif() + + set(_s_arg -S) + if(CMakePresets_NO_S_ARG) + set(_s_arg) + endif() + set(_source_args ${_s_arg} ${_source_arg}) + if(CMakePresets_NO_SOURCE_ARGS) + set(_source_args) + endif() + set(_unused_cli --no-warn-unused-cli) + if(CMakePresets_WARN_UNUSED_CLI) + set(_unused_cli) + endif() + + set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND} + ${_source_args} + -DRunCMake_TEST=${name} + -DRunCMake_GENERATOR=${RunCMake_GENERATOR} + -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM} + ${_unused_cli} + --preset=${name} + ${ARGN} + ) + run_cmake(${name}) +endfunction() + +# Test CMakePresets.json errors +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(NoCMakePresets) +run_cmake_presets(JSONParseError) +run_cmake_presets(InvalidRoot) +run_cmake_presets(NoVersion) +run_cmake_presets(InvalidVersion) +run_cmake_presets(LowVersion) +run_cmake_presets(HighVersion) +run_cmake_presets(InvalidVendor) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(NoPresets) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(InvalidPresets) +run_cmake_presets(PresetNotObject) +run_cmake_presets(NoPresetName) +run_cmake_presets(InvalidPresetName) +run_cmake_presets(EmptyPresetName) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(NoPresetGenerator) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(InvalidPresetGenerator) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(NoPresetBinaryDir) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(InvalidPresetBinaryDir) +run_cmake_presets(InvalidVariables) +run_cmake_presets(VariableNotObject) +run_cmake_presets(NoVariableValue) +run_cmake_presets(InvalidVariableValue) +run_cmake_presets(ExtraRootField) +run_cmake_presets(ExtraPresetField) +run_cmake_presets(ExtraVariableField) +run_cmake_presets(InvalidPresetVendor) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(DuplicatePresets) +run_cmake_presets(CyclicInheritance0) +run_cmake_presets(CyclicInheritance1) +run_cmake_presets(CyclicInheritance2) +run_cmake_presets(InvalidInheritance) +run_cmake_presets(ErrorNoWarningDev) +run_cmake_presets(ErrorNoWarningDeprecated) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(InvalidArchitectureStrategy) +run_cmake_presets(UnknownArchitectureStrategy) +run_cmake_presets(InvalidToolsetStrategy) +run_cmake_presets(UnknownToolsetStrategy) +run_cmake_presets(EmptyCacheKey) +run_cmake_presets(EmptyEnvKey) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(UnclosedMacro) +run_cmake_presets(NoSuchMacro) +run_cmake_presets(EnvCycle) +run_cmake_presets(EmptyEnv) +run_cmake_presets(EmptyPenv) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) + +# Test cmakeMinimumRequired field +run_cmake_presets(MinimumRequiredInvalid) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(MinimumRequiredEmpty) +run_cmake_presets(MinimumRequiredMajor) +run_cmake_presets(MinimumRequiredMinor) +run_cmake_presets(MinimumRequiredPatch) + +# Test properly working CMakePresets.json +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/CMakePresets.json.in") +unset(ENV{TEST_ENV}) +unset(ENV{TEST_ENV_REF}) +unset(ENV{TEST_D_ENV_REF}) +set(ENV{TEST_ENV_OVERRIDE} "This environment variable will be overridden") +set(ENV{TEST_PENV} "Process environment variable") +set(ENV{TEST_ENV_REF_PENV} "suffix") +run_cmake_presets(Good "-DTEST_OVERRIDE_1=Overridden value" "-DTEST_OVERRIDE_2:STRING=Overridden value" -C "${RunCMake_SOURCE_DIR}/CacheOverride.cmake" "-UTEST_UNDEF") +unset(ENV{TEST_ENV_OVERRIDE}) +unset(ENV{TEST_PENV}) +unset(ENV{TEST_ENV_REF_PENV}) +run_cmake_presets(GoodNoArgs) +file(REMOVE_RECURSE ${RunCMake_BINARY_DIR}/GoodBinaryUp-build) +run_cmake_presets(GoodBinaryUp) +set(CMakePresets_RELATIVE_SOURCE TRUE) +run_cmake_presets(GoodBinaryRelative) +unset(CMakePresets_RELATIVE_SOURCE) +run_cmake_presets(GoodSpaces "--preset=Good Spaces") +if(WIN32) + run_cmake_presets(GoodWindowsBackslash) +endif() +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/GoodBOM.json.in") +run_cmake_presets(GoodBOM) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/CMakePresets.json.in") +file(REMOVE_RECURSE ${RunCMake_BINARY_DIR}/GoodBinaryCmdLine-build) +run_cmake_presets(GoodBinaryCmdLine -B ${RunCMake_BINARY_DIR}/GoodBinaryCmdLine-build) +run_cmake_presets(GoodGeneratorCmdLine -G ${RunCMake_GENERATOR}) +run_cmake_presets(InvalidGeneratorCmdLine -G "Invalid Generator") +set(CMakePresets_NO_S_ARG TRUE) +run_cmake_presets(GoodNoS) +unset(CMakePresets_NO_S_ARG) +run_cmake_presets(GoodInheritanceParent) +run_cmake_presets(GoodInheritanceChild) +run_cmake_presets(GoodInheritanceOverride) +run_cmake_presets(GoodInheritanceMulti) +run_cmake_presets(GoodInheritanceMultiSecond) +run_cmake_presets(GoodInheritanceMacro) + +# Test bad preset arguments +run_cmake_presets(VendorMacro) +run_cmake_presets(InvalidGenerator) + +# Test Visual Studio-specific stuff +if(RunCMake_GENERATOR MATCHES "^Visual Studio ") + run_cmake_presets(VisualStudioGeneratorArch) + run_cmake_presets(VisualStudioWin32) + run_cmake_presets(VisualStudioWin64) + run_cmake_presets(VisualStudioWin32Override -A x64) + if(NOT RunCMake_GENERATOR STREQUAL "Visual Studio 9 2008") + run_cmake_presets(VisualStudioToolset) + run_cmake_presets(VisualStudioToolsetOverride -T "Test Toolset") + run_cmake_presets(VisualStudioInheritanceParent) + run_cmake_presets(VisualStudioInheritanceChild) + run_cmake_presets(VisualStudioInheritanceOverride) + run_cmake_presets(VisualStudioInheritanceMulti) + run_cmake_presets(VisualStudioInheritanceMultiSecond) + endif() +else() + run_cmake_presets(ArchToolsetStrategyNone) + run_cmake_presets(ArchToolsetStrategyDefault) + run_cmake_presets(ArchToolsetStrategyIgnore) +endif() + +# Test bad command line arguments +run_cmake_presets(NoSuchPreset) +run_cmake_presets(NoPresetArgument --preset=) +run_cmake_presets(UseHiddenPreset) + +# Test CMakeUserPresets.json +unset(CMakePresets_FILE) +run_cmake_presets(GoodUserOnly) +run_cmake_presets(GoodUserFromMain) +run_cmake_presets(GoodUserFromUser) + +# Test CMakeUserPresets.json errors +run_cmake_presets(UserDuplicateInUser) +run_cmake_presets(UserDuplicateCross) +run_cmake_presets(UserInheritance) + +# Test listing presets +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in") +run_cmake_presets(ListPresets --list-presets) + +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir") +set(RunCMake_TEST_NO_CLEAN 1) +set(CMakePresets_NO_SOURCE_ARGS 1) +run_cmake_presets(ListPresetsWorkingDir --list-presets) +unset(CMakePresets_NO_SOURCE_ARGS) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +run_cmake_presets(ListPresetsNoSuchPreset) +run_cmake_presets(ListPresetsHidden) + +# Test warning and error flags +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Warnings.json.in") +set(CMakePresets_WARN_UNUSED_CLI 1) +run_cmake_presets(NoWarningFlags) +run_cmake_presets(WarningFlags) +run_cmake_presets(DisableWarningFlags) +run_cmake_presets(ErrorDev) +run_cmake_presets(ErrorDeprecated) +unset(CMakePresets_WARN_UNUSED_CLI) + +# Test debug +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Debug.json.in") +run_cmake_presets(NoDebug) +run_cmake_presets(Debug) + +# Test the example from the documentation +file(READ "${RunCMake_SOURCE_DIR}/../../../Help/manual/presets/example.json" _example) +string(REPLACE "\"generator\": \"Ninja\"" "\"generator\": \"@RunCMake_GENERATOR@\"" _example "${_example}") +file(WRITE "${RunCMake_BINARY_DIR}/example.json.in" "${_example}") +set(CMakePresets_FILE "${RunCMake_BINARY_DIR}/example.json.in") +run_cmake_presets(DocumentationExample --preset=default) diff --git a/Tests/RunCMake/CMakePresets/TestVariable.cmake b/Tests/RunCMake/CMakePresets/TestVariable.cmake new file mode 100644 index 0000000..934af52 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/TestVariable.cmake @@ -0,0 +1,25 @@ +function(test_variable name expected_type expected_value) + if(NOT DEFINED "${name}") + message(SEND_ERROR "${name} is not defined") + elseif(NOT "${${name}}" STREQUAL expected_value) + message(SEND_ERROR "Expected value of ${name}: \"${expected_value}\"\nActual value: \"${${name}}\"") + endif() + if(expected_type) + if(NOT DEFINED "CACHE{${name}}") + message(SEND_ERROR "Cache entry ${name} does not exist") + else() + get_property(type CACHE ${name} PROPERTY TYPE) + if(NOT type STREQUAL expected_type) + message(SEND_ERROR "Expected type of ${name}: \"${expected_type}\"\nActual type: \"${type}\"") + endif() + endif() + endif() +endfunction() + +function(test_environment_variable name expected_value) + if(NOT DEFINED "ENV{${name}}") + message(SEND_ERROR "Environment variable ${name} is not defined") + elseif(NOT "$ENV{${name}}" STREQUAL expected_value) + message(SEND_ERROR "Expected value of environment variable ${name}: \"${expected_value}\"\nActual value: \"$ENV{${name}}\"") + endif() +endfunction() diff --git a/Tests/RunCMake/CMakePresets/UnclosedMacro-result.txt b/Tests/RunCMake/CMakePresets/UnclosedMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnclosedMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt b/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt new file mode 100644 index 0000000..f9481f0 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/UnclosedMacro: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/UnclosedMacro.json.in b/Tests/RunCMake/CMakePresets/UnclosedMacro.json.in new file mode 100644 index 0000000..ad6cf7d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnclosedMacro.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UnclosedMacro", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt new file mode 100644 index 0000000..cf17881 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in new file mode 100644 index 0000000..a3bf7c8 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UnknownArchitectureStrategy", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": { + "strategy": "unknown" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt new file mode 100644 index 0000000..8f9be29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy.json.in b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy.json.in new file mode 100644 index 0000000..1668700 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UnknownToolsetStrategy", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "toolset": { + "strategy": "unknown" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UseHiddenPreset-result.txt b/Tests/RunCMake/CMakePresets/UseHiddenPreset-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UseHiddenPreset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UseHiddenPreset-stderr.txt b/Tests/RunCMake/CMakePresets/UseHiddenPreset-stderr.txt new file mode 100644 index 0000000..45b4cd4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UseHiddenPreset-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Cannot use hidden preset in [^ +]*/Tests/RunCMake/CMakePresets/UseHiddenPreset: "UseHiddenPreset"$ diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateCross-result.txt b/Tests/RunCMake/CMakePresets/UserDuplicateCross-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateCross-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateCross-stderr.txt b/Tests/RunCMake/CMakePresets/UserDuplicateCross-stderr.txt new file mode 100644 index 0000000..125265f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateCross-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/UserDuplicateCross: Duplicate presets$ diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateCross.json.in b/Tests/RunCMake/CMakePresets/UserDuplicateCross.json.in new file mode 100644 index 0000000..172cfba --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateCross.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UserDuplicateCross", + "generator": "@RunCMake_GENERATOR", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateCrossUser.json.in b/Tests/RunCMake/CMakePresets/UserDuplicateCrossUser.json.in new file mode 100644 index 0000000..172cfba --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateCrossUser.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UserDuplicateCross", + "generator": "@RunCMake_GENERATOR", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateInUser-result.txt b/Tests/RunCMake/CMakePresets/UserDuplicateInUser-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateInUser-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateInUser-stderr.txt b/Tests/RunCMake/CMakePresets/UserDuplicateInUser-stderr.txt new file mode 100644 index 0000000..1071b17 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateInUser-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/UserDuplicateInUser: Duplicate presets$ diff --git a/Tests/RunCMake/CMakePresets/UserDuplicateInUserUser.json.in b/Tests/RunCMake/CMakePresets/UserDuplicateInUserUser.json.in new file mode 100644 index 0000000..365fafe --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserDuplicateInUserUser.json.in @@ -0,0 +1,15 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UserDuplicateInUser", + "generator": "@RunCMake_GENERATOR", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "UserDuplicateInUser", + "generator": "@RunCMake_GENERATOR", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UserInheritance-result.txt b/Tests/RunCMake/CMakePresets/UserInheritance-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserInheritance-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/UserInheritance-stderr.txt b/Tests/RunCMake/CMakePresets/UserInheritance-stderr.txt new file mode 100644 index 0000000..213215a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserInheritance-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/UserInheritance: Project preset inherits from user preset$ diff --git a/Tests/RunCMake/CMakePresets/UserInheritance.json.in b/Tests/RunCMake/CMakePresets/UserInheritance.json.in new file mode 100644 index 0000000..d9973d7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserInheritance.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UserInheritance", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "UserInheritanceUser" + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/UserInheritanceUser.json.in b/Tests/RunCMake/CMakePresets/UserInheritanceUser.json.in new file mode 100644 index 0000000..1321a73 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/UserInheritanceUser.json.in @@ -0,0 +1,10 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "UserInheritanceUser", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/VariableNotObject-result.txt b/Tests/RunCMake/CMakePresets/VariableNotObject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VariableNotObject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/VariableNotObject-stderr.txt b/Tests/RunCMake/CMakePresets/VariableNotObject-stderr.txt new file mode 100644 index 0000000..8cacb0a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VariableNotObject-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/VariableNotObject: Invalid CMake variable definition$ diff --git a/Tests/RunCMake/CMakePresets/VariableNotObject.json.in b/Tests/RunCMake/CMakePresets/VariableNotObject.json.in new file mode 100644 index 0000000..51298f5 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VariableNotObject.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "VariableNotObject", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "VAR": [] + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/VendorMacro-result.txt b/Tests/RunCMake/CMakePresets/VendorMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VendorMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/VendorMacro-stderr.txt b/Tests/RunCMake/CMakePresets/VendorMacro-stderr.txt new file mode 100644 index 0000000..2e98019 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VendorMacro-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Could not evaluate preset "VendorMacro": Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/VisualStudioGeneratorArch-result.txt b/Tests/RunCMake/CMakePresets/VisualStudioGeneratorArch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioGeneratorArch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/VisualStudioGeneratorArch-stderr.txt b/Tests/RunCMake/CMakePresets/VisualStudioGeneratorArch-stderr.txt new file mode 100644 index 0000000..a311321 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioGeneratorArch-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error: Could not create named generator Visual Studio [^ +]* Win64 +Using platforms in Visual Studio generator names is not supported in CMakePresets\.json\. + +Generators diff --git a/Tests/RunCMake/CMakePresets/VisualStudioInheritanceChild.cmake b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceChild.cmake new file mode 100644 index 0000000..d485ab3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceChild.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "Test Platform") +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioInheritanceMulti.cmake b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceMulti.cmake new file mode 100644 index 0000000..d485ab3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceMulti.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "Test Platform") +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioInheritanceMultiSecond.cmake b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceMultiSecond.cmake new file mode 100644 index 0000000..d485ab3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceMultiSecond.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "Test Platform") +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioInheritanceOverride.cmake b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceOverride.cmake new file mode 100644 index 0000000..d485ab3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceOverride.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "Test Platform") +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioInheritanceParent.cmake b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceParent.cmake new file mode 100644 index 0000000..d485ab3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioInheritanceParent.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "Test Platform") +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioToolset.cmake b/Tests/RunCMake/CMakePresets/VisualStudioToolset.cmake new file mode 100644 index 0000000..722e976 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioToolset.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioToolsetOverride.cmake b/Tests/RunCMake/CMakePresets/VisualStudioToolsetOverride.cmake new file mode 100644 index 0000000..722e976 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioToolsetOverride.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_TOOLSET "" "Test Toolset") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioWin32.cmake b/Tests/RunCMake/CMakePresets/VisualStudioWin32.cmake new file mode 100644 index 0000000..a1c61b4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioWin32.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "Win32") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioWin32Override.cmake b/Tests/RunCMake/CMakePresets/VisualStudioWin32Override.cmake new file mode 100644 index 0000000..b3464d6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioWin32Override.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "x64") diff --git a/Tests/RunCMake/CMakePresets/VisualStudioWin64.cmake b/Tests/RunCMake/CMakePresets/VisualStudioWin64.cmake new file mode 100644 index 0000000..b3464d6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/VisualStudioWin64.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_VS_PLATFORM_NAME "" "x64") diff --git a/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt b/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt new file mode 100644 index 0000000..6e488a9 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt @@ -0,0 +1,34 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/[^/ +]*:[0-9]+ \([a-zA-Z_][a-zA-Z0-9_]*\): + uninitialized variable '[^ +]*' +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(project\) +This warning is for project developers\. Use -Wno-dev to suppress it\..* +CMake Warning \(dev\) at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): + Dev warning +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/WarningFlags\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. + +CMake Deprecation Warning at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): + Deprecation warning +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/WarningFlags\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Warning \(dev\) at [^ +]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(set\): + uninitialized variable 'UNINITIALIZED_VARIABLE' +Call Stack \(most recent call first\): + [^ +]*/Tests/RunCMake/CMakePresets/WarningFlags\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CMakePresets/WarningFlags.cmake b/Tests/RunCMake/CMakePresets/WarningFlags.cmake new file mode 100644 index 0000000..5de7687 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/WarningFlags.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/WarningsBase.cmake) diff --git a/Tests/RunCMake/CMakePresets/Warnings.json.in b/Tests/RunCMake/CMakePresets/Warnings.json.in new file mode 100644 index 0000000..40ec6ce --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Warnings.json.in @@ -0,0 +1,50 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "NoWarningFlags", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "UNUSED_VARIABLE": "Unused" + } + }, + { + "name": "WarningFlags", + "inherits": "NoWarningFlags", + "warnings": { + "dev": true, + "deprecated": true, + "uninitialized": true, + "unusedCli": false, + "systemVars": true + } + }, + { + "name": "DisableWarningFlags", + "inherits": "NoWarningFlags", + "warnings": { + "dev": false, + "deprecated": false, + "unusedCli": false + } + }, + { + "name": "ErrorDev", + "inherits": "NoWarningFlags", + "errors": { + "dev": true + } + }, + { + "name": "ErrorDeprecated", + "inherits": "NoWarningFlags", + "warnings": { + "dev": false + }, + "errors": { + "deprecated": true + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/WarningsBase.cmake b/Tests/RunCMake/CMakePresets/WarningsBase.cmake new file mode 100644 index 0000000..1a434dc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/WarningsBase.cmake @@ -0,0 +1,3 @@ +message(AUTHOR_WARNING "Dev warning") +message(DEPRECATION "Deprecation warning") +set(_uninitialized "${UNINITIALIZED_VARIABLE}") diff --git a/Tests/RunCMake/CMakePresets/check.cmake b/Tests/RunCMake/CMakePresets/check.cmake new file mode 100644 index 0000000..bf43c7e --- /dev/null +++ b/Tests/RunCMake/CMakePresets/check.cmake @@ -0,0 +1,15 @@ +if(PYTHON_EXECUTABLE AND CMake_TEST_JSON_SCHEMA) + if(NOT CMakePresets_SCHEMA_EXPECTED_RESULT) + set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) + endif() + if(EXISTS "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json") + validate_schema("${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" "${CMakePresets_SCHEMA_EXPECTED_RESULT}") + endif() + + if(NOT CMakeUserPresets_SCHEMA_EXPECTED_RESULT) + set(CMakeUserPresets_SCHEMA_EXPECTED_RESULT 0) + endif() + if(EXISTS "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json") + validate_schema("${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" "${CMakeUserPresets_SCHEMA_EXPECTED_RESULT}") + endif() +endif() diff --git a/Tests/RunCMake/CMakePresets/main.c b/Tests/RunCMake/CMakePresets/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/CMakePresets/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py new file mode 100644 index 0000000..c9f84ee --- /dev/null +++ b/Tests/RunCMake/CMakePresets/validate_schema.py @@ -0,0 +1,17 @@ +import jsmin +import json +import jsonschema +import os.path +import sys + + +with open(sys.argv[1], "rb") as f: + contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig"))) + +schema_file = os.path.join( + os.path.dirname(__file__), + "..", "..", "..", "Help", "manual", "presets", "schema.json") +with open(schema_file) as f: + schema = json.load(f) + +jsonschema.validate(contents, schema) diff --git a/Tests/RunCMake/CPack/DragNDrop/Accept.txt b/Tests/RunCMake/CPack/DragNDrop/Accept.txt new file mode 100644 index 0000000..975fbec --- /dev/null +++ b/Tests/RunCMake/CPack/DragNDrop/Accept.txt @@ -0,0 +1 @@ +y diff --git a/Tests/RunCMake/CPack/DragNDrop/Helpers.cmake b/Tests/RunCMake/CPack/DragNDrop/Helpers.cmake index 023e597..896fba7 100644 --- a/Tests/RunCMake/CPack/DragNDrop/Helpers.cmake +++ b/Tests/RunCMake/CPack/DragNDrop/Helpers.cmake @@ -5,6 +5,7 @@ function(getPackageContent FILE RESULT_VAR) file(REMOVE_RECURSE "${path_}/content") file(MAKE_DIRECTORY "${path_}/content") execute_process(COMMAND ${HDIUTIL_EXECUTABLE} attach -mountroot ${path_}/content -nobrowse ${FILE} + INPUT_FILE "${src_dir}/DragNDrop/Accept.txt" RESULT_VARIABLE attach_result_ ERROR_VARIABLE attach_error_ OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/Tests/RunCMake/CPack/DragNDrop/packaging_MONOLITHIC_default.cmake b/Tests/RunCMake/CPack/DragNDrop/packaging_MONOLITHIC_default.cmake new file mode 100644 index 0000000..ca27890 --- /dev/null +++ b/Tests/RunCMake/CPack/DragNDrop/packaging_MONOLITHIC_default.cmake @@ -0,0 +1,2 @@ +set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON) +set(CPACK_DMG_VOLUME_NAME "volume-name") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 064b4dc..530bcdf 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT") run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT") run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT") run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC") +run_cpack_test(DMG_SLA "DragNDrop" false "MONOLITHIC") run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT") run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT") run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT") @@ -46,3 +47,4 @@ run_cpack_test_subtests( "MONOLITHIC;COMPONENT" ) run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(PRE_POST_SCRIPTS "ZIP" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake index 70ad48b..6e841fc 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake @@ -34,7 +34,7 @@ set(_expected_description [[ Description: This is the summary line This is the Debian package multiline description. . It must be formatted properly! Otherwise, the result `*.deb` - package become broken and cant be installed! + package become broken and cannot be installed! . It may contains `;` characters (even like this `;;;;`). Example: . diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake index 893eb01..2a27b46 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake @@ -5,7 +5,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is the summary line") set(_description [[This is the Debian package multiline description. It must be formatted properly! Otherwise, the result `*.deb` -package become broken and cant be installed! +package become broken and cannot be installed! It may contains `;` characters (even like this `;;;;`). Example: diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf b/Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf new file mode 100644 index 0000000..c1da711 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf @@ -0,0 +1,7 @@ +{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}} +{\colortbl ;\red0\green0\blue255;} +{\*\generator Riched20 10.0.18362}\viewkind4\uc1 +\pard\sa200\sl276\slmult1\b\f0\fs22\lang9 LICENSE\b0\par +This is an installer created using CPack ({{\field{\*\fldinst{HYPERLINK https://cmake.org }}{\fldrslt{https://cmake.org\ul0\cf0}}}}\f0\fs22 ). No license provided.\par +\par +} diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/English.menu.txt b/Tests/RunCMake/CPack/tests/DMG_SLA/English.menu.txt new file mode 100644 index 0000000..b2cbc25 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/English.menu.txt @@ -0,0 +1,9 @@ +English +Agree +Disagree +Print +Save... +You agree to the License Agreement terms when you click the "Agree" button. +Software License Agreement +This text cannot be saved. This disk may be full or locked or the file may be locked. +Unable to print. Make sure you have selected a printer. diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA/ExpectedFiles.cmake new file mode 100644 index 0000000..d1a3a5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt b/Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt new file mode 100644 index 0000000..0edd1f2 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt @@ -0,0 +1,3 @@ +LIZENZ +------ +Dies ist ein Installationsprogramm, das mit erstellt wurde CPack (https://cmake.org). Keine Lizenz angegeben. diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt b/Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt new file mode 100644 index 0000000..7724818 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt @@ -0,0 +1,9 @@ +German +Akzeptieren +Ablehnen +Drucken +Speichern... +Klicken Sie auf "Akzeptieren", wenn Sie mit den Bestimmungen des Software-Lizenzvertrages einverstanden sind. +Software-Lizenzvertrag +Dieser Text kann nicht gesichert werden. Diese Festplatte ist mšglicherweise voll oder geschŸtzt oder der Ordner ist geschŸtzt. +Es kann nicht gedruckt werden. Bitte stellen Sie sicher, dass ein Drucker ausgewŠhlt ist. diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA/VerifyResult.cmake new file mode 100644 index 0000000..010e14c --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/VerifyResult.cmake @@ -0,0 +1,33 @@ +set(dmg "${bin_dir}/${FOUND_FILE_1}") +execute_process(COMMAND hdiutil udifderez -xml "${dmg}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res) +if(NOT res EQUAL 0) + string(REPLACE "\n" "\n " err " ${err}") + message(FATAL_ERROR "Running 'hdiutil udifderez -xml' on\n ${dmg}\nfailed with:\n${err}") +endif() +foreach(key "LPic" "STR#" "TEXT" "RTF ") + if(NOT out MATCHES "<key>${key}</key>") + string(REPLACE "\n" "\n " out " ${out}") + message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\ndid not show '${key}' key:\n${out}") + endif() +endforeach() +foreach(line + # LPic + "\tAAAAAgAAAAAAAAADAAEAAA==\n" + # STR# English first and last base64 lines + "\tAAkHRW5nbGlzaAVBZ3JlZQhEaXNhZ3JlZQVQcmludAdTYXZlLi4u\n" + "\tZCBhIHByaW50ZXIu\n" + # STR# German first and last base64 lines + "\tAAkGR2VybWFuC0FremVwdGllcmVuCEFibGVobmVuB0RydWNrZW4M\n" + "\tYXVzZ2V3wopobHQgaXN0Lg==\n" + # RTF English first and last base64 lines + "\te1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZGVmZjBcbm91aWNvbXBh\n" + "\tdmlkZWQuXHBhcg1ccGFyDX0NDQ==\n" + # TEXT German first and last base64 lines + "\tTElaRU5aDS0tLS0tLQ1EaWVzIGlzdCBlaW4gSW5zdGFsbGF0aW9u\n" + "\tZ2ViZW4uDQ0=\n" + ) + if(NOT out MATCHES "${line}") + string(REPLACE "\n" "\n " out " ${out}") + message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\ndid not show '${line}':\n${out}") + endif() +endforeach() diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA/test.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA/test.cmake new file mode 100644 index 0000000..2804b0b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) +set(CPACK_DMG_SLA_DIR "${CMAKE_CURRENT_LIST_DIR}") +set(CPACK_DMG_SLA_LANGUAGES English German) diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake index 6f7c4c2..3db8014 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake @@ -29,3 +29,11 @@ expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt) expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt) message(STATUS "This status message is expected to be visible") + +set( + CPACK_EXTERNAL_BUILT_PACKAGES + ${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt + ${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt + ${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt + ${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt + ) diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt index 37d635f..587b2e8 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt @@ -1 +1,11 @@ -- This status message is expected to be visible +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/external-0\.1\.1-.*\.json generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/external-0\.1\.1-.*\.json\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f1\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f1\.txt\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f2\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f2\.txt\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f3\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f3\.txt\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f4\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f4\.txt\.sha1 generated\. diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake index bc9766b..d4781ba 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake @@ -17,6 +17,7 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") set(CPACK_EXTERNAL_ENABLE_STAGING 1) set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake") + set(CPACK_PACKAGE_CHECKSUM SHA1) endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake new file mode 100644 index 0000000..63a36a3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake @@ -0,0 +1,19 @@ +set(SATU "/satu;/satu/CMakeLists.txt") +set(DUA "/dua;/dua/CMakeLists.txt") + +if(GENERATOR_TYPE STREQUAL ZIP) + set(_ext "zip") +elseif(GENERATOR_TYPE STREQUAL TGZ) + set(_ext "tar.gz") +endif() + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "*-satu.${_ext}") + set(EXPECTED_FILE_CONTENT_1_LIST ${SATU}) + set(EXPECTED_FILE_2 "*-dua.${_ext}") + set(EXPECTED_FILE_CONTENT_2_LIST ${DUA}) +else() + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST ${SATU} ${DUA}) +endif() diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt new file mode 100644 index 0000000..319d0da --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt @@ -0,0 +1,4 @@ +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre\.cmake and generator ZIP +.* +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post\.cmake and generator ZIP +-- Built packages: .*/_CPack_Packages/.*/pre_post_scripts-.*-dua.zip;.*/_CPack_Packages/.*/pre_post_scripts-.*-satu.zip diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt new file mode 100644 index 0000000..632c4d1 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt @@ -0,0 +1,4 @@ +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre\.cmake and generator ZIP +.* +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post\.cmake and generator ZIP +-- Built packages: .*/_CPack_Packages/.*/pre_post_scripts-0\.1\.1-.*\.zip diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake new file mode 100644 index 0000000..cf0b149 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake @@ -0,0 +1,2 @@ +message(STATUS "The message from ${CMAKE_CURRENT_LIST_FILE} and generator ${CPACK_GENERATOR}") +message(STATUS "Built packages: ${CPACK_PACKAGE_FILES}") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake new file mode 100644 index 0000000..b04aa6b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake @@ -0,0 +1 @@ +message(STATUS "The message from ${CMAKE_CURRENT_LIST_FILE} and generator ${CPACK_GENERATOR}") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake new file mode 100644 index 0000000..f1b6d5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake @@ -0,0 +1,9 @@ +install(FILES CMakeLists.txt DESTINATION satu COMPONENT satu) +install(FILES CMakeLists.txt DESTINATION dua COMPONENT dua) + +set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/pre.cmake") +set(CPACK_POST_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/post.cmake") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL satu dua) +endif() diff --git a/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake index b3accb5..35a93d6 100644 --- a/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake @@ -13,7 +13,7 @@ function(checkPackageURL FILE TAG EXPECTED_URL) endif() endforeach() if(NOT _seen_url) - message(FATAL_ERROR "The packge `${FILE}` do not have URL as expected") + message(FATAL_ERROR "The package `${FILE}` do not have URL as expected") endif() endfunction() diff --git a/Tests/RunCMake/CTest/CMakeLists.txt b/Tests/RunCMake/CTest/CMakeLists.txt index 73e6a78..f1a83e8 100644 --- a/Tests/RunCMake/CTest/CMakeLists.txt +++ b/Tests/RunCMake/CTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) if(NOT NoProject) project(${RunCMake_TEST} NONE) endif() diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index 761224a..ffc8f78 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -18,3 +18,23 @@ function(run_CMakeCTestArguments) run_cmake_command(CMakeCTestArguments-test ${CMAKE_COMMAND} --build . --config Debug --target "${test}") endfunction() run_CMakeCTestArguments() + +function(run_TestfileErrors) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestfileErrors-build) + run_cmake(TestfileErrors) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(TestfileErrors-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(TestfileErrors-test ${CMAKE_CTEST_COMMAND} -C Debug) +endfunction() +run_TestfileErrors() + +function(run_SingleConfig) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SingleConfig-build) + run_cmake(SingleConfig) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(SingleConfig-build ${CMAKE_COMMAND} --build .) + run_cmake_command(SingleConfig-test ${CMAKE_CTEST_COMMAND}) # No -C Debug required for single-config. +endfunction() +if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_SingleConfig() +endif() diff --git a/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt b/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt new file mode 100644 index 0000000..1c39ea1 --- /dev/null +++ b/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt @@ -0,0 +1,8 @@ +^Test project [^ +]*/Tests/RunCMake/CTest/SingleConfig-build + Start 1: SingleConfig +1/1 Test #1: SingleConfig \.+ +Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/CTest/SingleConfig.cmake b/Tests/RunCMake/CTest/SingleConfig.cmake new file mode 100644 index 0000000..7c10e06 --- /dev/null +++ b/Tests/RunCMake/CTest/SingleConfig.cmake @@ -0,0 +1,6 @@ +include(CTest) + +# This should be ignored by single-config generators. +set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE INTERNAL "Supported configuration types") + +add_test(NAME SingleConfig COMMAND ${CMAKE_COMMAND} -E echo SingleConfig) diff --git a/Tests/RunCMake/CTest/TestfileErrors-Script.cmake b/Tests/RunCMake/CTest/TestfileErrors-Script.cmake new file mode 100644 index 0000000..d9fc7c8 --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors-Script.cmake @@ -0,0 +1,4 @@ +message(SEND_ERROR "SEND_ERROR") +message(FATAL_ERROR "FATAL_ERROR") +# This shouldn't get printed because the script aborts on FATAL_ERROR +message(SEND_ERROR "reaching the unreachable") diff --git a/Tests/RunCMake/CTest/TestfileErrors-test-result.txt b/Tests/RunCMake/CTest/TestfileErrors-test-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors-test-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt b/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt new file mode 100644 index 0000000..a3a476b --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at [^ +]*/Tests/RunCMake/CTest/TestfileErrors-Script.cmake:1 \(message\): + SEND_ERROR +Call Stack \(most recent call first\): + CTestTestfile.cmake:[0-9]+ \(include\) ++ +CMake Error at [^ +]*/Tests/RunCMake/CTest/TestfileErrors-Script.cmake:2 \(message\): + FATAL_ERROR +Call Stack \(most recent call first\): + CTestTestfile.cmake:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CTest/TestfileErrors.cmake b/Tests/RunCMake/CTest/TestfileErrors.cmake new file mode 100644 index 0000000..676eb47 --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors.cmake @@ -0,0 +1,3 @@ +include(CTest) +add_test(NAME "unreachable" COMMAND ${CMAKE_COMMAND} -E true) +set_property(DIRECTORY PROPERTY TEST_INCLUDE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/TestfileErrors-Script.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt index d95bb33..97e2a10 100644 --- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\): subdirs called with incorrect number of arguments + -No tests were found!!!$ +Errors while running CTest$ diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt index ba4235d..19310b8 100644 --- a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt @@ -1 +1,2 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputSize/DartConfiguration.tcl Errors while running CTest diff --git a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt new file mode 100644 index 0000000..0421e28 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake new file mode 100644 index 0000000..095fd54 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake @@ -0,0 +1,22 @@ + +enable_language (C) +include(CheckCompilerFlag) + +check_compiler_flag(C "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid C compile flag didn't fail.") +endif() + +if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + check_compiler_flag(C "-x c" SHOULD_WORK) + if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed") + endif() +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI) + if(SHOULD_FAIL_RTTI) + message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed") + endif() +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake new file mode 100644 index 0000000..a40699c --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake @@ -0,0 +1,13 @@ + +enable_language (CUDA) +include(CheckCompilerFlag) + +check_compiler_flag(CUDA "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid CUDA compile flag didn't fail.") +endif() + +check_compiler_flag(CUDA "-DFOO" SHOULD_WORK) +if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_CUDA_COMPILER_ID} compiler flag '-DFOO' check failed") +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake new file mode 100644 index 0000000..bbc104e --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake @@ -0,0 +1,15 @@ + +enable_language (CXX) +include(CheckCompilerFlag) + +check_compiler_flag(CXX "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid CXX compile flag didn't fail.") +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + check_compiler_flag(CXX "-x c++" SHOULD_WORK) + if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") + endif() +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake new file mode 100644 index 0000000..220ee29 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake @@ -0,0 +1,14 @@ +enable_language (Fortran) +include(CheckCompilerFlag) + +check_compiler_flag(Fortran "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid Fortran compile flag didn't fail.") +endif() + +if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + check_compiler_flag(Fortran "-Wall" SHOULD_WORK) + if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed") + endif() +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake new file mode 100644 index 0000000..662319a --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake @@ -0,0 +1,13 @@ + +enable_language (ISPC) +include(CheckCompilerFlag) + +check_compiler_flag(ISPC "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid ISPC compile flag didn't fail.") +endif() + +check_compiler_flag(ISPC "--woff" SHOULD_WORK) +if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_ISPC_COMPILER_ID} compiler flag '--woff' check failed") +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake new file mode 100644 index 0000000..e9344ca --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake @@ -0,0 +1,12 @@ +enable_language (OBJC) +include(CheckCompilerFlag) + +check_compiler_flag(OBJC "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid OBJC compile flag didn't fail.") +endif() + +check_compiler_flag(OBJC "-Wall" SHOULD_WORK) +if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_OBJC_COMPILER_ID} compiler flag '-Wall' check failed") +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake new file mode 100644 index 0000000..503a1de --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake @@ -0,0 +1,12 @@ +enable_language (OBJCXX) +include(CheckCompilerFlag) + +check_compiler_flag(OBJCXX "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid OBJCXX compile flag didn't fail.") +endif() + +check_compiler_flag(OBJCXX "-Wall" SHOULD_WORK) +if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_OBJCXX_COMPILER_ID} compiler flag '-Wall' check failed") +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-result.txt b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt new file mode 100644 index 0000000..89d0565 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CheckCompilerFlag\.cmake:[0-9]+ \(message\): + check_compiler_flag: FAKE_LANG: unknown language. diff --git a/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage.cmake b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage.cmake new file mode 100644 index 0000000..0741953 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage.cmake @@ -0,0 +1,3 @@ + +include(CheckCompilerFlag) +check_compiler_flag(FAKE_LANG "int main() {return 0;}" SHOULD_BUILD) diff --git a/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-result.txt b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt new file mode 100644 index 0000000..23dd4a1 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CheckCompilerFlag\.cmake:[0-9]+ \(message\): + check_compiler_flag: C: needs to be enabled before use. diff --git a/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage.cmake b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage.cmake new file mode 100644 index 0000000..14769a2 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage.cmake @@ -0,0 +1,3 @@ + +include(CheckCompilerFlag) +check_compiler_flag(C "int main() {return 0;}" SHOULD_BUILD) diff --git a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake new file mode 100644 index 0000000..7a4e2ce --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake @@ -0,0 +1,24 @@ +include(RunCMake) + +run_cmake(NotEnabledLanguage) +run_cmake(NonExistentLanguage) + +run_cmake(CheckCCompilerFlag) +run_cmake(CheckCXXCompilerFlag) + +if (APPLE) + run_cmake(CheckOBJCCompilerFlag) + run_cmake(CheckOBJCXXCompilerFlag) +endif() + +if (CMAKE_Fortran_COMPILER_ID) + run_cmake(CheckFortranCompilerFlag) +endif() + +if (CMake_TEST_CUDA) + run_cmake(CheckCUDACompilerFlag) +endif() + +if(CMake_TEST_ISPC) + run_cmake(CheckISPCCompilerFlag) +endif() diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake new file mode 100644 index 0000000..84d6dd9 --- /dev/null +++ b/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake @@ -0,0 +1,3 @@ + +set (CHECK_LANGUAGE CUDA) +include ("${CMAKE_CURRENT_SOURCE_DIR}/CheckLinkerFlag.cmake") diff --git a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake index 224a2a3..6ec9148 100644 --- a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake @@ -12,3 +12,7 @@ endif() if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU") run_cmake(CheckFortranLinkerFlag) endif() + +if (CMake_TEST_CUDA) + run_cmake(CheckCUDALinkerFlag) +endif() diff --git a/Tests/RunCMake/CheckModules/CMakeLists.txt b/Tests/RunCMake/CheckModules/CMakeLists.txt index 9872df2..842c5cf 100644 --- a/Tests/RunCMake/CheckModules/CMakeLists.txt +++ b/Tests/RunCMake/CheckModules/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 2.8.12) cmake_policy(SET CMP0054 NEW) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckSourceCompiles/CMakeLists.txt b/Tests/RunCMake/CheckSourceCompiles/CMakeLists.txt new file mode 100644 index 0000000..0421e28 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake new file mode 100644 index 0000000..cf46189 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake @@ -0,0 +1,13 @@ + +enable_language (C) +include(CheckSourceCompiles) + +check_source_compiles(C "I don't build" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid C source didn't fail.") +endif() + +check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid C source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake new file mode 100644 index 0000000..1e6e6b2 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake @@ -0,0 +1,27 @@ + +enable_language (CUDA) +include(CheckSourceCompiles) + +check_source_compiles(CUDA "I don't build" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid CUDA source didn't fail.") +endif() + +check_source_compiles(CUDA [=[ + #include <vector> + __device__ int d_func() { } + int main() { + return 0; + } +]=] + SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid CUDA source.") +endif() + +check_source_compiles(CUDA "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}" + SHOULD_BUILD_COMPLEX) + +if(NOT SHOULD_BUILD_COMPLEX) + message(SEND_ERROR "Test fail for valid CUDA complex source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake new file mode 100644 index 0000000..ec01d42 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake @@ -0,0 +1,26 @@ + +enable_language (CXX) +include(CheckSourceCompiles) + +check_source_compiles(CXX "I don't build" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid CXX source didn't fail.") +endif() + +check_source_compiles(CXX [=[ + #include <vector> + int main() { + return 0; + } +]=] + SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid CXX source.") +endif() + +check_source_compiles(CXX "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}" + SHOULD_BUILD_COMPLEX) + +if(NOT SHOULD_BUILD_COMPLEX) + message(SEND_ERROR "Test fail for valid CXX complex source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake new file mode 100644 index 0000000..1d4e16d --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake @@ -0,0 +1,14 @@ + + +enable_language (Fortran) +include(CheckSourceCompiles) + +check_source_compiles(Fortran [=[ + PROGRAM TEST_HAVE_PRINT + PRINT *, 'Hello' + END +]=] SHOULD_BUILD) + +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid Fortran source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake new file mode 100644 index 0000000..74b83c0 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake @@ -0,0 +1,20 @@ + +enable_language (ISPC) +include(CheckSourceCompiles) + +check_source_compiles(ISPC "I don't build" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid ISPC source didn't fail.") +endif() + +check_source_compiles(ISPC [=[ + +float func(uniform int32, float a) +{ + return a / 2.25; +} +]=] + SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid ISPC source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake new file mode 100644 index 0000000..2f53cfc4 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake @@ -0,0 +1,14 @@ +enable_language (OBJC) +include(CheckSourceCompiles) + +check_source_compiles(OBJC [[ + #import <Foundation/Foundation.h> + int main() { + NSObject *foo; + return 0; + } +]] SHOULD_BUILD) + +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid OBJC source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake new file mode 100644 index 0000000..805d513 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake @@ -0,0 +1,17 @@ +enable_language (OBJCXX) +include(CheckSourceCompiles) + +check_source_compiles(OBJCXX [[ + #include <vector> + #import <Foundation/Foundation.h> + int main() { + std::vector<int> v; + NSObject *foo; + return 0; + } +]] SHOULD_BUILD) + + +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for OBJCXX source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage-result.txt b/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage-stderr.txt b/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage-stderr.txt new file mode 100644 index 0000000..bf2ea82 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CheckSourceCompiles\.cmake:[0-9]+ \(message\): + check_source_compiles: FAKE_LANG: unknown language. diff --git a/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage.cmake b/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage.cmake new file mode 100644 index 0000000..fc7de06 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/NonExistentLanguage.cmake @@ -0,0 +1,3 @@ + +include(CheckSourceCompiles) +check_source_compiles(FAKE_LANG "int main() {return 0;}" SHOULD_BUILD) diff --git a/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage-result.txt b/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage-stderr.txt b/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage-stderr.txt new file mode 100644 index 0000000..ebc983a --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CheckSourceCompiles\.cmake:[0-9]+ \(message\): + check_source_compiles: C: needs to be enabled before use. diff --git a/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage.cmake b/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage.cmake new file mode 100644 index 0000000..dec0db3 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/NotEnabledLanguage.cmake @@ -0,0 +1,3 @@ + +include(CheckSourceCompiles) +check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD) diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake new file mode 100644 index 0000000..6e9088f --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake @@ -0,0 +1,25 @@ +include(RunCMake) + +run_cmake(NotEnabledLanguage) +run_cmake(NonExistentLanguage) +run_cmake(UnknownArgument) + +run_cmake(CheckCSourceCompiles) +run_cmake(CheckCXXSourceCompiles) + +if (APPLE) + run_cmake(CheckOBJCSourceCompiles) + run_cmake(CheckOBJCXXSourceCompiles) +endif() + +if (CMAKE_Fortran_COMPILER_ID) + run_cmake(CheckFortranSourceCompiles) +endif() + +if (CMake_TEST_CUDA) + run_cmake(CheckCUDASourceCompiles) +endif() + +if(CMake_TEST_ISPC) + run_cmake(CheckISPCSourceCompiles) +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-result.txt b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-stderr.txt b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-stderr.txt new file mode 100644 index 0000000..eed581a --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/Modules/CheckSourceCompiles.cmake:[0-9]+ \(message\): + Unknown argument: + + BAD + +Call Stack \(most recent call first\): + UnknownArgument.cmake:[0-9]+ \(check_source_compiles\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckSourceCompiles/UnknownArgument.cmake b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument.cmake new file mode 100644 index 0000000..3b861da --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument.cmake @@ -0,0 +1,5 @@ + +enable_language (C) +include(CheckSourceCompiles) + +check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD SRC_EXT C BAD) diff --git a/Tests/RunCMake/CheckSourceRuns/CMakeLists.txt b/Tests/RunCMake/CheckSourceRuns/CMakeLists.txt new file mode 100644 index 0000000..0421e28 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake new file mode 100644 index 0000000..3029ac2 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake @@ -0,0 +1,13 @@ + +enable_language (C) +include(CheckSourceRuns) + +check_source_runs(C "int main() {return 2;}" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "C check_source_runs succeeded, but should have failed.") +endif() + +check_source_runs(C "int main() {return 0;}" SHOULD_RUN) +if(NOT SHOULD_RUN) + message(SEND_ERROR "C check_source_runs failed for valid C executable.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake new file mode 100644 index 0000000..01e5ac8 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake @@ -0,0 +1,21 @@ + +enable_language (CUDA) +include(CheckSourceRuns) + +check_source_runs(CUDA "int main() {return 2;}" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "CUDA check_source_runs succeeded, but should have failed.") +endif() + +check_source_runs(CUDA +[=[ + #include <vector> + __device__ __host__ void fake_function(); + __host__ int main() { + return 0; + } +]=] + SHOULD_RUN) +if(NOT SHOULD_RUN) + message(SEND_ERROR "CUDA check_source_runs failed for valid CUDA executable.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake new file mode 100644 index 0000000..d47ddda --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake @@ -0,0 +1,20 @@ + +enable_language (CXX) +include(CheckSourceRuns) + +check_source_runs(CXX "int main() {return 2;}" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "CXX check_source_runs succeeded, but should have failed.") +endif() + +check_source_runs(CXX +[=[ + #include <vector> + int main() { + return 0; + } +]=] + SHOULD_RUN) +if(NOT SHOULD_RUN) + message(SEND_ERROR "CXX check_source_runs failed for valid C executable.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake new file mode 100644 index 0000000..2a1fdfe --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake @@ -0,0 +1,14 @@ + + +enable_language (Fortran) +include(CheckSourceRuns) + +check_source_runs(Fortran [=[ + PROGRAM TEST_HAVE_PRINT + PRINT *, 'Hello' + END +]=] SHOULD_BUILD) + +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid Fortran source.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake new file mode 100644 index 0000000..55f28f3 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake @@ -0,0 +1,14 @@ +enable_language (OBJC) +include(CheckSourceRuns) + +check_source_runs(OBJC [[ + #import <Foundation/Foundation.h> + int main() { + NSObject *foo; + return 0; + } +]] SHOULD_BUILD) + +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid OBJC source.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake new file mode 100644 index 0000000..a218acd --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake @@ -0,0 +1,17 @@ +enable_language (OBJCXX) +include(CheckSourceRuns) + +check_source_runs(OBJCXX [[ + #include <vector> + #import <Foundation/Foundation.h> + int main() { + std::vector<int> v; + NSObject *foo; + return 0; + } +]] SHOULD_BUILD) + + +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for OBJCXX source.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage-result.txt b/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage-stderr.txt b/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage-stderr.txt new file mode 100644 index 0000000..08ffc2d --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CheckSourceRuns\.cmake:[0-9]+ \(message\): + check_source_runs: FAKE_LANG: unknown language. diff --git a/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage.cmake b/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage.cmake new file mode 100644 index 0000000..8300740 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/NonExistentLanguage.cmake @@ -0,0 +1,3 @@ + +include(CheckSourceRuns) +check_source_runs(FAKE_LANG "int main() {return 0;}" SHOULD_BUILD) diff --git a/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage-result.txt b/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage-stderr.txt b/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage-stderr.txt new file mode 100644 index 0000000..b590763 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CheckSourceRuns\.cmake:[0-9]+ \(message\): + check_source_runs: C: needs to be enabled before use. diff --git a/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage.cmake b/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage.cmake new file mode 100644 index 0000000..e16cec2 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/NotEnabledLanguage.cmake @@ -0,0 +1,3 @@ + +include(CheckSourceRuns) +check_source_runs(C "int main() {return 0;}" SHOULD_BUILD) diff --git a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake new file mode 100644 index 0000000..c99ac8b --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + +run_cmake(NotEnabledLanguage) +run_cmake(NonExistentLanguage) +run_cmake(UnknownArgument) + +run_cmake(CheckCSourceRuns) +run_cmake(CheckCXXSourceRuns) + +if (APPLE) + run_cmake(CheckOBJCSourceRuns) + run_cmake(CheckOBJCXXSourceRuns) +endif() + +if (CMAKE_Fortran_COMPILER_ID) + run_cmake(CheckFortranSourceRuns) +endif() + +if (CMake_TEST_CUDA) + run_cmake(CheckCUDASourceRuns) +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument-result.txt b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt new file mode 100644 index 0000000..8ae1ea1 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/Modules/CheckSourceRuns.cmake:[0-9]+ \(message\): + Unknown argument: + + BAD + +Call Stack \(most recent call first\): + UnknownArgument.cmake:[0-9]+ \(check_source_runs\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake b/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake new file mode 100644 index 0000000..6e50fa7 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake @@ -0,0 +1,5 @@ + +enable_language (C) +include(CheckSourceRuns) + +check_source_runs(C "int main() {return 0;}" SHOULD_BUILD SRC_EXT C BAD) diff --git a/Tests/RunCMake/CommandLine/.gitattributes b/Tests/RunCMake/CommandLine/.gitattributes new file mode 100644 index 0000000..b0b0588 --- /dev/null +++ b/Tests/RunCMake/CommandLine/.gitattributes @@ -0,0 +1,2 @@ +E_cat_binary_files/binary.obj -text +E_cat_good_binary_cat-stdout.txt -text -whitespace diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt index d2a2831..f6d72a9 100644 --- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -1,7 +1,19 @@ add_custom_command( - OUTPUT output.txt - COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + OUTPUT output1.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output1.txt ) -add_custom_target(CustomTarget ALL DEPENDS output.txt) -add_custom_target(CustomTarget2 ALL DEPENDS output.txt) -add_custom_target(CustomTarget3 ALL DEPENDS output.txt) +add_custom_target(CustomTarget ALL DEPENDS output1.txt) + +add_custom_command( + OUTPUT output2.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output2.txt + ) +add_custom_target(CustomTarget2 ALL DEPENDS output2.txt) + +add_custom_command( + OUTPUT output3.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output3.txt + ) +add_custom_target(CustomTarget3 ALL DEPENDS output3.txt) + +add_custom_target(CustomTargetFail COMMAND DoesNotExist) diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 03286f1..e24e131 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":1}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj b/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj Binary files differnew file mode 100644 index 0000000..73f1749 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj diff --git a/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt b/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt Binary files differnew file mode 100644 index 0000000..0951d85 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt diff --git a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt deleted file mode 100644 index 4729ccb..0000000 --- a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^Files ".*/compare_files/lf" to ".*/compare_files/crlf" are different.$ diff --git a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt deleted file mode 100644 index 8a9ca81..0000000 --- a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^Files "nonexistent_a" to "nonexistent_b" are different.$ diff --git a/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt @@ -0,0 +1 @@ +2 diff --git a/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-stderr.txt new file mode 100644 index 0000000..50d9b03 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E <command> \[arguments\.\.\.\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt new file mode 100644 index 0000000..21e60ee --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt @@ -0,0 +1 @@ +^CMake Error: failed to create link .* no such file or directory diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-stderr.txt new file mode 100644 index 0000000..a334571 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-stderr.txt @@ -0,0 +1 @@ +^failed to create hard link because source path .* does not exist diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake new file mode 100644 index 0000000..5b97aec --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake @@ -0,0 +1,3 @@ +if(${actual_stderr_var} MATCHES "operation not permitted") + unset(msg) +endif() diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-stderr.txt new file mode 100644 index 0000000..a334571 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-stderr.txt @@ -0,0 +1 @@ +^failed to create hard link because source path .* does not exist diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt index fc62914..0fee56c 100644 --- a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt @@ -1,9 +1,20 @@ cmake_minimum_required(VERSION 3.14) project(ExplicitDirs NONE) + add_custom_command( - OUTPUT output.txt - COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + OUTPUT output1.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output1.txt ) -add_custom_target(CustomTarget ALL DEPENDS output.txt) -add_custom_target(CustomTarget2 ALL DEPENDS output.txt) -add_custom_target(CustomTarget3 ALL DEPENDS output.txt) +add_custom_target(CustomTarget ALL DEPENDS output1.txt) + +add_custom_command( + OUTPUT output2.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output2.txt + ) +add_custom_target(CustomTarget2 ALL DEPENDS output2.txt) + +add_custom_command( + OUTPUT output3.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output3.txt + ) +add_custom_target(CustomTarget3 ALL DEPENDS output3.txt) diff --git a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt index f1dafc8..50f7d9d 100644 --- a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt +++ b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt @@ -3,6 +3,7 @@ cmake \[options\] <path-to-source> cmake \[options\] <path-to-existing-build> cmake \[options\] -S <path-to-source> -B <path-to-build> + cmake \[options\] -S <path-to-source> --preset=<preset-name> Specify a source directory to \(re-\)generate a build system for it in the current working directory. Specify an existing build directory to diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 973391d..b23c8c2 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -22,6 +22,7 @@ run_cmake_command(E_compare_files-different-eol ${CMAKE_COMMAND} -E compare_file run_cmake_command(E_compare_files-ignore-eol-same ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf) run_cmake_command(E_compare_files-ignore-eol-empty ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/empty1 ${RunCMake_SOURCE_DIR}/compare_files/empty2) run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E compare_files --ignore-eol nonexistent_a nonexistent_b) +run_cmake_command(E_compare_files-invalid-arguments ${CMAKE_COMMAND} -E compare_files file1.txt file2.txt file3.txt) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg) @@ -66,6 +67,32 @@ run_cmake_command(install-bad-dir run_cmake_command(install-options-to-vars ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-install-options-to-vars --strip --prefix /var/test --config sample --component pack) +run_cmake_command(install-default-dir-permissions-all + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,g=rx,o=rx) +run_cmake_command(install-default-dir-permissions-afew + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,g=rx) +run_cmake_command(install-default-dir-permissions-none + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars) +run_cmake_command(install-default-dir-permissions-invalid-comma1 + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwxg=,x) +run_cmake_command(install-default-dir-permissions-invalid-comma2 + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwxg,=x) +run_cmake_command(install-default-dir-permissions-comma-at-the-end + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,) +run_cmake_command(install-default-dir-permissions-invalid-assignment + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,=x) +run_cmake_command(install-default-dir-permissions-assignment-at-the-end + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,g=) +run_cmake_command(install-default-dir-permissions-assignment-at-the-beginning + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions =u=rwx,g=rx) run_cmake_command(cache-bad-entry ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/) @@ -134,6 +161,8 @@ function(run_BuildDir) ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build -t CustomTarget2 --target CustomTarget3) + run_cmake_command(BuildDir--build-multiple-targets-fail ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -t CustomTargetFail --target CustomTarget3) run_cmake_command(BuildDir--build-multiple-targets-jobs ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget CustomTarget2 -j2 --target CustomTarget3) run_cmake_command(BuildDir--build-multiple-targets-with-clean-first ${CMAKE_COMMAND} -E chdir .. @@ -319,6 +348,42 @@ run_cmake_command(E_create_symlink-no-replace-dir ${CMAKE_COMMAND} -E create_symlink T . ) +#create hard link tests +run_cmake_command(E_create_hardlink-no-arg + ${CMAKE_COMMAND} -E create_hardlink + ) + +set(dir ${RunCMake_BINARY_DIR}/hardlink_tests) +file(REMOVE_RECURSE "${dir}") +file(MAKE_DIRECTORY ${dir}) + +run_cmake_command(E_create_hardlink-non-existent-source + ${CMAKE_COMMAND} -E create_hardlink ${dir}/I_dont_exist ${dir}/link + ) + +file(TOUCH ${dir}/1) + +run_cmake_command(E_create_hardlink-ok + ${CMAKE_COMMAND} -E create_hardlink ${dir}/1 ${dir}/1-link + ) + +run_cmake_command(E_create_hardlink-no-directory + ${CMAKE_COMMAND} -E create_hardlink ${dir}/1 ${dir}/a/1-link + ) + +#On Windows, if the user does not have sufficient privileges +#don't fail this test +set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +run_cmake_command(E_create_hardlink-unresolved-symlink-prereq + ${CMAKE_COMMAND} -E create_symlink ${dir}/1 ${dir}/1-symlink + ) +file(REMOVE ${dir}/1) + +run_cmake_command(E_create_hardlink-unresolved-symlink + ${CMAKE_COMMAND} -E create_hardlink ${dir}/1-symlink ${dir}/1s-link + ) +unset(RunCMake_DEFAULT_stderr) + set(in ${RunCMake_SOURCE_DIR}/copy_input) set(out ${RunCMake_BINARY_DIR}/copy_output) file(REMOVE_RECURSE "${out}") @@ -498,6 +563,9 @@ run_cmake_command(E_cat_good_cat ${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/unicode_file.txt") unset(out) +run_cmake_command(E_cat_good_binary_cat + ${CMAKE_COMMAND} -E cat "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj" "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj") + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) @@ -714,15 +782,15 @@ function(run_llvm_rc) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc) run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test") - run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp -- ${CMAKE_COMMAND} -E echo "This is a test") - run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -P FailedProgram.cmake -- ${CMAKE_COMMAND} -E echo "This is a test") - run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -P FailedProgram.cmake ) + run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ++ ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -P FailedProgram.cmake ++ ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -P FailedProgram.cmake ) if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp) message(SEND_ERROR "${test} - FAILED:\n" "test.tmp was not deleted") endif() file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir") - run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E copy test.tmp SOURCE_DIR/llvmrc.result ) + run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -E copy test.tmp SOURCE_DIR/llvmrc.result ) if(EXISTS ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/test.tmp) message(SEND_ERROR "${test} - FAILED:\n" "test.tmp was not deleted") diff --git a/Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake b/Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake new file mode 100644 index 0000000..42ef745 --- /dev/null +++ b/Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake @@ -0,0 +1,3 @@ +if(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS) + message("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}") +endif() diff --git a/Tests/RunCMake/interface_library/genex_link-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/interface_library/genex_link-result.txt +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-result.txt diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt new file mode 100644 index 0000000..42f4b3f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt @@ -0,0 +1 @@ +CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is OWNER_READ;OWNER_WRITE;OWNER_EXECUTE;GROUP_READ;GROUP_EXECUTE diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt new file mode 100644 index 0000000..813d9c3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt @@ -0,0 +1 @@ +CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is OWNER_READ;OWNER_WRITE;OWNER_EXECUTE;GROUP_READ;GROUP_EXECUTE;WORLD_READ;WORLD_EXECUTE diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt new file mode 100644 index 0000000..6680932 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt @@ -0,0 +1 @@ +CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is OWNER_READ;OWNER_WRITE;OWNER_EXECUTE diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.py b/Tests/RunCMake/CommandLine/trace-json-v1-check.py index e617b76..1ee005e 100755 --- a/Tests/RunCMake/CommandLine/trace-json-v1-check.py +++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.py @@ -56,7 +56,7 @@ with open(trace_file, 'r') as fp: assert sorted(vers.keys()) == ['version'] assert sorted(vers['version'].keys()) == ['major', 'minor'] assert vers['version']['major'] == 1 - assert vers['version']['minor'] == 0 + assert vers['version']['minor'] == 1 for i in fp.readlines(): line = json.loads(i) diff --git a/Tests/RunCMake/CompatibleInterface/CMakeLists.txt b/Tests/RunCMake/CompatibleInterface/CMakeLists.txt index f452db1..ebab7a3 100644 --- a/Tests/RunCMake/CompatibleInterface/CMakeLists.txt +++ b/Tests/RunCMake/CompatibleInterface/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake index 0196611..64b52d9 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.3) project(CompatibleInterface) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake index 5772856..f072eb0 100644 --- a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake @@ -5,5 +5,5 @@ add_library(bar UNKNOWN IMPORTED) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING INCLUDE_DIRECTORIES) add_executable(user main.cpp) -set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES bar_inc) +set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/bar_inc) target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompilerArgs/C.cmake b/Tests/RunCMake/CompilerArgs/C.cmake new file mode 100644 index 0000000..96b004b --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/C.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.c) diff --git a/Tests/RunCMake/interface_library/CMakeLists.txt b/Tests/RunCMake/CompilerArgs/CMakeLists.txt index 12cd3c7..18dfd26 100644 --- a/Tests/RunCMake/interface_library/CMakeLists.txt +++ b/Tests/RunCMake/CompilerArgs/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.2) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerArgs/CXX.cmake b/Tests/RunCMake/CompilerArgs/CXX.cmake new file mode 100644 index 0000000..3d2ee00 --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/CXX.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/CompilerArgs/FindCCompiler.cmake b/Tests/RunCMake/CompilerArgs/FindCCompiler.cmake new file mode 100644 index 0000000..aeaaf7f --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/FindCCompiler.cmake @@ -0,0 +1,2 @@ +enable_language(C) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/C_comp.cmake" "set(temp_CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerArgs/FindCXXCompiler.cmake b/Tests/RunCMake/CompilerArgs/FindCXXCompiler.cmake new file mode 100644 index 0000000..663ac83 --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/FindCXXCompiler.cmake @@ -0,0 +1,2 @@ +enable_language(CXX) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CXX_comp.cmake" "set(temp_CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerArgs/RunCMakeTest.cmake b/Tests/RunCMake/CompilerArgs/RunCMakeTest.cmake new file mode 100644 index 0000000..9e5a18a --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/RunCMakeTest.cmake @@ -0,0 +1,58 @@ +include(RunCMake) + +function(find_compiler lang) + # Detect the compiler in use in the current environment. + run_cmake(Find${lang}Compiler) + # Use the detected compiler + include(${RunCMake_BINARY_DIR}/Find${lang}Compiler-build/${lang}_comp.cmake) + if(NOT temp_CMAKE_${lang}_COMPILER) + message(FATAL_ERROR "FindCompiler provided no compiler!") + endif() + # Create a toolchain file + set(__test_compiler_var CMAKE_${lang}_COMPILER) + set(__test_compiler "${temp_CMAKE_${lang}_COMPILER}") + configure_file(${RunCMake_SOURCE_DIR}/toolchain.cmake.in + ${RunCMake_BINARY_DIR}/Find${lang}Compiler-build/toolchain_${lang}_comp.cmake @ONLY) +endfunction() + +function(run_compiler_env lang) + # Use the correct compiler + include(${RunCMake_BINARY_DIR}/Find${lang}Compiler-build/${lang}_comp.cmake) + + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-env-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + # Set the compiler + if(lang STREQUAL "C") + set(ENV{CC} "'${temp_CMAKE_${lang}_COMPILER}' -DFOO1 -DFOO2") + else() + set(ENV{${lang}} "'${temp_CMAKE_${lang}_COMPILER}' -DFOO1 -DFOO2") + endif() + + run_cmake(${lang}) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) +endfunction() + +function(run_compiler_tc lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-tc-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(RunCMake_TEST_OPTIONS + -DCMAKE_TOOLCHAIN_FILE=${RunCMake_BINARY_DIR}/Find${lang}Compiler-build/toolchain_${lang}_comp.cmake) + run_cmake(${lang}) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) +endfunction() + +set(langs C CXX) + +foreach(lang ${langs}) + find_compiler(${lang}) + run_compiler_env(${lang}) + run_compiler_tc(${lang}) +endforeach() diff --git a/Tests/RunCMake/CompilerArgs/main.c b/Tests/RunCMake/CompilerArgs/main.c new file mode 100644 index 0000000..b526135 --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/main.c @@ -0,0 +1,10 @@ +#ifndef FOO1 +# error Missing FOO1 +#endif +#ifndef FOO2 +# error Missing FOO2 +#endif +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/CompilerArgs/main.cxx b/Tests/RunCMake/CompilerArgs/main.cxx new file mode 100644 index 0000000..db90e93 --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/main.cxx @@ -0,0 +1,10 @@ +#ifndef FOO1 +# error Missing FOO1 +#endif +#ifndef FOO2 +# error Missing FOO2 +#endif +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/CompilerArgs/toolchain.cmake.in b/Tests/RunCMake/CompilerArgs/toolchain.cmake.in new file mode 100644 index 0000000..ff77639 --- /dev/null +++ b/Tests/RunCMake/CompilerArgs/toolchain.cmake.in @@ -0,0 +1 @@ +set(@__test_compiler_var@ "@__test_compiler@" -DFOO1 -DFOO2) diff --git a/Tests/RunCMake/CompilerChange/CMakeLists.txt b/Tests/RunCMake/CompilerChange/CMakeLists.txt index b4b3016..14c47ad 100644 --- a/Tests/RunCMake/CompilerChange/CMakeLists.txt +++ b/Tests/RunCMake/CompilerChange/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) if(NOT RunCMake_TEST) set(RunCMake_TEST "$ENV{RunCMake_TEST}") # needed when cache is deleted endif() diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake new file mode 100644 index 0000000..a6e576e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake @@ -0,0 +1,8 @@ +enable_language(ISPC) +enable_language(CXX) +set(CMAKE_VERBOSE_MAKEFILE TRUE) + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_ISPC_FLAGS "--arch=x86") +endif() +add_executable(main main.cxx test.ispc) diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake new file mode 100644 index 0000000..4afd919 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake @@ -0,0 +1 @@ +include(ISPC-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake new file mode 100644 index 0000000..f50fb65 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(ISPC-env.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake new file mode 100644 index 0000000..b0cafbe --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(ISPC.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/ISPC.cmake b/Tests/RunCMake/CompilerLauncher/ISPC.cmake new file mode 100644 index 0000000..83efa80 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/ISPC.cmake @@ -0,0 +1,2 @@ +set(CMAKE_ISPC_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +include(ISPC-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index 69fff20..293d711 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -29,6 +29,9 @@ endif() if(CMake_TEST_Fortran) list(APPEND langs Fortran) endif() +if(CMake_TEST_ISPC) + list(APPEND langs ISPC) +endif() if(CMake_TEST_OBJC) list(APPEND langs OBJC OBJCXX) endif() diff --git a/Tests/RunCMake/CompilerLauncher/test.ispc b/Tests/RunCMake/CompilerLauncher/test.ispc new file mode 100644 index 0000000..b061f40 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/test.ispc @@ -0,0 +1,4 @@ + +float func(float a, float b) { + return a + b / 2.; +} diff --git a/Tests/RunCMake/CompilerNotFound/CMakeLists.txt b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/CompilerNotFound/CMakeLists.txt +++ b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Configure/CMakeLists.txt b/Tests/RunCMake/Configure/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/Configure/CMakeLists.txt +++ b/Tests/RunCMake/Configure/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/DependencyGraph/CMakeLists.txt b/Tests/RunCMake/DependencyGraph/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake b/Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake new file mode 100644 index 0000000..4954bc4 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake @@ -0,0 +1,40 @@ +enable_language(C) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY out) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY out) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY out) + +add_library(SharedTop SHARED mylib.c) +add_library(StaticTop STATIC mylib.c) +add_library(StaticMiddle STATIC mylib.c) + +add_library(StaticNone STATIC mylib.c) +add_library(StaticPreBuild STATIC mylib.c) +add_library(StaticPreLink STATIC mylib.c) +add_library(StaticPostBuild STATIC mylib.c) +add_library(StaticCc STATIC mylibcc.c) + +add_custom_command(TARGET StaticPreBuild PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E true) +add_custom_command(TARGET StaticPreLink PRE_LINK + COMMAND ${CMAKE_COMMAND} -E true) +add_custom_command(TARGET StaticPostBuild POST_BUILD + COMMAND ${CMAKE_COMMAND} -E true) +add_custom_command(OUTPUT mylibcc.c + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/mylib.c ${CMAKE_BINARY_DIR}/mylibcc.c) + +target_link_libraries(SharedTop PRIVATE StaticMiddle) +target_link_libraries(StaticTop PRIVATE StaticMiddle) +target_link_libraries(StaticMiddle PRIVATE StaticNone StaticPreBuild StaticPreLink StaticPostBuild StaticCc) + +if(OPTIMIZE_TOP) + set_target_properties(SharedTop StaticTop PROPERTIES + OPTIMIZE_DEPENDENCIES TRUE) +endif() +if(OPTIMIZE_MIDDLE) + set_target_properties(StaticMiddle PROPERTIES + OPTIMIZE_DEPENDENCIES TRUE) +endif() + +include(WriteTargets.cmake) +write_targets() diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake new file mode 100644 index 0000000..1020cb3 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake @@ -0,0 +1,5 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${FortranTop_TARGET_FILE} + ${FortranBottom_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake new file mode 100644 index 0000000..581fd46 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake @@ -0,0 +1 @@ +include(OptimizeFortranCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake new file mode 100644 index 0000000..5c7e8cd --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${FortranTop_TARGET_FILE} + ${CMiddle_TARGET_FILE} + ${FortranBottom_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake new file mode 100644 index 0000000..581fd46 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake @@ -0,0 +1 @@ +include(OptimizeFortranCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake new file mode 100644 index 0000000..5c7e8cd --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${FortranTop_TARGET_FILE} + ${CMiddle_TARGET_FILE} + ${FortranBottom_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake new file mode 100644 index 0000000..581fd46 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake @@ -0,0 +1 @@ +include(OptimizeFortranCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake new file mode 100644 index 0000000..1020cb3 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake @@ -0,0 +1,5 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${FortranTop_TARGET_FILE} + ${FortranBottom_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake new file mode 100644 index 0000000..581fd46 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake @@ -0,0 +1 @@ +include(OptimizeFortranCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake new file mode 100644 index 0000000..354d3fc --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake @@ -0,0 +1,25 @@ +enable_language(C) +enable_language(Fortran) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY out) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY out) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY out) + +add_library(FortranTop STATIC mylib.f90) +add_library(CMiddle STATIC mylib.c) +add_library(FortranBottom STATIC mylib.f90) + +target_link_libraries(FortranTop PRIVATE CMiddle) +target_link_libraries(CMiddle PRIVATE FortranBottom) + +if(OPTIMIZE_TOP) + set_target_properties(FortranTop PROPERTIES + OPTIMIZE_DEPENDENCIES TRUE) +endif() +if(OPTIMIZE_MIDDLE) + set_target_properties(CMiddle PROPERTIES + OPTIMIZE_DEPENDENCIES TRUE) +endif() + +include(WriteTargets.cmake) +write_targets() diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake new file mode 100644 index 0000000..312de04 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake @@ -0,0 +1,11 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${SharedTop_TARGET_FILE} + ${SharedTop_TARGET_LINKER_FILE} + ${StaticMiddle_TARGET_FILE} + ${StaticNone_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake new file mode 100644 index 0000000..312de04 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake @@ -0,0 +1,11 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${SharedTop_TARGET_FILE} + ${SharedTop_TARGET_LINKER_FILE} + ${StaticMiddle_TARGET_FILE} + ${StaticNone_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake new file mode 100644 index 0000000..312de04 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake @@ -0,0 +1,11 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${SharedTop_TARGET_FILE} + ${SharedTop_TARGET_LINKER_FILE} + ${StaticMiddle_TARGET_FILE} + ${StaticNone_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake new file mode 100644 index 0000000..312de04 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake @@ -0,0 +1,11 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${SharedTop_TARGET_FILE} + ${SharedTop_TARGET_LINKER_FILE} + ${StaticMiddle_TARGET_FILE} + ${StaticNone_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake new file mode 100644 index 0000000..5222ed7 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake @@ -0,0 +1,8 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${StaticTop_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake new file mode 100644 index 0000000..5cba223 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake @@ -0,0 +1,10 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${StaticTop_TARGET_FILE} + ${StaticMiddle_TARGET_FILE} + ${StaticNone_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake new file mode 100644 index 0000000..5cba223 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake @@ -0,0 +1,10 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${StaticTop_TARGET_FILE} + ${StaticMiddle_TARGET_FILE} + ${StaticNone_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake new file mode 100644 index 0000000..5222ed7 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake @@ -0,0 +1,8 @@ +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +check_files(${RunCMake_TEST_BINARY_DIR}/out + ${StaticTop_TARGET_FILE} + ${StaticPreBuild_TARGET_FILE} + ${StaticPreLink_TARGET_FILE} + ${StaticPostBuild_TARGET_FILE} + ${StaticCc_TARGET_FILE} + ) diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake new file mode 100644 index 0000000..c150e62 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake @@ -0,0 +1 @@ +include(OptimizeCommon.cmake) diff --git a/Tests/RunCMake/DependencyGraph/Property.cmake b/Tests/RunCMake/DependencyGraph/Property.cmake new file mode 100644 index 0000000..08fdd2b --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/Property.cmake @@ -0,0 +1,24 @@ +enable_language(C) + +add_library(Unset STATIC mylib.c) + +set(CMAKE_OPTIMIZE_DEPENDENCIES TRUE) +add_library(SetTrue STATIC mylib.c) + +set(CMAKE_OPTIMIZE_DEPENDENCIES FALSE) +add_library(SetFalse STATIC mylib.c) + +get_property(_set TARGET Unset PROPERTY OPTIMIZE_DEPENDENCIES SET) +if(_set) + message(SEND_ERROR "OPTIMIZE_DEPENDENCIES property should not be set on Unset target") +endif() + +get_property(_true TARGET SetTrue PROPERTY OPTIMIZE_DEPENDENCIES) +if(NOT _true STREQUAL "TRUE") + message(SEND_ERROR "OPTIMIZE_DEPENDENCIES property should be TRUE on SetTrue target") +endif() + +get_property(_false TARGET SetFalse PROPERTY OPTIMIZE_DEPENDENCIES) +if(NOT _false STREQUAL "FALSE") + message(SEND_ERROR "OPTIMIZE_DEPENDENCIES property should be FALSE on SetFalse target") +endif() diff --git a/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake b/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake new file mode 100644 index 0000000..cb0d541 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake @@ -0,0 +1,60 @@ +include(RunCMake) + +function(check_files dir) + set(expected ${ARGN}) + list(FILTER expected EXCLUDE REGEX "^$") + list(REMOVE_DUPLICATES expected) + list(SORT expected) + + file(GLOB_RECURSE glob "${dir}/*") + set(actual) + foreach(i IN LISTS glob) + if(NOT i MATCHES "(\\.manifest$)|(\\.exp$)|(\\.tds$)") + list(APPEND actual ${i}) + endif() + endforeach() + list(REMOVE_DUPLICATES actual) + list(SORT actual) + + if(NOT "${expected}" STREQUAL "${actual}") + string(REPLACE ";" "\n " expected_formatted "${expected}") + string(REPLACE ";" "\n " actual_formatted "${actual}") + string(APPEND RunCMake_TEST_FAILED "Actual files did not match expected\nExpected:\n ${expected_formatted}\nActual:\n ${actual_formatted}\n") + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(run_cmake_build name) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}) + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + run_cmake(${name}) + set(RunCMake_TEST_OPTIONS) + run_cmake_command(${name}-build ${CMAKE_COMMAND} + --build ${RunCMake_TEST_BINARY_DIR} + --config Release + --target ${ARGN}) +endfunction() + +function(run_optimize_test name) + set(RunCMake_TEST_OPTIONS) + run_cmake_build(${name}-none ${ARGN}) + set(RunCMake_TEST_OPTIONS -DOPTIMIZE_TOP=TRUE) + run_cmake_build(${name}-top ${ARGN}) + set(RunCMake_TEST_OPTIONS -DOPTIMIZE_MIDDLE=TRUE) + run_cmake_build(${name}-middle ${ARGN}) + set(RunCMake_TEST_OPTIONS -DOPTIMIZE_TOP=TRUE -DOPTIMIZE_MIDDLE=TRUE) + run_cmake_build(${name}-both ${ARGN}) +endfunction() + +run_cmake(Property) + +run_optimize_test(OptimizeShared SharedTop) +run_optimize_test(OptimizeStatic StaticTop) +if(CMAKE_Fortran_COMPILER) + run_optimize_test(OptimizeFortran FortranTop) +endif() diff --git a/Tests/RunCMake/DependencyGraph/WriteTargets.cmake b/Tests/RunCMake/DependencyGraph/WriteTargets.cmake new file mode 100644 index 0000000..e1012c1 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/WriteTargets.cmake @@ -0,0 +1,16 @@ +function(write_targets) + set(_input "") + + get_property(_targets DIRECTORY . PROPERTY BUILDSYSTEM_TARGETS) + foreach(_t IN LISTS _targets) + get_property(_type TARGET "${_t}" PROPERTY TYPE) + if(_type STREQUAL "SHARED_LIBRARY") + string(APPEND _input "set(${_t}_TARGET_FILE [==[$<TARGET_FILE:${_t}>]==])\n") + string(APPEND _input "set(${_t}_TARGET_LINKER_FILE [==[$<TARGET_LINKER_FILE:${_t}>]==])\n") + elseif(_type STREQUAL "STATIC_LIBRARY") + string(APPEND _input "set(${_t}_TARGET_FILE [==[$<TARGET_FILE:${_t}>]==])\n") + endif() + endforeach() + + file(GENERATE OUTPUT target_files.cmake CONTENT "${_input}" CONDITION $<CONFIG:Release>) +endfunction() diff --git a/Tests/RunCMake/DependencyGraph/mylib.c b/Tests/RunCMake/DependencyGraph/mylib.c new file mode 100644 index 0000000..5422fe3 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/mylib.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void mylib(void) +{ +} diff --git a/Tests/RunCMake/DependencyGraph/mylib.f90 b/Tests/RunCMake/DependencyGraph/mylib.f90 new file mode 100644 index 0000000..104768f --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/mylib.f90 @@ -0,0 +1,3 @@ +function mylib_fortran() + mylib_fortran = 42 +end function mylib_fortran diff --git a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt +++ b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/ExcludeFromAll/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake b/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake new file mode 100644 index 0000000..2b4fc89 --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake @@ -0,0 +1,26 @@ +include(RunCMake) + +function(run_single_config_test label config exclude_from_all_value expectation) + set(case single-config) + message("-- Starting ${case} test: ${label}") + set(full_case_name "${case}-build-${config}") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_case_name}/") + run_cmake_with_options(${case} + -DCMAKE_BUILD_TYPE=${config} + -DTOOL_EXCLUDE_FROM_ALL=${exclude_from_all_value}) + set(RunCMake_TEST_NO_CLEAN 1) + include(${RunCMake_TEST_BINARY_DIR}/target_files_${config}.cmake) + run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config ${config}) +endfunction() + +run_single_config_test("explictly not excluded" Debug 0 "should_exist") +run_single_config_test("excluded" Debug 1 "should_not_exist") + +if(RunCMake_GENERATOR MATCHES "^(Xcode|Visual Studio)") + run_cmake(error-on-mixed-config) +else() + run_single_config_test("explicitly not excluded with genex" + Release $<CONFIG:Debug> "should_exist") + run_single_config_test("excluded with genex" + Debug $<CONFIG:Debug> "should_not_exist") +endif() diff --git a/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-result.txt b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt new file mode 100644 index 0000000..6dc785f --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + The EXCLUDE_FROM_ALL property of target "release_only_tool" varies by + configuration. This is not supported by the "[^"]+" diff --git a/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config.cmake b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config.cmake new file mode 100644 index 0000000..6c0ed1d --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "") + +add_executable(release_only_tool main.c) +set_property(TARGET release_only_tool PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:Release>>") diff --git a/Tests/RunCMake/ExcludeFromAll/main.c b/Tests/RunCMake/ExcludeFromAll/main.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/main.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/ExcludeFromAll/single-config-build-check.cmake b/Tests/RunCMake/ExcludeFromAll/single-config-build-check.cmake new file mode 100644 index 0000000..1c455f2 --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/single-config-build-check.cmake @@ -0,0 +1,17 @@ +if(expectation STREQUAL "should_not_exist") + set(should_exist FALSE) +elseif(expectation STREQUAL "should_exist") + set(should_exist TRUE) +else() + message(FATAL_ERROR "Encountered unknown expectation: ${expectation}") +endif() + +if(EXISTS "${TARGET_FILE_tool_${config}}") + if(NOT should_exist) + message(FATAL_ERROR "${TARGET_FILE_tool_${config}} should not exist.") + endif() +else() + if(should_exist) + message(FATAL_ERROR "${TARGET_FILE_tool_${config}} should exist.") + endif() +endif() diff --git a/Tests/RunCMake/ExcludeFromAll/single-config.cmake b/Tests/RunCMake/ExcludeFromAll/single-config.cmake new file mode 100644 index 0000000..aa49c21 --- /dev/null +++ b/Tests/RunCMake/ExcludeFromAll/single-config.cmake @@ -0,0 +1,7 @@ +enable_language(C) +add_executable(tool main.c) +set_property(TARGET tool PROPERTY EXCLUDE_FROM_ALL "${TOOL_EXCLUDE_FROM_ALL}") + +file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/target_files_$<CONFIG>.cmake" CONTENT [[ +set(TARGET_FILE_tool_$<CONFIG> [==[$<TARGET_FILE:tool>]==]) +]]) diff --git a/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt b/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt +++ b/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalData/CMakeLists.txt b/Tests/RunCMake/ExternalData/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/ExternalData/CMakeLists.txt +++ b/Tests/RunCMake/ExternalData/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake index 38683f1..bfed4fa 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake @@ -1,4 +1,9 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +else() + cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake index 264c3f0..039dec6 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake @@ -1,4 +1,9 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +else() + cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt new file mode 100644 index 0000000..3188910 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'proj' step 'custom' is marked INDEPENDENT but depends on + step 'configure' that is not marked INDEPENDENT. +Call Stack \(most recent call first\): + BadIndependentStep1.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake b/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake new file mode 100644 index 0000000..c81eb07 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake @@ -0,0 +1,14 @@ +include(ExternalProject) +cmake_policy(SET CMP0114 NEW) + +ExternalProject_Add(proj + SOURCE_DIR "." + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +ExternalProject_Add_Step(proj custom + DEPENDEES configure + INDEPENDENT 1 + ) diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt new file mode 100644 index 0000000..0b87e5e --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'proj' step 'update' is marked INDEPENDENT but depends on + step 'custom' that is not marked INDEPENDENT. +Call Stack \(most recent call first\): + BadIndependentStep2.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake b/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake new file mode 100644 index 0000000..4a530ea --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake @@ -0,0 +1,13 @@ +include(ExternalProject) +cmake_policy(SET CMP0114 NEW) + +ExternalProject_Add(proj + SOURCE_DIR "." + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +ExternalProject_Add_Step(proj custom + DEPENDERS update + ) diff --git a/Tests/RunCMake/ExternalProject/CMakeLists.txt b/Tests/RunCMake/ExternalProject/CMakeLists.txt index c585733..933a57a 100644 --- a/Tests/RunCMake/ExternalProject/CMakeLists.txt +++ b/Tests/RunCMake/ExternalProject/CMakeLists.txt @@ -1,3 +1,6 @@ -cmake_minimum_required(VERSION ${CMAKE_VERSION}) +cmake_minimum_required(VERSION 3.18) project(${RunCMake_TEST} NONE) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12 AND NOT RunCMake_TEST STREQUAL "Xcode-CMP0114") + cmake_policy(SET CMP0114 NEW) +endif() include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake b/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake new file mode 100644 index 0000000..d34482d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +ExternalProject_Add(MyProj URL ${SERVER_URL} INACTIVITY_TIMEOUT 2 DOWNLOAD_NO_EXTRACT TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt new file mode 100644 index 0000000..3238147 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt @@ -0,0 +1 @@ +(Timeout was reached)? diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake new file mode 100644 index 0000000..d34482d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +ExternalProject_Add(MyProj URL ${SERVER_URL} INACTIVITY_TIMEOUT 2 DOWNLOAD_NO_EXTRACT TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") diff --git a/Tests/RunCMake/ExternalProject/DownloadServer.py b/Tests/RunCMake/ExternalProject/DownloadServer.py new file mode 100644 index 0000000..63b7fa7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadServer.py @@ -0,0 +1,53 @@ +from http.server import HTTPServer, BaseHTTPRequestHandler +import argparse +import time +import subprocess +import sys +import os +import threading +args = None +outerthread = None + +barrier = threading.Barrier(2) + +class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): + def do_GET(self): + barrier.wait() + self.send_response(200) + self.end_headers() + data = b'D' + + if args.speed_limit: + slow_deadline = time.time()+args.limit_duration + + while time.time() < slow_deadline: + self.wfile.write(data) + if args.speed_limit: + time.sleep(1.1) + + data = data * 100 + self.wfile.write(data) + self.close_connection = True + +def runServer(fileName): + httpd = HTTPServer(('localhost', 0), SimpleHTTPRequestHandler) + with open(fileName,"w") as f: + f.write('http://localhost:{}/test'.format(httpd.socket.getsockname()[1])) + httpd.handle_request() + os.remove(fileName) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('--speed_limit', help='transfer rate limitation', action='store_true',default=False) + parser.add_argument('--limit_duration', help='duration of the transfer rate limitation',default=1, type=float) + parser.add_argument('--file', help='file to write the url to connect to') + parser.add_argument('--subprocess', action='store_true') + args = parser.parse_args() + if not args.subprocess: + subprocess.Popen([sys.executable]+sys.argv+['--subprocess'],stdin=subprocess.DEVNULL, stderr=subprocess.DEVNULL,stdout=subprocess.DEVNULL) + else: + serverThread = threading.Thread(target=runServer,args=(args.file,)) + serverThread.daemon = True + serverThread.start() + barrier.wait(60) + serverThread.join(20) diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt new file mode 100644 index 0000000..c20fd86 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt @@ -0,0 +1 @@ +^[^0] diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake b/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake new file mode 100644 index 0000000..c90b4ba --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +set(source_dir "${CMAKE_CURRENT_BINARY_DIR}/DownloadTimeout") +file(REMOVE_RECURSE "${source_dir}") +file(MAKE_DIRECTORY "${source_dir}") +ExternalProject_Add(MyProj URL "http://cmake.org/invalid_file.tar.gz") diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake index a8dbfea..dbf67eb 100644 --- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake +++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.9) - include(ExternalProject) # Verify COMMAND keyword is recognised after various *_COMMAND options @@ -20,10 +18,6 @@ ExternalProject_Add(multiCommand COMMAND "${CMAKE_COMMAND}" -E echo "install 2" ) -# Workaround for issue 17229 (missing dependency between update and patch steps) -ExternalProject_Add_StepTargets(multiCommand NO_DEPENDS update) -ExternalProject_Add_StepDependencies(multiCommand patch multiCommand-update) - # Force all steps to be re-run by removing timestamps from any previous run ExternalProject_Get_Property(multiCommand STAMP_DIR) file(REMOVE_RECURSE "${STAMP_DIR}") diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-Common.cmake index 57626d6..176e28b 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-Common.cmake @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) include(ExternalProject RESULT_VARIABLE GOO) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt new file mode 100644 index 0000000..c6bf767 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + The 'NO_DEPENDS' option is no longer allowed. It has been superseded by + the per-step 'INDEPENDENT' option. See policy CMP0114. +Call Stack \(most recent call first\): + NO_DEPENDS-CMP0114-NEW-Direct.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake new file mode 100644 index 0000000..7ec1a00 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0114 NEW) +include(ExternalProject) +ExternalProject_Add(BAR SOURCE_DIR . TEST_COMMAND echo test) +ExternalProject_Add_StepTargets(BAR NO_DEPENDS test) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt new file mode 100644 index 0000000..5a5ba89 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt @@ -0,0 +1,16 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'FOO' option 'INDEPENDENT_STEP_TARGETS' is set to + + download;patch;update;configure;build + + but the option is no longer allowed. It has been superseded by the + per-step 'INDEPENDENT' option. See policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-NEW.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake new file mode 100644 index 0000000..9622a60 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 NEW) +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt new file mode 100644 index 0000000..2b0feb6 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt @@ -0,0 +1,61 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake new file mode 100644 index 0000000..c20d443 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 OLD) +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt new file mode 100644 index 0000000..bbf7178 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt @@ -0,0 +1,119 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject 'FOO' option INDEPENDENT_STEP_TARGETS is set to + + download;patch;update;configure;build + + but the option is deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject 'BAR' option INDEPENDENT_STEP_TARGETS is set to + + install + + but the option is deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject target 'BAR' would depend on the targets for step\(s\) + 'test;bar' under policy CMP0114, but this is being left out for + compatibility since the policy is not set. Also, the NO_DEPENDS option is + deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake new file mode 100644 index 0000000..3d9642d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake @@ -0,0 +1,2 @@ +# Policy CMP0114 not set. +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt deleted file mode 100644 index 928d88a..0000000 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt +++ /dev/null @@ -1,36 +0,0 @@ -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "configure" step might break parallel builds -Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "build" step might break parallel builds -Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "install" step might break parallel builds -Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "test" step might break parallel builds -Call Stack \(most recent call first\): - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 0d1da26..598671f 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -1,5 +1,13 @@ +cmake_minimum_required(VERSION 3.12) include(RunCMake) +# We do not contact any remote URLs, but may use a local one. +# Remove any proxy configuration that may change behavior. +unset(ENV{http_proxy}) +unset(ENV{https_proxy}) + +run_cmake(BadIndependentStep1) +run_cmake(BadIndependentStep2) run_cmake(IncludeScope-Add) run_cmake(IncludeScope-Add_Step) run_cmake(NoOptions) @@ -8,12 +16,52 @@ run_cmake(SourceMissing) run_cmake(CMAKE_CACHE_ARGS) run_cmake(CMAKE_CACHE_DEFAULT_ARGS) run_cmake(CMAKE_CACHE_mix) -run_cmake(NO_DEPENDS) +if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12) + run_cmake(NO_DEPENDS-CMP0114-WARN) + run_cmake(NO_DEPENDS-CMP0114-OLD) +endif() +run_cmake(NO_DEPENDS-CMP0114-NEW) +run_cmake(NO_DEPENDS-CMP0114-NEW-Direct) run_cmake(Add_StepDependencies) run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) run_cmake(UsesTerminal) +if(XCODE_VERSION AND XCODE_VERSION VERSION_GREATER_EQUAL 12) + run_cmake(Xcode-CMP0114) +endif() + +macro(check_steps_missing proj) + set(steps "${ARGN}") + foreach(step ${steps}) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/${proj}-${step}-mark) + string(APPEND RunCMake_TEST_FAILED "${proj} '${step}' step ran but should not have\n") + endif() + endforeach() +endmacro() + +macro(check_steps_present proj) + set(steps "${ARGN}") + foreach(step ${steps}) + if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/${proj}-${step}-mark) + string(APPEND RunCMake_TEST_FAILED "${proj} '${step}' step did not run but should have\n") + endif() + endforeach() +endmacro() + +function(run_steps_CMP0114 val) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Steps-CMP0114-${val}-build) + run_cmake(Steps-CMP0114-${val}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Steps-CMP0114-${val}-build-download ${CMAKE_COMMAND} --build . --target proj1-download) + run_cmake_command(Steps-CMP0114-${val}-build-update ${CMAKE_COMMAND} --build . --target proj1-update) + run_cmake_command(Steps-CMP0114-${val}-build-install ${CMAKE_COMMAND} --build . --target proj1-install) + run_cmake_command(Steps-CMP0114-${val}-build-test ${CMAKE_COMMAND} --build . --target proj1-test) +endfunction() +if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12) + run_steps_CMP0114(OLD) +endif() +run_steps_CMP0114(NEW) # Run both cmake and build steps. We always do a clean before the # build to ensure that the download step re-runs each time. @@ -27,6 +75,50 @@ function(__ep_test_with_build testName) run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) endfunction() +find_package(Python3) +function(__ep_test_with_build_with_server testName) + if(NOT Python3_EXECUTABLE) + return() + endif() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_TIMEOUT 20) + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + set(URL_FILE ${RunCMake_BINARY_DIR}/${testName}.url) + if(EXISTS "${URL_FILE}") + file(REMOVE "${URL_FILE}") + endif() + execute_process( + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/DownloadServer.py --file "${URL_FILE}" ${ARGN} + OUTPUT_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt + ERROR_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt + RESULT_VARIABLE result + TIMEOUT 30 + ) + if(NOT result EQUAL 0) + message(FATAL_ERROR "Failed to start download server:\n ${result}") + endif() + + foreach(i RANGE 1 8) + if(EXISTS ${URL_FILE}) + break() + endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${i}) + endforeach() + + if(NOT EXISTS ${URL_FILE}) + message(FATAL_ERROR "Failed to load download server URL from:\n ${URL_FILE}") + endif() + + file(READ ${URL_FILE} SERVER_URL) + message(STATUS "URL : ${URL_FILE} - ${SERVER_URL}") + run_cmake_with_options(${testName} ${CMAKE_COMMAND} -DSERVER_URL=${SERVER_URL} ) + run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + __ep_test_with_build(MultiCommand) set(RunCMake_TEST_OUTPUT_MERGE 1) @@ -38,6 +130,9 @@ set(RunCMake_TEST_OUTPUT_MERGE 0) if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") __ep_test_with_build(LogOutputOnFailure) __ep_test_with_build(LogOutputOnFailureMerged) + __ep_test_with_build(DownloadTimeout) + __ep_test_with_build_with_server(DownloadInactivityTimeout --speed_limit --limit_duration 40) + __ep_test_with_build_with_server(DownloadInactivityResume --speed_limit --limit_duration 1) endif() # We can't test the substitution when using the old MSYS due to diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake new file mode 100644 index 0000000..210edb1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake @@ -0,0 +1,34 @@ +include(ExternalProject) + +ExternalProject_Add(proj0 + SOURCE_DIR "." + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-download-mark + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-configure-mark + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-build-mark + INSTALL_COMMAND "" + ) + +cmake_policy(GET CMP0114 cmp0114) +if(cmp0114 STREQUAL "NEW") + set(step_targets "update;test") + set(independent_step_targets "") +else() + set(step_targets "install;test") + set(independent_step_targets "download;update") +endif() + +ExternalProject_Add(proj1 + DEPENDS proj0 + SOURCE_DIR "." + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-download-mark + UPDATE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-update-mark + PATCH_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-patch-mark + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-configure-mark + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-build-mark + INSTALL_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-install-mark + TEST_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-test-mark + TEST_EXCLUDE_FROM_MAIN 1 # Along with 'STEP_TARGETS test', implies 'STEP_TARGETS install' + UPDATE_DISCONNECTED 1 # Along with 'STEP_TARGETS update', implies 'STEP_TARGETS download' + STEP_TARGETS ${step_targets} + INDEPENDENT_STEP_TARGETS ${independent_step_targets} + ) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake new file mode 100644 index 0000000..1439f02 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download) +check_steps_missing(proj1 update patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake new file mode 100644 index 0000000..c1c9c8f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake @@ -0,0 +1,3 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install) +check_steps_missing(proj1 test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake new file mode 100644 index 0000000..fe256f2 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake @@ -0,0 +1,2 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake new file mode 100644 index 0000000..63e2e1d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download update) +check_steps_missing(proj1 patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake new file mode 100644 index 0000000..9d8e99e --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 NEW) +include(Steps-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake new file mode 100644 index 0000000..1439f02 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download) +check_steps_missing(proj1 update patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake new file mode 100644 index 0000000..c1c9c8f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake @@ -0,0 +1,3 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install) +check_steps_missing(proj1 test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake new file mode 100644 index 0000000..fe256f2 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake @@ -0,0 +1,2 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake new file mode 100644 index 0000000..63e2e1d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download update) +check_steps_missing(proj1 patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake new file mode 100644 index 0000000..0b51ad8 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 OLD) +include(Steps-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt b/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt new file mode 100644 index 0000000..a616185 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set to NEW. In order to support the Xcode "new build + system", this project must be updated to set policy CMP0114 to NEW. + + Since CMake is generating for the Xcode "new build system", + ExternalProject_Add will use policy CMP0114's NEW behavior anyway, but the + generated build system may not match what the project intends. +Call Stack \(most recent call first\): + Xcode-CMP0114.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake b/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake new file mode 100644 index 0000000..5039daa --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake @@ -0,0 +1,2 @@ +include(ExternalProject) +ExternalProject_Add(MyProj SOURCE_DIR .) diff --git a/Tests/RunCMake/FPHSA/CMakeLists.txt b/Tests/RunCMake/FPHSA/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/FPHSA/CMakeLists.txt +++ b/Tests/RunCMake/FPHSA/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FPHSA/FindPseudoRange.cmake b/Tests/RunCMake/FPHSA/FindPseudoRange.cmake new file mode 100644 index 0000000..ad0342c --- /dev/null +++ b/Tests/RunCMake/FPHSA/FindPseudoRange.cmake @@ -0,0 +1,7 @@ +# pseudo find_module + +set(FOOBAR TRUE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PseudoRange REQUIRED_VARS FOOBAR VERSION_VAR PseudoRange_VERSION + HANDLE_VERSION_RANGE) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index 8e39090..28b8570 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -55,3 +55,13 @@ run_cmake(required_and_optional_components) run_cmake(all_optional_components) list(APPEND RunCMake_TEST_OPTIONS "-DUseComponents_REQUIRE_VARS=TRUE") run_cmake(required_components_with_vars) + +# check handling of version range +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=2.3.4.5") +run_cmake(range_ignored) +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudoRange_VERSION=2.0") +run_cmake(range_no-range) +run_cmake(range_1-3) +run_cmake(range_1-2-include) +run_cmake(range_1-2-exclude) +run_cmake(range_3-4) diff --git a/Tests/RunCMake/FPHSA/range_1-2-exclude-result.txt b/Tests/RunCMake/FPHSA/range_1-2-exclude-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_1-2-exclude-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/range_1-2-exclude-stderr.txt b/Tests/RunCMake/FPHSA/range_1-2-exclude-stderr.txt new file mode 100644 index 0000000..8e34630 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_1-2-exclude-stderr.txt @@ -0,0 +1,2 @@ + Could NOT find PseudoRange: Found unsuitable version "2\.0", required range + is "1.0...<2.0" \(found TRUE\) diff --git a/Tests/RunCMake/FPHSA/range_1-2-exclude.cmake b/Tests/RunCMake/FPHSA/range_1-2-exclude.cmake new file mode 100644 index 0000000..0cba368 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_1-2-exclude.cmake @@ -0,0 +1 @@ +find_package(PseudoRange 1.0...<2.0 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/range_1-2-include.cmake b/Tests/RunCMake/FPHSA/range_1-2-include.cmake new file mode 100644 index 0000000..467267f --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_1-2-include.cmake @@ -0,0 +1 @@ +find_package(PseudoRange 1.0...2.0 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/range_1-3.cmake b/Tests/RunCMake/FPHSA/range_1-3.cmake new file mode 100644 index 0000000..f1506c5 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_1-3.cmake @@ -0,0 +1 @@ +find_package(PseudoRange 1.0...3.0 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/range_3-4-result.txt b/Tests/RunCMake/FPHSA/range_3-4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_3-4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/range_3-4-stderr.txt b/Tests/RunCMake/FPHSA/range_3-4-stderr.txt new file mode 100644 index 0000000..8ea19ce --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_3-4-stderr.txt @@ -0,0 +1,2 @@ + Could NOT find PseudoRange: Found unsuitable version "2\.0", required range + is "3.0...4.0" \(found TRUE\) diff --git a/Tests/RunCMake/FPHSA/range_3-4.cmake b/Tests/RunCMake/FPHSA/range_3-4.cmake new file mode 100644 index 0000000..dd19314 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_3-4.cmake @@ -0,0 +1 @@ +find_package(PseudoRange 3.0...4.0 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/range_ignored-stderr.txt b/Tests/RunCMake/FPHSA/range_ignored-stderr.txt new file mode 100644 index 0000000..43f2336 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_ignored-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at .+FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\): + `find_package\(\)` specify a version range but the module Pseudo does not + support this capability. Only the lower endpoint of the range will be + used. diff --git a/Tests/RunCMake/FPHSA/range_ignored.cmake b/Tests/RunCMake/FPHSA/range_ignored.cmake new file mode 100644 index 0000000..ff1ad15 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_ignored.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.0...2.0 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/range_no-range.cmake b/Tests/RunCMake/FPHSA/range_no-range.cmake new file mode 100644 index 0000000..24896b1 --- /dev/null +++ b/Tests/RunCMake/FPHSA/range_no-range.cmake @@ -0,0 +1 @@ +find_package(PseudoRange 1.0 REQUIRED) diff --git a/Tests/RunCMake/FeatureSummary/CMakeLists.txt b/Tests/RunCMake/FeatureSummary/CMakeLists.txt index 72abfc8..74b3ff8 100644 --- a/Tests/RunCMake/FeatureSummary/CMakeLists.txt +++ b/Tests/RunCMake/FeatureSummary/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FetchContent/DirOverrides.cmake b/Tests/RunCMake/FetchContent/DirOverrides.cmake index 50eef16..ad61a00 100644 --- a/Tests/RunCMake/FetchContent/DirOverrides.cmake +++ b/Tests/RunCMake/FetchContent/DirOverrides.cmake @@ -4,18 +4,23 @@ include(FetchContent) FetchContent_Declare( t1 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> <BINARY_DIR> ) FetchContent_Populate(t1) if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedSrc) message(FATAL_ERROR "Saved details SOURCE_DIR override failed") endif() +if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedBin) + message(FATAL_ERROR "Saved details BINARY_DIR override failed") +endif() # Test direct population FetchContent_Populate( t2 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/directSrc - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/directBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> <BINARY_DIR> ) if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/directSrc) message(FATAL_ERROR "Direct details SOURCE_DIR override failed") @@ -44,3 +49,19 @@ FetchContent_Populate( if(IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedNobuildDir-build) message(FATAL_ERROR "Direct details BINARY_DIR override failed") endif() + +# Test overriding the source directory by reusing the one from t1 +set(FETCHCONTENT_SOURCE_DIR_T5 ${CMAKE_CURRENT_BINARY_DIR}/savedSrc) +FetchContent_Declare( + t5 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/doesNotExist + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/wontBeCreated + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E false +) +FetchContent_Populate(t5) +if(NOT "${t5_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc") + message(FATAL_ERROR "Wrong SOURCE_DIR returned: ${t5_SOURCE_DIR}") +endif() +if(NOT "${t5_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/wontBeCreated") + message(FATAL_ERROR "Wrong BINARY_DIR returned: ${t5_BINARY_DIR}") +endif() diff --git a/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake b/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake new file mode 100644 index 0000000..768a82e --- /dev/null +++ b/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake @@ -0,0 +1,18 @@ +include(FetchContent) + +# Test using saved details. We are re-using a SOURCE_DIR from a previous test +# so the download command should not be executed. +FetchContent_Declare( + t1 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E false +) +FetchContent_Populate(t1) + +if(NOT "${t1_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc") + message(FATAL_ERROR "Wrong SOURCE_DIR returned: ${t1_SOURCE_DIR}") +endif() +if(NOT "${t1_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedBin") + message(FATAL_ERROR "Wrong BINARY_DIR returned: ${t1_BINARY_DIR}") +endif() diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectory.cmake b/Tests/RunCMake/FetchContent/ManualSourceDirectory.cmake new file mode 100644 index 0000000..83fcc4b --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectory.cmake @@ -0,0 +1,8 @@ +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/ADirThatDoesNotExist +) + +FetchContent_MakeAvailable(WithProject) diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-result.txt b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-stderr.txt b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-stderr.txt new file mode 100644 index 0000000..7ecb06b --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-stderr.txt @@ -0,0 +1,2 @@ + *Manually specified source directory is missing: ++ *FETCHCONTENT_SOURCE_DIR_WITHPROJECT --> .*/ADirThatDoesNotExist diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing.cmake b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing.cmake new file mode 100644 index 0000000..0e24c1a --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing.cmake @@ -0,0 +1,8 @@ +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject +) + +FetchContent_MakeAvailable(WithProject) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index f3ed3e2..3eb331f 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -10,12 +10,32 @@ run_cmake(DownloadFile) run_cmake(SameGenerator) run_cmake(VarDefinitions) run_cmake(GetProperties) -run_cmake(DirOverrides) run_cmake(UsesTerminalOverride) run_cmake(MakeAvailable) run_cmake(MakeAvailableTwice) run_cmake(MakeAvailableUndeclared) +run_cmake_with_options(ManualSourceDirectory + -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/WithProject" +) +run_cmake_with_options(ManualSourceDirectoryMissing + -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/ADirThatDoesNotExist" +) + +function(run_FetchContent_DirOverrides) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(DirOverrides) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_with_options(DirOverridesDisconnected + -D FETCHCONTENT_FULLY_DISCONNECTED=YES + ) +endfunction() +run_FetchContent_DirOverrides() + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake(PreserveEmptyArgs) set(RunCMake_TEST_OUTPUT_MERGE 0) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index a3dd9ff..c66757f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -12,7 +12,7 @@ def read_codemodel_json_data(filename): def check_objects(o, g): assert is_list(o) assert len(o) == 1 - check_index_object(o[0], "codemodel", 2, 1, check_object_codemodel(g)) + check_index_object(o[0], "codemodel", 2, 2, check_object_codemodel(g)) def check_backtrace(t, b, backtrace): btg = t["backtraceGraph"] @@ -42,6 +42,16 @@ def check_backtrace(t, b, backtrace): assert b is None +def check_backtraces(t, actual, expected): + assert is_list(actual) + assert is_list(expected) + assert len(actual) == len(expected) + + i = 0 + while i < len(actual): + check_backtrace(t, actual[i], expected[i]) + i += 1 + def check_directory(c): def _check(actual, expected): assert is_dict(actual) @@ -421,6 +431,19 @@ def check_target(c): missing_exception=lambda e: "Precompile header: %s" % e["header"], extra_exception=lambda a: "Precompile header: %s" % a["header"]) + if "languageStandard" in expected: + expected_keys.append("languageStandard") + + def check_language_standard(actual, expected): + assert is_dict(actual) + expected_keys = ["backtraces", "standard"] + assert actual["standard"] == expected["standard"] + check_backtraces(obj, actual["backtraces"], expected["backtraces"]) + + assert sorted(actual.keys()) == sorted(expected_keys) + + check_language_standard(actual["languageStandard"], expected["languageStandard"]) + if expected["defines"] is not None: expected_keys.append("defines") @@ -499,6 +522,7 @@ def gen_check_directories(c, g): read_codemodel_json_data("directories/custom.json"), read_codemodel_json_data("directories/cxx.json"), read_codemodel_json_data("directories/imported.json"), + read_codemodel_json_data("directories/interface.json"), read_codemodel_json_data("directories/object.json"), read_codemodel_json_data("directories/dir.json"), read_codemodel_json_data("directories/dir_dir.json"), @@ -544,6 +568,8 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/zero_check_cxx.json"), read_codemodel_json_data("targets/cxx_lib.json"), read_codemodel_json_data("targets/cxx_exe.json"), + read_codemodel_json_data("targets/cxx_standard_compile_feature_exe.json"), + read_codemodel_json_data("targets/cxx_standard_exe.json"), read_codemodel_json_data("targets/cxx_shared_lib.json"), read_codemodel_json_data("targets/cxx_shared_exe.json"), read_codemodel_json_data("targets/cxx_static_lib.json"), @@ -569,6 +595,10 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/link_imported_object_exe.json"), read_codemodel_json_data("targets/link_imported_interface_exe.json"), + read_codemodel_json_data("targets/all_build_interface.json"), + read_codemodel_json_data("targets/zero_check_interface.json"), + read_codemodel_json_data("targets/iface_srcs.json"), + read_codemodel_json_data("targets/all_build_custom.json"), read_codemodel_json_data("targets/zero_check_custom.json"), read_codemodel_json_data("targets/custom_tgt.json"), @@ -592,6 +622,12 @@ def gen_check_targets(c, g, inSource): e["sources"] = precompile_header_data["sources"] e["sourceGroups"] = precompile_header_data["sourceGroups"] + if os.path.exists(os.path.join(reply_dir, "..", "..", "..", "..", "cxx", "cxx_std_11.txt")): + for e in expected: + if e["name"] == "cxx_standard_compile_feature_exe": + language_standard_data = read_codemodel_json_data("targets/cxx_standard_compile_feature_exe_languagestandard.json") + e["compileGroups"][0]["languageStandard"] = language_standard_data["languageStandard"] + if not os.path.exists(os.path.join(reply_dir, "..", "..", "..", "..", "ipo_enabled.txt")): for e in expected: try: @@ -691,6 +727,7 @@ def gen_check_projects(c, g): read_codemodel_json_data("projects/alias.json"), read_codemodel_json_data("projects/object.json"), read_codemodel_json_data("projects/imported.json"), + read_codemodel_json_data("projects/interface.json"), read_codemodel_json_data("projects/custom.json"), read_codemodel_json_data("projects/external.json"), ] diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json index ebe717a..a51b6eb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json @@ -7,6 +7,8 @@ "^ALL_BUILD::@a56b12a3f5c0529fb296$", "^ZERO_CHECK::@a56b12a3f5c0529fb296$", "^cxx_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_exe::@a56b12a3f5c0529fb296$", "^cxx_lib::@a56b12a3f5c0529fb296$", "^cxx_shared_exe::@a56b12a3f5c0529fb296$", "^cxx_shared_lib::@a56b12a3f5c0529fb296$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json new file mode 100644 index 0000000..b10d496 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json @@ -0,0 +1,14 @@ +{ + "source": "^interface$", + "build": "^interface$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@25b7fa8ea00134654b85$", + "^ZERO_CHECK::@25b7fa8ea00134654b85$", + "^iface_srcs::@25b7fa8ea00134654b85$" + ], + "projectName": "Interface", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index c144953..736d1f5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -7,6 +7,7 @@ "^custom$", "^cxx$", "^imported$", + "^interface$", "^object$", "^.*/Tests/RunCMake/FileAPIExternalSource$", "^dir$" diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json index f3aac63..4d0cdc0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json @@ -6,6 +6,7 @@ "Custom", "Cxx", "Imported", + "Interface", "Object", "External" ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json index 296ae6c..363e853 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json @@ -10,6 +10,8 @@ "^ZERO_CHECK::@a56b12a3f5c0529fb296$", "^cxx_lib::@a56b12a3f5c0529fb296$", "^cxx_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_exe::@a56b12a3f5c0529fb296$", "^cxx_shared_lib::@a56b12a3f5c0529fb296$", "^cxx_shared_exe::@a56b12a3f5c0529fb296$", "^cxx_static_lib::@a56b12a3f5c0529fb296$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json new file mode 100644 index 0000000..2a22767 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json @@ -0,0 +1,13 @@ +{ + "name": "Interface", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^interface$" + ], + "targetIds": [ + "^ALL_BUILD::@25b7fa8ea00134654b85$", + "^ZERO_CHECK::@25b7fa8ea00134654b85$", + "^iface_srcs::@25b7fa8ea00134654b85$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json index 92a7944..1f443b1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json @@ -80,6 +80,14 @@ "backtrace": null }, { + "id": "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_standard_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", "backtrace": null }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json new file mode 100644 index 0000000..fa2a6e5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json @@ -0,0 +1,79 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@25b7fa8ea00134654b85$", + "directorySource": "^interface$", + "projectName": "Interface", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^interface$", + "source": "^interface$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@25b7fa8ea00134654b85$", + "backtrace": null + }, + { + "id": "^iface_srcs::@25b7fa8ea00134654b85$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json index b4def78..d023f99 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json @@ -116,6 +116,14 @@ "backtrace": null }, { + "id": "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_standard_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", "backtrace": null }, @@ -168,6 +176,10 @@ "backtrace": null }, { + "id": "^iface_srcs::@25b7fa8ea00134654b85$", + "backtrace": null + }, + { "id": "^custom_exe::@c11385ffed57b860da63$", "backtrace": null }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json index e7ab55b..c9e652b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -119,7 +119,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 37, + "line": 38, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json new file mode 100644 index 0000000..d6d573f --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json @@ -0,0 +1,110 @@ +{ + "name": "cxx_standard_compile_feature_exe", + "id": "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 26, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "languageStandard" : + { + "backtraces": [ + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 27, + "command": "set_property", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + ], + "standard" : "98" + }, + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 26, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_standard_compile_feature_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_compile_feature_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_compile_feature_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json new file mode 100644 index 0000000..0c4eabb --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json @@ -0,0 +1,36 @@ +{ + "languageStandard" : + { + "backtraces": [ + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 29, + "command": "target_compile_features", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 30, + "command": "target_compile_features", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + ], + "standard" : "11" + } +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json new file mode 100644 index 0000000..9cb2832 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json @@ -0,0 +1,110 @@ +{ + "name": "cxx_standard_exe", + "id": "^cxx_standard_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 23, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "languageStandard" : + { + "backtraces": [ + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 24, + "command": "set_property", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + ], + "standard" : "17" + }, + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 23, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_standard_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json new file mode 100644 index 0000000..97d7ccd --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json @@ -0,0 +1,67 @@ +{ + "name": "iface_srcs", + "id": "^iface_srcs::@25b7fa8ea00134654b85$", + "directorySource": "^interface$", + "projectName": "Interface", + "type": "INTERFACE_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": 3, + "command": "add_library", + "hasParent": true + }, + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": 3, + "command": "add_library", + "hasParent": true + }, + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^interface$", + "source": "^interface$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@25b7fa8ea00134654b85$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json index 312f4c5..451e8d4 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 5, + "line": 6, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 5, + "line": 6, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json index 7d0e6df..cbd4346 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 23, + "line": 29, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 23, + "line": 29, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json index 4aec524..d92a810 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 18, + "line": 24, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 18, + "line": 24, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json index f5846ec..1197a73 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 9, + "line": 14, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 9, + "line": 14, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json index 29a1695..42564e0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 13, + "line": 19, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 13, + "line": 19, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json new file mode 100644 index 0000000..fdd4b2a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@25b7fa8ea00134654b85$", + "directorySource": "^interface$", + "projectName": "Interface", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^interface/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^interface$", + "source": "^interface$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index c98a84c..2405954 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -18,6 +18,7 @@ add_subdirectory(cxx) add_subdirectory(alias) add_subdirectory(object) add_subdirectory(imported) +add_subdirectory(interface) add_subdirectory(custom) add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild") add_subdirectory(dir) diff --git a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt index fa51195..76235f5 100644 --- a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt @@ -19,3 +19,14 @@ target_link_options(cxx_exe PUBLIC TargetLinkOptions) target_link_directories(cxx_exe PUBLIC "${CMAKE_BINARY_DIR}/TargetLinkDir") target_precompile_headers(cxx_exe PUBLIC ../empty.h) + +add_executable(cxx_standard_exe ../empty.cxx) +set_property(TARGET cxx_standard_exe PROPERTY CXX_STANDARD 17) + +add_executable(cxx_standard_compile_feature_exe ../empty.cxx) +set_property(TARGET cxx_standard_compile_feature_exe PROPERTY CXX_STANDARD 98) +if(CMAKE_CXX_STANDARD_DEFAULT AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION) + target_compile_features(cxx_standard_compile_feature_exe PRIVATE cxx_std_11) + target_compile_features(cxx_standard_compile_feature_exe PRIVATE cxx_decltype) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_std_11.txt" "") +endif() diff --git a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt index d36d88b..f79d87c 100644 --- a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt @@ -1,15 +1,21 @@ project(Imported) add_library(imported_lib UNKNOWN IMPORTED) +set_target_properties(imported_lib PROPERTIES IMPORTED_LOCATION "imported_unk${CMAKE_STATIC_LIBRARY_SUFFIX}") add_executable(imported_exe IMPORTED) add_executable(link_imported_exe ../empty.c) target_link_libraries(link_imported_exe PRIVATE imported_lib) add_library(imported_shared_lib SHARED IMPORTED) +set_target_properties(imported_shared_lib PROPERTIES + IMPORTED_LOCATION "imported_shared${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "imported_shared${CMAKE_IMPORT_LIBRARY_SUFFIX}" +) add_executable(link_imported_shared_exe ../empty.c) target_link_libraries(link_imported_shared_exe PRIVATE imported_shared_lib) add_library(imported_static_lib STATIC IMPORTED) +set_target_properties(imported_static_lib PROPERTIES IMPORTED_LOCATION "imported_static${CMAKE_STATIC_LIBRARY_SUFFIX}") add_executable(link_imported_static_exe ../empty.c) target_link_libraries(link_imported_static_exe PRIVATE imported_static_lib) diff --git a/Tests/RunCMake/FileAPI/interface/CMakeLists.txt b/Tests/RunCMake/FileAPI/interface/CMakeLists.txt new file mode 100644 index 0000000..97948c5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/interface/CMakeLists.txt @@ -0,0 +1,3 @@ +project(Interface) +add_library(iface_none INTERFACE) +add_library(iface_srcs INTERFACE ../empty.c) diff --git a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake index 2bd0cd8..3908f42 100644 --- a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake @@ -16,3 +16,11 @@ run_cmake(zip-filtered) run_cmake(unsupported-format) run_cmake(zip-with-bad-compression) run_cmake(7zip-with-bad-compression) + +run_cmake(unsupported-compression-level) +run_cmake(argument-validation-compression-level-1) +run_cmake(argument-validation-compression-level-2) +run_cmake(gnutar-gz-compression-level) +run_cmake(pax-xz-compression-level) +run_cmake(pax-zstd-compression-level) +run_cmake(paxr-bz2-compression-level) diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-result.txt b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt new file mode 100644 index 0000000..d7bc79a --- /dev/null +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at compression-level.cmake:39 \(file\): + file compression level 100 should be in range 0 to 9 +Call Stack \(most recent call first\): + argument-validation-compression-level-1.cmake:8 \(check_compression_level\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-1.cmake b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1.cmake new file mode 100644 index 0000000..adedc34 --- /dev/null +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1.cmake @@ -0,0 +1,8 @@ +set(OUTPUT_NAME "test.tar.gz") + +set(ARCHIVE_FORMAT gnutar) +set(COMPRESSION_TYPE GZip) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("100") diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-result.txt b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt new file mode 100644 index 0000000..0f7bd9e --- /dev/null +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at compression-level.cmake:39 \(file\): + file compression level high should be in range 0 to 9 +Call Stack \(most recent call first\): + argument-validation-compression-level-2.cmake:8 \(check_compression_level\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-2.cmake b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2.cmake new file mode 100644 index 0000000..fa6d3fd --- /dev/null +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2.cmake @@ -0,0 +1,8 @@ +set(OUTPUT_NAME "test.tar.gz") + +set(ARCHIVE_FORMAT gnutar) +set(COMPRESSION_TYPE GZip) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("high") diff --git a/Tests/RunCMake/File_Archive/compression-level.cmake b/Tests/RunCMake/File_Archive/compression-level.cmake new file mode 100644 index 0000000..2f5141d --- /dev/null +++ b/Tests/RunCMake/File_Archive/compression-level.cmake @@ -0,0 +1,85 @@ +foreach(parameter OUTPUT_NAME ARCHIVE_FORMAT) + if(NOT DEFINED ${parameter}) + message(FATAL_ERROR "missing required parameter ${parameter}") + endif() +endforeach() + +set(COMPRESS_DIR compress_dir) +set(FULL_COMPRESS_DIR ${CMAKE_CURRENT_BINARY_DIR}/${COMPRESS_DIR}) + +set(DECOMPRESS_DIR decompress_dir) +set(FULL_DECOMPRESS_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DECOMPRESS_DIR}) + +set(FULL_OUTPUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}) + +set(CHECK_FILES + "f1.txt" + "d1/f1.txt" + "d 2/f1.txt" + "d + 3/f1.txt" + "d_4/f1.txt" + "d-4/f1.txt" + "My Special Directory/f1.txt" +) + +function(check_compression_level COMPRESSION_LEVEL) + foreach(file ${CHECK_FILES}) + configure_file(${CMAKE_CURRENT_LIST_FILE} ${FULL_COMPRESS_DIR}/${file} COPYONLY) + endforeach() + + if(UNIX) + execute_process(COMMAND ln -sf f1.txt ${FULL_COMPRESS_DIR}/d1/f2.txt) + list(APPEND CHECK_FILES "d1/f2.txt") + endif() + + file(REMOVE ${FULL_OUTPUT_NAME}) + file(REMOVE_RECURSE ${FULL_DECOMPRESS_DIR}) + file(MAKE_DIRECTORY ${FULL_DECOMPRESS_DIR}) + + file(ARCHIVE_CREATE + OUTPUT ${FULL_OUTPUT_NAME} + FORMAT "${ARCHIVE_FORMAT}" + COMPRESSION "${COMPRESSION_TYPE}" + COMPRESSION_LEVEL ${COMPRESSION_LEVEL} + VERBOSE + PATHS ${COMPRESS_DIR}) + + file(ARCHIVE_EXTRACT + INPUT ${FULL_OUTPUT_NAME} + ${DECOMPRESSION_OPTIONS} + DESTINATION ${FULL_DECOMPRESS_DIR} + VERBOSE) + + if(CUSTOM_CHECK_FILES) + set(CHECK_FILES ${CUSTOM_CHECK_FILES}) + endif() + + foreach(file ${CHECK_FILES}) + set(input ${FULL_COMPRESS_DIR}/${file}) + set(output ${FULL_DECOMPRESS_DIR}/${COMPRESS_DIR}/${file}) + + if(NOT EXISTS ${input}) + message(SEND_ERROR "Cannot find input file ${output}") + endif() + + if(NOT EXISTS ${output}) + message(SEND_ERROR "Cannot find output file ${output}") + endif() + + file(MD5 ${input} input_md5) + file(MD5 ${output} output_md5) + + if(NOT input_md5 STREQUAL output_md5) + message(SEND_ERROR "Files \"${input}\" and \"${output}\" are different") + endif() + endforeach() + + foreach(file ${NOT_EXISTING_FILES_CHECK}) + set(output ${FULL_DECOMPRESS_DIR}/${COMPRESS_DIR}/${file}) + + if(EXISTS ${output}) + message(SEND_ERROR "File ${output} exists but it shouldn't") + endif() + endforeach() + +endfunction() diff --git a/Tests/RunCMake/File_Archive/gnutar-gz-compression-level.cmake b/Tests/RunCMake/File_Archive/gnutar-gz-compression-level.cmake new file mode 100644 index 0000000..4106db5 --- /dev/null +++ b/Tests/RunCMake/File_Archive/gnutar-gz-compression-level.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.gz") + +set(ARCHIVE_FORMAT gnutar) +set(COMPRESSION_TYPE GZip) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("1") +check_compression_level("5") +check_compression_level("9") diff --git a/Tests/RunCMake/File_Archive/pax-xz-compression-level.cmake b/Tests/RunCMake/File_Archive/pax-xz-compression-level.cmake new file mode 100644 index 0000000..d241adb --- /dev/null +++ b/Tests/RunCMake/File_Archive/pax-xz-compression-level.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.xz") + +set(ARCHIVE_FORMAT pax) +set(COMPRESSION_TYPE XZ) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("1") +check_compression_level("5") +check_compression_level("9") diff --git a/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake b/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake new file mode 100644 index 0000000..73fd84d --- /dev/null +++ b/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.zstd") + +set(ARCHIVE_FORMAT pax) +set(COMPRESSION_TYPE Zstd) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("1") +check_compression_level("5") +check_compression_level("9") diff --git a/Tests/RunCMake/File_Archive/paxr-bz2-compression-level.cmake b/Tests/RunCMake/File_Archive/paxr-bz2-compression-level.cmake new file mode 100644 index 0000000..05ea3fc --- /dev/null +++ b/Tests/RunCMake/File_Archive/paxr-bz2-compression-level.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.bz2") + +set(ARCHIVE_FORMAT paxr) +set(COMPRESSION_TYPE BZip2) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("1") +check_compression_level("5") +check_compression_level("9") diff --git a/Tests/RunCMake/File_Archive/roundtrip.cmake b/Tests/RunCMake/File_Archive/roundtrip.cmake index 0638367..4049256 100644 --- a/Tests/RunCMake/File_Archive/roundtrip.cmake +++ b/Tests/RunCMake/File_Archive/roundtrip.cmake @@ -90,3 +90,20 @@ function(check_magic EXPECTED) "Actual [${ACTUAL}] does not match expected [${EXPECTED}]") endif() endfunction() + + +function(check_compression_level COMPRESSION_LEVEL) + file(ARCHIVE_CREATE + OUTPUT "${FULL_OUTPUT_NAME}_compression_level" + FORMAT "${ARCHIVE_FORMAT}" + COMPRESSION_LEVEL ${COMPRESSION_LEVEL} + COMPRESSION "${COMPRESSION_TYPE}" + VERBOSE + PATHS ${COMPRESS_DIR}) + + file(ARCHIVE_EXTRACT + INPUT "${FULL_OUTPUT_NAME}_compression_level" + ${DECOMPRESSION_OPTIONS} + DESTINATION ${FULL_DECOMPRESS_DIR} + VERBOSE) +endfunction() diff --git a/Tests/RunCMake/File_Archive/unsupported-compression-level-result.txt b/Tests/RunCMake/File_Archive/unsupported-compression-level-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/unsupported-compression-level-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/unsupported-compression-level-stderr.txt b/Tests/RunCMake/File_Archive/unsupported-compression-level-stderr.txt new file mode 100644 index 0000000..860b422 --- /dev/null +++ b/Tests/RunCMake/File_Archive/unsupported-compression-level-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at compression-level.cmake:39 \(file\): + file compression level is not supported for compression "None" +Call Stack \(most recent call first\): + unsupported-compression-level.cmake:7 \(check_compression_level\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Archive/unsupported-compression-level.cmake b/Tests/RunCMake/File_Archive/unsupported-compression-level.cmake new file mode 100644 index 0000000..ea06d1d --- /dev/null +++ b/Tests/RunCMake/File_Archive/unsupported-compression-level.cmake @@ -0,0 +1,7 @@ +set(OUTPUT_NAME "test.7z") + +set(ARCHIVE_FORMAT 7zip) + +include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) + +check_compression_level("1") diff --git a/Tests/RunCMake/File_Configure/AngleBracketsContent-stderr.txt b/Tests/RunCMake/File_Configure/AngleBracketsContent-stderr.txt new file mode 100644 index 0000000..08c2ada --- /dev/null +++ b/Tests/RunCMake/File_Configure/AngleBracketsContent-stderr.txt @@ -0,0 +1 @@ +^foo-\$<CONFIG>$ diff --git a/Tests/RunCMake/File_Configure/AngleBracketsContent.cmake b/Tests/RunCMake/File_Configure/AngleBracketsContent.cmake new file mode 100644 index 0000000..04c63bb --- /dev/null +++ b/Tests/RunCMake/File_Configure/AngleBracketsContent.cmake @@ -0,0 +1,6 @@ +file(CONFIGURE + OUTPUT "file.txt" + CONTENT "foo-$<CONFIG>" +) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/file.txt out) +message("${out}") diff --git a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-stderr.txt deleted file mode 100644 index acda654..0000000 --- a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at BadArgGeneratorExpressionContent.cmake:[0-9]+ \(file\): - file CONFIGURE called with CONTENT containing a "<". This character is not - allowed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent.cmake b/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent.cmake deleted file mode 100644 index 75fe9e5..0000000 --- a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(CONFIGURE - OUTPUT "file.txt" - CONTENT "foo-$<CONFIG>" -) diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake index 0337014..e79de79 100644 --- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake @@ -1,7 +1,7 @@ include(RunCMake) +run_cmake(AngleBracketsContent) run_cmake(BadArg) -run_cmake(BadArgGeneratorExpressionContent) run_cmake(BadArgGeneratorExpressionOutput) run_cmake(DirOutput) run_cmake(NewLineStyle-NoArg) diff --git a/Tests/RunCMake/File_Generate/AdjacentInOut.cmake b/Tests/RunCMake/File_Generate/AdjacentInOut.cmake new file mode 100644 index 0000000..828c2ee --- /dev/null +++ b/Tests/RunCMake/File_Generate/AdjacentInOut.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0070 NEW) +if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/AdjacentInOut.txt") + message(FATAL_ERROR "CMake should not re-run during the build!") +endif() +configure_file(AdjacentInOut.in ${CMAKE_CURRENT_BINARY_DIR}/AdjacentInOut.txt.tmp) +file(GENERATE OUTPUT AdjacentInOut.txt INPUT ${CMAKE_CURRENT_BINARY_DIR}/AdjacentInOut.txt.tmp) diff --git a/Tests/RunCMake/File_Generate/AdjacentInOut.in b/Tests/RunCMake/File_Generate/AdjacentInOut.in new file mode 100644 index 0000000..bfbbda7 --- /dev/null +++ b/Tests/RunCMake/File_Generate/AdjacentInOut.in @@ -0,0 +1 @@ +Sample Text File diff --git a/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt b/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt index dbabaa9..a7a231b 100644 --- a/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt +++ b/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt @@ -1,4 +1,18 @@ -^CMake Warning \(dev\) in CMakeLists.txt: +^(CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0070 is not set: Define file\(GENERATE\) behavior for relative + paths. Run "cmake --help-policy CMP0070" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + file\(GENERATE\) given relative OUTPUT path: + + relative-output-WARN.txt + + This is not defined behavior unless CMP0070 is set to NEW. For + compatibility with older versions of CMake, the previous undefined behavior + will be used. +This warning is for project developers. Use -Wno-dev to suppress it. ++)+ +CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0070 is not set: Define file\(GENERATE\) behavior for relative paths. Run "cmake --help-policy CMP0070" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/File_Generate/CMakeLists.txt b/Tests/RunCMake/File_Generate/CMakeLists.txt index bc0cf5d..3178de5 100644 --- a/Tests/RunCMake/File_Generate/CMakeLists.txt +++ b/Tests/RunCMake/File_Generate/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) if(NOT TEST_FILE) set(TEST_FILE ${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/File_Generate/GenerateSource.cmake b/Tests/RunCMake/File_Generate/GenerateSource.cmake index 147a7f6..d5504e3 100644 --- a/Tests/RunCMake/File_Generate/GenerateSource.cmake +++ b/Tests/RunCMake/File_Generate/GenerateSource.cmake @@ -10,3 +10,6 @@ file(GENERATE ) add_executable(mn "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") + +add_subdirectory(GenerateSource) +target_link_libraries(mn PRIVATE ObjLib) diff --git a/Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt b/Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt new file mode 100644 index 0000000..bca8922 --- /dev/null +++ b/Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(ObjLib OBJECT) + +target_sources(ObjLib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/ObjLib.cpp") + +# Ensure re-generation +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/ObjLib.cpp") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ObjLib.cpp" CONTENT "") diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 94aaca8..48fb71c 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -4,6 +4,10 @@ run_cmake(CMP0070-NEW) run_cmake(CMP0070-OLD) run_cmake(CMP0070-WARN) +run_cmake(SourceProperty) +run_cmake(SourceProperty-CMP0070-NEW) +run_cmake(SourceProperty-CMP0070-OLD) + run_cmake(CommandConflict) if(RunCMake_GENERATOR_IS_MULTI_CONFIG) run_cmake(OutputConflict) @@ -29,6 +33,13 @@ foreach(l CXX C) endif() endforeach() +run_cmake(Target) +file(READ "${RunCMake_BINARY_DIR}/Target-build/sub1/output.txt" sub_1) +file(READ "${RunCMake_BINARY_DIR}/Target-build/sub2/output.txt" sub_2) +if(NOT sub_1 MATCHES "first" OR NOT sub_2 MATCHES "second") + message(SEND_ERROR "Wrong target used by TARGET argument! ${sub_1} ${sub_2}") +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") @@ -72,6 +83,7 @@ if (UNIX AND EXISTS /bin/sh) if (NOT script_output STREQUAL SUCCESS) message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}") endif() + unset(RunCMake_TEST_NO_CLEAN) endif() if (RunCMake_GENERATOR MATCHES Makefiles) @@ -104,3 +116,10 @@ if (RunCMake_GENERATOR MATCHES Makefiles) message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") endif() endif() + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdjacentInOut-build) +run_cmake(AdjacentInOut) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(AdjacentInOut-nowork ${CMAKE_COMMAND} --build .) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-result.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt new file mode 100644 index 0000000..2c385c4 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at SourceProperty-CMP0070-NEW.cmake:[0-9]+ \(add_library\): + Cannot find source file: + +.*\/relative-output-NEW\.c + + Tried extensions \.c \.C.* +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake new file mode 100644 index 0000000..d2b3e0c --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake @@ -0,0 +1,8 @@ +enable_language(C) +add_library(foo) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT relative-output-NEW.c CONTENT "") +target_sources(foo PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/relative-output-NEW.c" +) diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-result.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt new file mode 100644 index 0000000..fcb53a7 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt @@ -0,0 +1,23 @@ +^CMake Deprecation Warning at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0070 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(add_library\): + Cannot find source file: + +.*\/relative-output-OLD\.c + + Tried extensions \.c \.C.* +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake new file mode 100644 index 0000000..48eae1e --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake @@ -0,0 +1,8 @@ +enable_language(C) +add_library(foo) + +cmake_policy(SET CMP0070 OLD) +file(GENERATE OUTPUT relative-output-OLD.c CONTENT "") +target_sources(foo PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/relative-output-OLD.c" +) diff --git a/Tests/RunCMake/File_Generate/SourceProperty-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-stderr.txt new file mode 100644 index 0000000..47ec651 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at SourceProperty.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0070 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Generate/SourceProperty.cmake b/Tests/RunCMake/File_Generate/SourceProperty.cmake new file mode 100644 index 0000000..231c670 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty.cmake @@ -0,0 +1,14 @@ +enable_language(C) +add_library(SourceProperty) + +cmake_policy(SET CMP0070 OLD) +file(GENERATE OUTPUT relative-output-OLD.c CONTENT "") +target_sources(SourceProperty PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/relative-output-OLD.c" +) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT relative-output-NEW.c CONTENT "") +target_sources(SourceProperty PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/relative-output-NEW.c" +) diff --git a/Tests/RunCMake/File_Generate/Target.cmake b/Tests/RunCMake/File_Generate/Target.cmake new file mode 100644 index 0000000..16e8457 --- /dev/null +++ b/Tests/RunCMake/File_Generate/Target.cmake @@ -0,0 +1,2 @@ +add_subdirectory(sub1) +add_subdirectory(sub2) diff --git a/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt b/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt new file mode 100644 index 0000000..34c51a4 --- /dev/null +++ b/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(library IMPORTED STATIC) +set_property(TARGET library PROPERTY COMPILE_DEFINITIONS "first") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.txt" + CONTENT "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" + TARGET library +) diff --git a/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt b/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt new file mode 100644 index 0000000..09b81ac --- /dev/null +++ b/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(library IMPORTED STATIC) +set_property(TARGET library PROPERTY COMPILE_DEFINITIONS "second") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.txt" + CONTENT "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" + TARGET library +) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt new file mode 100644 index 0000000..68d23d4 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0072-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0072 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/FindPkgConfig/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt index 72abfc8..74b3ff8 100644 --- a/Tests/RunCMake/FindPkgConfig/CMakeLists.txt +++ b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake index fc3a766..aa293d5 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake @@ -20,7 +20,7 @@ endif() unset(FOO_MODULE_NAME) -# verify variable get's also set on subsequent run +# verify variable gets also set on subsequent run pkg_search_module(FOO REQUIRED foo bletch bar) if(NOT FOO_MODULE_NAME STREQUAL "bletch") diff --git a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake index 5f5f7f5..2bdf913 100644 --- a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake @@ -2,3 +2,6 @@ include(RunCMake) run_cmake(components) run_cmake(missing-components) +run_cmake(version) +run_cmake(version-exact) +run_cmake(version-range) diff --git a/Tests/RunCMake/FindSWIG/version-exact.cmake b/Tests/RunCMake/FindSWIG/version-exact.cmake new file mode 100644 index 0000000..ec3651f --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version-exact.cmake @@ -0,0 +1,17 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +find_package (SWIG) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +set (version ${SWIG_VERSION}) + +find_package (SWIG ${SWIG_VERSION} EXACT) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version ${version} EXACT") +endif() diff --git a/Tests/RunCMake/FindSWIG/version-range.cmake b/Tests/RunCMake/FindSWIG/version-range.cmake new file mode 100644 index 0000000..7ba1134 --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version-range.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +find_package (SWIG) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +## Specify a range including current SWIG version +string (REGEX MATCH "^([0-9]+)" upper_version "${SWIG_VERSION}") +math (EXPR upper_version "${upper_version} + 1") + +find_package (SWIG 1.0...${upper_version}.0) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version range 1.0...${upper_version}.0") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +## Specify a range excluding current SWIG version +set (range 1.0...<${SWIG_VERSION}) +find_package (SWIG ${range}) +if (SWIG_FOUND) + message (FATAL_ERROR "Unexpectedly find SWIG with version range ${range}") +endif() diff --git a/Tests/RunCMake/FindSWIG/version.cmake b/Tests/RunCMake/FindSWIG/version.cmake new file mode 100644 index 0000000..a4f1c39 --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +find_package (SWIG 1.0) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version 1.0") +endif() diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-Debian-stderr.txt new file mode 100644 index 0000000..546fb5c --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt-Debian-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Opt' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='lib' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin' +CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt' +CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include' +CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/lib' +CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run/opt/Opt' +CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt new file mode 100644 index 0000000..25f80d3 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='usr/bin' +CMAKE_INSTALL_DATADIR='usr/share' +CMAKE_INSTALL_DATAROOTDIR='usr/share' +CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' +CMAKE_INSTALL_INCLUDEDIR='usr/include' +CMAKE_INSTALL_INFODIR='usr/share/info' +CMAKE_INSTALL_LIBDIR='usr/lib' +CMAKE_INSTALL_LIBEXECDIR='usr/libexec' +CMAKE_INSTALL_LOCALEDIR='usr/share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='usr/share/man' +CMAKE_INSTALL_SBINDIR='usr/sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/lib' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake index eb2c1a2..529e10a 100644 --- a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -4,6 +4,8 @@ if(SYSTEM_NAME STREQUAL "FreeBSD") set(variant "-FreeBSD") elseif(SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$") set(variant "-BSD") +elseif(EXISTS "/etc/debian_version") + set(variant "-Debian") else() set(variant "") endif() diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-Debian-stderr.txt new file mode 100644 index 0000000..89578ee --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr-Debian-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Usr' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='lib/arch' +CMAKE_INSTALL_LIBEXECDIR='lib/arch' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/lib/arch' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/lib/arch' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt new file mode 100644 index 0000000..30795c8 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='lib' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/local/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/usr/local/var/run' +CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$ diff --git a/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/COMPILE_LANGUAGE-TARGET_PROPERTY.cmake b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/COMPILE_LANGUAGE-TARGET_PROPERTY.cmake new file mode 100644 index 0000000..293ddda --- /dev/null +++ b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/COMPILE_LANGUAGE-TARGET_PROPERTY.cmake @@ -0,0 +1,17 @@ +enable_language(C) + +add_library (lib SHARED empty.c) +set_target_properties(lib PROPERTIES + INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:C>:/usr/include>" + COMPILE_DEFINITIONS "$<$<COMPILE_LANGUAGE:C>:DEF>" + COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:C>:-O>") + +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:lib,INCLUDE_DIRECTORIES> + $<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS> + $<TARGET_PROPERTY:lib,COMPILE_OPTIONS>) + +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:lib,INCLUDE_DIRECTORIES> + $<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS> + $<TARGET_PROPERTY:lib,COMPILE_OPTIONS>) diff --git a/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake index 6691fdf..15a5e79 100644 --- a/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) run_cmake(COMPILE_LANGUAGE-unknown-lang) +run_cmake(COMPILE_LANGUAGE-TARGET_PROPERTY) diff --git a/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake new file mode 100644 index 0000000..6a718d6 --- /dev/null +++ b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake @@ -0,0 +1,17 @@ +enable_language(C) + +add_library (lib SHARED empty.c) +set_target_properties(lib PROPERTIES + INCLUDE_DIRECTORIES "$<$<COMPILE_LANG_AND_ID:C,GNU>:/usr/include>" + COMPILE_DEFINITIONS "$<$<COMPILE_LANG_AND_ID:C,GNU>:DEF>" + COMPILE_OPTIONS "$<$<COMPILE_LANG_AND_ID:C,GNU>:-O>") + +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:lib,INCLUDE_DIRECTORIES> + $<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS> + $<TARGET_PROPERTY:lib,COMPILE_OPTIONS>) + +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:lib,INCLUDE_DIRECTORIES> + $<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS> + $<TARGET_PROPERTY:lib,COMPILE_OPTIONS>) diff --git a/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake index a0a7bb9..68bd05d 100644 --- a/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(COMPILE_LANG_AND_ID-add_executable) run_cmake(COMPILE_LANG_AND_ID-add_library) run_cmake(COMPILE_LANG_AND_ID-add_test) run_cmake(COMPILE_LANG_AND_ID-unknown-lang) +run_cmake(COMPILE_LANG_AND_ID-TARGET_PROPERTY) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake index ccec633..55b0f9b 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake @@ -2,8 +2,10 @@ include(RunCMake) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) -run_cmake(TARGET_FILE_PREFIX) +run_cmake(TARGET_FILE_DIR-dependency) +run_cmake(TARGET_FILE_DIR-no-dependency) run_cmake(TARGET_FILE_PREFIX-imported-target) +run_cmake(TARGET_FILE_PREFIX) run_cmake(TARGET_FILE_PREFIX-non-valid-target) run_cmake(TARGET_LINKER_FILE_PREFIX-non-valid-target) run_cmake(TARGET_FILE_SUFFIX) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt new file mode 100644 index 0000000..0a79032 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt @@ -0,0 +1,6 @@ +.*Policy CMP0112 is not set.* +.*Dependency being added to target.* +.*exec1.* +CMake Error: The inter-target dependency graph.* +.*"exec1" of type EXECUTABLE + depends on "copyFile" \(strong\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake new file mode 100644 index 0000000..e18ccd9 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake @@ -0,0 +1,12 @@ +set(CMAKE_POLICY_WARNING_CMP0112 TRUE) + +enable_language (C) + +add_executable (exec1 empty.c) + +add_custom_target(copyFile + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" + "$<TARGET_FILE_DIR:exec1>/$<TARGET_FILE_BASE_NAME:exec1>_e.c" +) +add_dependencies(exec1 copyFile) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake new file mode 100644 index 0000000..e048e10 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0112 NEW) + +enable_language (C) + +add_executable (exec1 empty.c) + +add_custom_target(copyFile + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" + "$<TARGET_FILE_DIR:exec1>/$<TARGET_FILE_BASE_NAME:exec1>_e.c" +) +add_dependencies(exec1 copyFile) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index b3977f1..5a5a7bf 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -26,7 +26,7 @@ function(run_GEH) endforeach() endfunction() -# remove these flags from the enviornment if they have been set +# remove these flags from the environment if they have been set # so the tests run the correct env set(env_cxx_flags $ENV{CXXFLAGS}) if(env_cxx_flags) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 42dd0ce..130de2b 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -10,15 +10,6 @@ Call Stack \(most recent call first\): CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Error evaluating generator expression: - \$<CONFIG:Foo,Bar> - - \$<CONFIG> expression requires one or zero parameters. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): - Error evaluating generator expression: - \$<CONFIG:Foo-Bar> Expression syntax not recognized. diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake index 5c22aaa..1735ab7 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -1,6 +1,5 @@ add_custom_target(check ALL COMMAND check $<CONFIG:.> - $<CONFIG:Foo,Bar> $<CONFIG:Foo-Bar> $<$<CONFIG:Foo-Nested>:foo> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake new file mode 100644 index 0000000..b43256b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CONFIG-empty-entries-generated.txt" content) + +set(expected "1234") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake new file mode 100644 index 0000000..a4d53f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0070 NEW) + +set(text) +string(APPEND text "$<$<CONFIG:>:1>") +string(APPEND text "$<$<CONFIG:Release,>:2>") +string(APPEND text "$<$<CONFIG:,Release>:3>") +string(APPEND text "$<$<CONFIG:Release,,Debug>:4>") +string(APPEND text "$<$<CONFIG:Release,Debug>:5>") +file(GENERATE OUTPUT CONFIG-empty-entries-generated.txt CONTENT ${text}) diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake new file mode 100644 index 0000000..66f42c7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CONFIG-multiple-entries-generated.txt" content) + +set(expected "14") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake new file mode 100644 index 0000000..6829282 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0070 NEW) + +set(text) +string(APPEND text "$<$<CONFIG:CustomConfig>:1>") +string(APPEND text "$<$<CONFIG:Release>:2>") +string(APPEND text "$<$<CONFIG:Debug,Release>:3>") +string(APPEND text "$<$<CONFIG:Release,CustomConfig,Debug>:4>") +file(GENERATE OUTPUT CONFIG-multiple-entries-generated.txt CONTENT "${text}") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 0278cf6..6349112 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -12,6 +12,7 @@ run_cmake(BadTargetTypeInterface) run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) run_cmake(BadSHELL_PATH) +run_cmake(BadCONFIG) run_cmake(CMP0044-WARN) run_cmake(NonValidTarget-C_COMPILER_ID) run_cmake(NonValidTarget-CXX_COMPILER_ID) @@ -44,6 +45,19 @@ run_cmake(FILTER-InvalidOperator) run_cmake(FILTER-Exclude) run_cmake(FILTER-Include) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_CONFIGURATION_TYPES=CustomConfig]==]) +else() + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_BUILD_TYPE=CustomConfig]==]) +endif() +run_cmake(CONFIG-multiple-entries) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_CONFIGURATION_TYPES=]==]) +else() + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_BUILD_TYPE=]==]) +endif() +run_cmake(CONFIG-empty-entries) + set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) run_cmake(CMP0085-OLD) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake new file mode 100644 index 0000000..ecf7bfe --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake @@ -0,0 +1,17 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/out.txt" content) + +unset(RunCMake_TEST_FAILED) + +if (NOT content MATCHES "(INCLUDES1:${RunCMake_TEST_SOURCE_DIR}/include)") + string(APPEND RunCMake_TEST_FAILED "wrong content for INCLUDES1: \"${CMAKE_MATCH_1}\"\n") +endif() + +if (NOT content MATCHES "(INCLUDES2:><)") + string(APPEND RunCMake_TEST_FAILED "wrong content for INCLUDES2: \"${CMAKE_MATCH_1}\"\n") +endif() +if (NOT content MATCHES "(INCLUDES3:><)") + string(APPEND RunCMake_TEST_FAILED "wrong content for INCLUDES3: \"${CMAKE_MATCH_1}\"\n") +endif() +if (NOT content MATCHES "(CUSTOM:>;;<)") + string(APPEND RunCMake_TEST_FAILED "wrong content for CUSTOM: \"${CMAKE_MATCH_1}\"\n") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake index cb6f4d8..e9855be 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake @@ -14,5 +14,10 @@ target_include_directories(foo3 PUBLIC $<TARGET_PROPERTY:foo2,INCLUDE_DIRECTORIE add_library(foo4 STATIC empty.c) target_include_directories(foo4 PUBLIC $<TARGET_PROPERTY:foo3,INCLUDE_DIRECTORIES>) +add_library (foo5 SHARED empty.c) +set_property(TARGET foo5 PROPERTY INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:CUDA>:/include/CUDA>" "$<$<COMPILE_LANGUAGE:Fortran>:/include/Fortran>") +set_property(TARGET foo5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:CUDA>:/include/CUDA>" "$<$<COMPILE_LANGUAGE:Fortran>:/include/Fortran>") +set_property(TARGET foo5 PROPERTY CUSTOM ";;") + # Evaluate a genex that looks up INCLUDE_DIRECTORIES on multiple targets. -file(GENERATE OUTPUT out.txt CONTENT "$<TARGET_PROPERTY:foo4,INCLUDE_DIRECTORIES>") +file(GENERATE OUTPUT out.txt CONTENT "INCLUDES1:$<TARGET_PROPERTY:foo4,INCLUDE_DIRECTORIES>\nINCLUDES2:>$<TARGET_PROPERTY:foo5,INTERFACE_INCLUDE_DIRECTORIES><\nINCLUDES3:>$<TARGET_PROPERTY:foo5,INCLUDE_DIRECTORIES><\nCUSTOM:>$<TARGET_PROPERTY:foo5,CUSTOM><\n") diff --git a/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt index 5737e95..a86bd02 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt @@ -3,8 +3,4 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): .* - does not recognize the toolset - - Test Toolset,host=x6[45] - - that was specified\.$ + given toolset specification that contains invalid field 'host'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt new file mode 100644 index 0000000..5e88e3b --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Xcode + + toolset specification field + + buildsystem=bad + + value is unkonwn. It must be '1' or '12'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt new file mode 100644 index 0000000..cdfae3e --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Xcode + + toolset specification field + + buildsystem=12 + + is not allowed with Xcode [0-9.]+\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/CMakeLists.txt b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/GeneratorToolset/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index bb22841..5f12d79 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -54,6 +54,21 @@ elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") run_cmake(TestToolset) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(BadToolsetHostArchXcode) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=bad") + run_cmake(BadToolsetXcodeBuildSystem) + if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault12) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=1") + run_cmake(TestToolsetXcodeBuildSystem1) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=12") + run_cmake(TestToolsetXcodeBuildSystem12) + else() + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault1) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=12") + run_cmake(BadToolsetXcodeBuildSystem12) + endif() else() set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") run_cmake(BadToolset) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt new file mode 100644 index 0000000..817467b --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystem1.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset,buildsystem=1" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt new file mode 100644 index 0000000..cba95ce --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='1' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake new file mode 100644 index 0000000..550a6a1 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset,buildsystem=1") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset,buildsystem=1\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset,buildsystem=1\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt new file mode 100644 index 0000000..9352faf --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystem12.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset,buildsystem=12" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt new file mode 100644 index 0000000..df49a31 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='12' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake new file mode 100644 index 0000000..7e30e43 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset,buildsystem=12") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset,buildsystem=12\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset,buildsystem=12\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt new file mode 100644 index 0000000..0adbd0c --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystemDefault1.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt new file mode 100644 index 0000000..cba95ce --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='1' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake new file mode 100644 index 0000000..645bb19 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt new file mode 100644 index 0000000..1d43537 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystemDefault12.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt new file mode 100644 index 0000000..df49a31 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='12' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake new file mode 100644 index 0000000..645bb19 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTestXML-special-result-check.cmake b/Tests/RunCMake/GoogleTest/GoogleTestXML-special-result-check.cmake new file mode 100644 index 0000000..fea0a6b --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTestXML-special-result-check.cmake @@ -0,0 +1,28 @@ +set(RESULT_FILES + "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/cases.case/0.xml" + "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/cases.case/1.xml" + "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/cases.case/2.xml" +) + +# Check result files exist +foreach(file ${RESULT_FILES}) + if(NOT EXISTS ${file}) + if(NOT ${RunCMake_TEST_FAILED} STREQUAL "") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n") + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}Result XML file ${file} was not created") + endif() +endforeach() + +# and no other xml files are created +file(GLOB_RECURSE file_list "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/*/*.xml" LIST_DIRECTORIES false) + +foreach(file ${file_list}) + list(FIND RESULT_FILES "${file}" idx) + if(-1 EQUAL ${idx}) + if(NOT ${RunCMake_TEST_FAILED} STREQUAL "") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n") + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}Invalid file ${file} was created") + endif() +endforeach() diff --git a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake index 29bd05e..fb91c0e 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake @@ -3,6 +3,17 @@ include(GoogleTest) enable_testing() +# This creates the folder structure for the paramterized tests +# to avoid handling missing folders in C++ +# +# This must match the match the name defined in xml_output.cpp +# for every instance of tests with GetParam. +# +# The folder name is created fom the test name (output of the line +# without leading spaces: "GoogleTestXMLSpecial/cases.") and +# the parts until the last slash ("case/"). These parts are concatenated. +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/GoogleTestXMLSpecial/cases.case") + add_executable(xml_output xml_output.cpp) gtest_discover_tests( xml_output diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index efd22be..530c8ab 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -101,6 +101,13 @@ function(run_GoogleTestXML DISCOVERY_MODE) -R GoogleTestXML --no-label-summary ) + + run_cmake_command(GoogleTestXML-special-result + ${CMAKE_CTEST_COMMAND} + -C Debug + -R GoogleTestXMLSpecial + --no-label-summary + ) endfunction() function(run_GoogleTest_discovery_timeout DISCOVERY_MODE) diff --git a/Tests/RunCMake/GoogleTest/xml_output.cpp b/Tests/RunCMake/GoogleTest/xml_output.cpp index e130231..82f0d02 100644 --- a/Tests/RunCMake/GoogleTest/xml_output.cpp +++ b/Tests/RunCMake/GoogleTest/xml_output.cpp @@ -13,11 +13,22 @@ int main(int argc, char** argv) // This actually defines the name of the file passed in the 2nd run std::cout << "GoogleTestXML." << std::endl; std::cout << " Foo" << std::endl; + // When changing these names, make sure to adapt the folder creation + // in GoogleTestXML.cmake + std::cout << "GoogleTestXMLSpecial/cases." << std::endl; + std::cout << " case/0 # GetParam() = 42" << std::endl; + std::cout << " case/1 # GetParam() = \"string\"" << std::endl; + std::cout << " case/2 # GetParam() = \"path/like\"" << std::endl; } else if (param.find("--gtest_output=xml:") != std::string::npos) { std::string::size_type split = param.find(":"); std::string filepath = param.substr(split + 1); // The full file path is passed std::ofstream ostrm(filepath.c_str(), std::ios::binary); + if (!ostrm) { + std::cerr << "Failed to create file: " << filepath.c_str() + << std::endl; + return 1; + } ostrm << "--gtest_output=xml: mockup file\n"; } } diff --git a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake index 10cd2bc..2c7d5bf 100644 --- a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake +++ b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake @@ -9,6 +9,7 @@ # - All library depend on a common INTERFACE library holding compiler flags # - We have a custom target to generate a man page # - Someone has added an UNKNOWN, IMPORTED crypto mining library! +# - We have a circular dependency between two libraries add_subdirectory(test_project/third_party_project) @@ -23,6 +24,13 @@ target_link_libraries(CoreLibrary PUBLIC CompilerFlags) target_link_libraries(CoreLibrary PRIVATE SeriousLoggingLibrary) +add_library(SystemLibrary STATIC test_project/system_library.c) + +# Create a circular dependency. +# See https://gitlab.kitware.com/cmake/cmake/issues/20720 +target_link_libraries(CoreLibrary PRIVATE SystemLibrary) +target_link_libraries(SystemLibrary PRIVATE CoreLibrary) + add_library(GraphicLibraryObjects OBJECT test_project/graphic_library.c) add_library(GraphicLibrary SHARED) @@ -52,7 +60,10 @@ target_link_libraries(ConsoleApplication CoreLibrary) # No one will ever notice... add_library(CryptoCurrencyMiningLibrary UNKNOWN IMPORTED) +set_target_properties(CryptoCurrencyMiningLibrary PROPERTIES IMPORTED_LOCATION "cryptomining${CMAKE_STATIC_LIBRARY_SUFFIX}") target_link_libraries(ConsoleApplication CryptoCurrencyMiningLibrary) add_custom_target(GenerateManPage COMMAND ${CMAKE_COMMAND} --version) add_dependencies(ConsoleApplication GenerateManPage) + +add_subdirectory(sub_directory_target) diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot index 8b0365a..a9e664a 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot @@ -28,25 +28,29 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GenerateManPage", shape = box ]; - "node1" -> "node5" // ConsoleApplication -> GenerateManPage - "node6" [ label = "GraphicApplication", shape = egg ]; - "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node8" [ label = "\"-lm\"", shape = septagon ]; - "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" - "node7" -> "node0" // GraphicLibrary -> CompilerFlags - "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GenerateManPage", shape = box ]; + "node1" -> "node6" // ConsoleApplication -> GenerateManPage + "node7" [ label = "GraphicApplication", shape = egg ]; + "node7" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node8" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node9" [ label = "\"-lm\"", shape = septagon ]; + "node8" -> "node9" [ style = dotted ] // GraphicLibrary -> "-lm" + "node8" -> "node0" // GraphicLibrary -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node10" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node8" -> "node10" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node7" -> "node8" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node11" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node12" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node12" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node12" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node13" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot index 1bbf25a..06cdb75 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot @@ -28,23 +28,27 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot index 1bbf25a..06cdb75 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot @@ -28,23 +28,27 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot index 558a470..7f2e01c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot @@ -27,18 +27,21 @@ subgraph clusterLegend { "node1" -> "node0" // CoreLibrary -> CompilerFlags "node2" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node1" -> "node2" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary - "node3" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node4" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" [ label = "\"-lm\"", shape = septagon ]; - "node4" -> "node5" [ style = dotted ] // GraphicLibrary -> "-lm" - "node4" -> "node0" // GraphicLibrary -> CompilerFlags - "node4" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node4" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node7" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node7" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node8" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node3" [ label = "SystemLibrary", shape = octagon ]; + "node3" -> "node1" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node1" -> "node3" [ style = dotted ] // CoreLibrary -> SystemLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" + "node5" -> "node0" // GraphicLibrary -> CompilerFlags + "node5" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot index 660af37..490450e 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot @@ -28,19 +28,23 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "GraphicApplication", shape = egg ]; - "node4" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" -> "node0" // GraphicLibrary -> CompilerFlags - "node5" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node7" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node7" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot index 5af7fec..086c849 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot @@ -28,8 +28,12 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "\"-lm\"", shape = septagon ]; + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node7" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot index 94ec41c..350f0f1 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot @@ -24,20 +24,24 @@ subgraph clusterLegend { } "node0" [ label = "ConsoleApplication", shape = egg ]; "node1" [ label = "CoreLibrary", shape = octagon ]; + "node2" [ label = "SystemLibrary", shape = octagon ]; + "node2" -> "node1" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node1" -> "node2" [ style = dotted ] // CoreLibrary -> SystemLibrary "node0" -> "node1" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node2" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node0" -> "node2" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node3" [ label = "GraphicApplication", shape = egg ]; - "node3" -> "node1" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node4" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" [ label = "\"-lm\"", shape = septagon ]; - "node4" -> "node5" [ style = dotted ] // GraphicLibrary -> "-lm" - "node4" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node4" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node3" -> "node4" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node7" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node8" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node3" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node0" -> "node3" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node4" [ label = "GraphicApplication", shape = egg ]; + "node4" -> "node1" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" + "node5" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot index 65b7a71..fd351d0 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot @@ -28,17 +28,21 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot index 8116bc9..39a2a03 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot @@ -28,21 +28,25 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node11" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot index 1bbf25a..06cdb75 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot @@ -28,23 +28,27 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot index 439d1f7..d949d87 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot @@ -28,17 +28,21 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "\"-lm\"", shape = septagon ]; - "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node11" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot index 81199a2..e9b9570 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot @@ -39,4 +39,5 @@ subgraph clusterLegend { "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot index 1be6550..7db111c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot @@ -28,21 +28,25 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "GraphicApplication", shape = egg ]; - "node4" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node6" [ label = "\"-lm\"", shape = septagon ]; - "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" - "node5" -> "node0" // GraphicLibrary -> CompilerFlags - "node5" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node11" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot index 1cfbe0f..f664c2e 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot @@ -28,23 +28,27 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot index 9653c33..58dda6d 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot @@ -28,23 +28,27 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot index 82d96d0..8b93f7c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot @@ -28,23 +28,27 @@ subgraph clusterLegend { "point2" -> "point0" // CoreLibrary -> CompilerFlags "point3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "point2" -> "point3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "point4" [ label = "SystemLibrary", shape = octagon ]; + "point4" -> "point2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "point2" -> "point4" [ style = dotted ] // CoreLibrary -> SystemLibrary "point1" -> "point2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "point4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "point1" -> "point4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "point5" [ label = "GraphicApplication", shape = egg ]; - "point5" -> "point2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "point6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "point7" [ label = "\"-lm\"", shape = septagon ]; - "point6" -> "point7" [ style = dotted ] // GraphicLibrary -> "-lm" - "point6" -> "point0" // GraphicLibrary -> CompilerFlags - "point6" -> "point2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "point8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "point6" -> "point8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "point5" -> "point6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "point9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "point9" -> "point0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "point9" -> "point2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "point10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "point10" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "point10" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "point5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "point1" -> "point5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "point6" [ label = "GraphicApplication", shape = egg ]; + "point6" -> "point2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "point7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "point8" [ label = "\"-lm\"", shape = septagon ]; + "point7" -> "point8" [ style = dotted ] // GraphicLibrary -> "-lm" + "point7" -> "point0" // GraphicLibrary -> CompilerFlags + "point7" -> "point2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "point9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "point7" -> "point9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "point6" -> "point7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "point10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "point10" -> "point0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "point10" -> "point2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "point11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "point11" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "point11" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "point12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependencies.dot.GraphicApplication b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependencies.dot.GraphicApplication index 6893fd1..92fe609 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependencies.dot.GraphicApplication +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependencies.dot.GraphicApplication @@ -2,21 +2,25 @@ digraph "GraphicApplication" { node [ fontsize = "12" ]; - "node5" [ label = "GraphicApplication", shape = egg ]; + "node6" [ label = "GraphicApplication", shape = egg ]; "node2" [ label = "CoreLibrary", shape = octagon ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary "node0" [ label = "CompilerFlags", shape = pentagon ]; "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" "node0" [ label = "CompilerFlags", shape = pentagon ]; - "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node0" // GraphicLibrary -> CompilerFlags "node2" [ label = "CoreLibrary", shape = octagon ]; - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependers.dot.CompilerFlags.dependers b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependers.dot.CompilerFlags.dependers index 3352b1a..82a2efe 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependers.dot.CompilerFlags.dependers +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_target_dependers.dot.CompilerFlags.dependers @@ -5,22 +5,26 @@ node [ "node0" [ label = "CompilerFlags", shape = pentagon ]; "node2" [ label = "CoreLibrary", shape = octagon ]; "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" [ label = "ConsoleApplication", shape = egg ]; "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags } diff --git a/Tests/RunCMake/Graphviz/sub_directory_target/CMakeLists.txt b/Tests/RunCMake/Graphviz/sub_directory_target/CMakeLists.txt new file mode 100644 index 0000000..d84897b --- /dev/null +++ b/Tests/RunCMake/Graphviz/sub_directory_target/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(SubDirectoryTarget test.c) diff --git a/Tests/RunCMake/Graphviz/sub_directory_target/test.c b/Tests/RunCMake/Graphviz/sub_directory_target/test.c new file mode 100644 index 0000000..d123e09 --- /dev/null +++ b/Tests/RunCMake/Graphviz/sub_directory_target/test.c @@ -0,0 +1,4 @@ +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/RunCMake/Graphviz/test_project/system_library.c b/Tests/RunCMake/Graphviz/test_project/system_library.c new file mode 100644 index 0000000..5d67079 --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/system_library.c @@ -0,0 +1,3 @@ +void initialize_system() +{ +} diff --git a/Tests/RunCMake/IncompatibleQt/CMakeLists.txt b/Tests/RunCMake/IncompatibleQt/CMakeLists.txt index f452db1..ebab7a3 100644 --- a/Tests/RunCMake/IncompatibleQt/CMakeLists.txt +++ b/Tests/RunCMake/IncompatibleQt/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/InterfaceLibrary/CMakeLists.txt b/Tests/RunCMake/InterfaceLibrary/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake b/Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake new file mode 100644 index 0000000..631a845 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake @@ -0,0 +1,2 @@ +# Test an interface library added to the build system by a per-config source. +add_library(iface INTERFACE $<$<CONFIG:NotAConfig>:${CMAKE_CURRENT_SOURCE_DIR}/iface.c>) diff --git a/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt new file mode 100644 index 0000000..aac9172 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt @@ -0,0 +1 @@ +iface2|Invalid project diff --git a/Tests/RunCMake/InterfaceLibrary/EmptySources.cmake b/Tests/RunCMake/InterfaceLibrary/EmptySources.cmake new file mode 100644 index 0000000..f452394 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/EmptySources.cmake @@ -0,0 +1,8 @@ +# Test an interface library added to the build system by empty SOURCES. +add_library(iface INTERFACE) +set_property(TARGET iface PROPERTY SOURCES "") + +# ...but not added by unset SOURCES. +add_library(iface2 INTERFACE) +set_property(TARGET iface2 PROPERTY SOURCES "") +set_property(TARGET iface2 PROPERTY SOURCES) diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake new file mode 100644 index 0000000..6500e48 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake @@ -0,0 +1,4 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/iface.txt") + set(RunCMake_TEST_FAILED "iface target built as part of 'all'") + return() +endif() diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake new file mode 100644 index 0000000..0977c24 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake @@ -0,0 +1,4 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/iface.txt") + set(RunCMake_TEST_FAILED "iface target not built") + return() +endif() diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt new file mode 100644 index 0000000..aac9172 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt @@ -0,0 +1 @@ +iface2|Invalid project diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake new file mode 100644 index 0000000..714161d --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake @@ -0,0 +1,7 @@ +# Test an interface library with a custom command, but excluded from all. +add_custom_command(OUTPUT iface.txt COMMAND ${CMAKE_COMMAND} -E touch iface.txt) +add_library(iface INTERFACE EXCLUDE_FROM_ALL iface.txt) + +# Test that EXCLUDE_FROM_ALL is allowed even if the interface library has +# no sources, and does not cause it to appear in the build system. +add_library(iface2 INTERFACE EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value-result.txt b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value-stderr.txt index 454c655..454c655 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value-stderr.txt diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value.cmake index 1af65b4..1af65b4 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-bad-value.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface-result.txt b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface-stderr.txt index 3a329d2..3a329d2 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface-stderr.txt diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface.cmake index fe6841a..fe6841a 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-iface.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported-result.txt b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported-stderr.txt index e9d94cf..e9d94cf 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported-stderr.txt diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported.cmake index 07a67d7..07a67d7 100644 --- a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake +++ b/Tests/RunCMake/InterfaceLibrary/IMPORTED_LIBNAME-non-imported.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt new file mode 100644 index 0000000..aac9172 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt @@ -0,0 +1 @@ +iface2|Invalid project diff --git a/Tests/RunCMake/InterfaceLibrary/PublicSources.cmake b/Tests/RunCMake/InterfaceLibrary/PublicSources.cmake new file mode 100644 index 0000000..24785bb --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/PublicSources.cmake @@ -0,0 +1,20 @@ +cmake_policy(SET CMP0076 NEW) +enable_language(C) + +# Test that an interface library can have PUBLIC sources. +# This causes the target to appear in the build system +# *and* causes consumers to use the source. +add_library(iface INTERFACE) +target_sources(iface + PUBLIC iface.c + # Private sources do not compile here or propagate. + PRIVATE iface_broken.c + ) + +# Test that an intermediate interface library does not get the +# sources and does not appear in the build system. +add_library(iface2 INTERFACE) +target_link_libraries(iface2 INTERFACE iface) + +add_executable(use_iface use_iface.c) +target_link_libraries(use_iface PRIVATE iface2) diff --git a/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake b/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake new file mode 100644 index 0000000..834b3c8 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake @@ -0,0 +1,36 @@ +include(RunCMake) + +run_cmake(invalid_name) +run_cmake(target_commands) +run_cmake(no_shared_libs) +run_cmake(invalid_signature) +run_cmake(global-interface) +run_cmake(genex_link) +run_cmake(add_custom_command-TARGET) +run_cmake(IMPORTED_LIBNAME-bad-value) +run_cmake(IMPORTED_LIBNAME-non-iface) +run_cmake(IMPORTED_LIBNAME-non-imported) + +function(run_WithSources CASE) + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) + run_cmake(${CASE}) + set(RunCMake_TEST_NO_CLEAN 1) + foreach(build IN LISTS ARGN) + if(build MATCHES "^([^:]+)$") + run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug) + elseif(build MATCHES "^([^:]+):([^:,]+)(,merge)?$") + if(CMAKE_MATCH_3 STREQUAL ",merge") + set(RunCMake_TEST_OUTPUT_MERGE 1) + endif() + run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug --target ${CMAKE_MATCH_2}) + endif() + endforeach() +endfunction() + +run_WithSources(ConfigSources "build1:iface") +run_WithSources(EmptySources "build1:iface" "build2:iface2,merge") +run_WithSources(ExcludeFromAll "build1" "build2:iface" "build3:iface2,merge") +run_WithSources(PublicSources "build1" "build2:iface" "build3:iface2,merge") diff --git a/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET-result.txt b/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/add_custom_command-TARGET-stderr.txt b/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET-stderr.txt index c095262..c095262 100644 --- a/Tests/RunCMake/interface_library/add_custom_command-TARGET-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET-stderr.txt diff --git a/Tests/RunCMake/interface_library/add_custom_command-TARGET.cmake b/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET.cmake index a5136ef..a5136ef 100644 --- a/Tests/RunCMake/interface_library/add_custom_command-TARGET.cmake +++ b/Tests/RunCMake/InterfaceLibrary/add_custom_command-TARGET.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/genex_link-result.txt b/Tests/RunCMake/InterfaceLibrary/genex_link-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/genex_link-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/interface_library/genex_link.cmake b/Tests/RunCMake/InterfaceLibrary/genex_link.cmake index 0dbf029..0dbf029 100644 --- a/Tests/RunCMake/interface_library/genex_link.cmake +++ b/Tests/RunCMake/InterfaceLibrary/genex_link.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/global-interface-result.txt b/Tests/RunCMake/InterfaceLibrary/global-interface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/global-interface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/global-interface-stderr.txt b/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt index 23b45d9..38585eb 100644 --- a/Tests/RunCMake/interface_library/global-interface-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt @@ -3,7 +3,7 @@ CMake Error at global-interface.cmake:2 \(add_library\): GLOBAL - Tried extensions( \.[A-Za-z+]+| - )* + Tried extensions \.c \.C .* +.* Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/global-interface.cmake b/Tests/RunCMake/InterfaceLibrary/global-interface.cmake index d2bfc64..d2bfc64 100644 --- a/Tests/RunCMake/interface_library/global-interface.cmake +++ b/Tests/RunCMake/InterfaceLibrary/global-interface.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/iface.c b/Tests/RunCMake/InterfaceLibrary/iface.c new file mode 100644 index 0000000..c7e7372 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/iface.c @@ -0,0 +1,4 @@ +int iface(void) +{ + return 0; +} diff --git a/Tests/RunCMake/InterfaceLibrary/iface_broken.c b/Tests/RunCMake/InterfaceLibrary/iface_broken.c new file mode 100644 index 0000000..4ff7f31 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/iface_broken.c @@ -0,0 +1 @@ +#error This file should not compile diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_name-result.txt b/Tests/RunCMake/InterfaceLibrary/invalid_name-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/invalid_name-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/invalid_name-stderr.txt b/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt index e14fcde..e14fcde 100644 --- a/Tests/RunCMake/interface_library/invalid_name-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt diff --git a/Tests/RunCMake/interface_library/invalid_name.cmake b/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake index 9a965aa..575fcc6 100644 --- a/Tests/RunCMake/interface_library/invalid_name.cmake +++ b/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.12) add_library(if$ace INTERFACE) add_library(iface::target INTERFACE) diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_signature-result.txt b/Tests/RunCMake/InterfaceLibrary/invalid_signature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/invalid_signature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/invalid_signature-stderr.txt b/Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt index 6374b33..763f9f8 100644 --- a/Tests/RunCMake/interface_library/invalid_signature-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt @@ -1,8 +1,3 @@ -CMake Error at invalid_signature.cmake:2 \(add_library\): - add_library INTERFACE library requires no source arguments. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ CMake Error at invalid_signature.cmake:3 \(add_library\): add_library INTERFACE library specified with conflicting/multiple types. Call Stack \(most recent call first\): @@ -73,16 +68,6 @@ CMake Error at invalid_signature.cmake:16 \(add_library\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + -CMake Error at invalid_signature.cmake:17 \(add_library\): - add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at invalid_signature.cmake:18 \(add_library\): - add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ CMake Error at invalid_signature.cmake:20 \(add_library\): add_library GLOBAL option may only be used with IMPORTED libraries. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/interface_library/invalid_signature.cmake b/Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake index 4e53534..2a575b5 100644 --- a/Tests/RunCMake/interface_library/invalid_signature.cmake +++ b/Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake @@ -1,5 +1,5 @@ -add_library(iface1 INTERFACE empty.cpp) + add_library(iface3 STATIC INTERFACE) add_library(iface4 STATIC INTERFACE empty.cpp) add_library(iface5 SHARED INTERFACE) @@ -14,7 +14,7 @@ add_library(iface13 INTERFACE UNKNOWN) add_library(iface14 INTERFACE ALIAS) add_library(iface15 ALIAS INTERFACE) add_library(iface16 INTERFACE INTERFACE) -add_library(iface17 INTERFACE EXCLUDE_FROM_ALL) -add_library(iface18 EXCLUDE_FROM_ALL INTERFACE) + + # add_library(iface19 GLOBAL INTERFACE) Tested separately add_library(iface20 INTERFACE GLOBAL) diff --git a/Tests/RunCMake/interface_library/no_shared_libs.cmake b/Tests/RunCMake/InterfaceLibrary/no_shared_libs.cmake index ed81878..ed81878 100644 --- a/Tests/RunCMake/interface_library/no_shared_libs.cmake +++ b/Tests/RunCMake/InterfaceLibrary/no_shared_libs.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/target_commands-result.txt b/Tests/RunCMake/InterfaceLibrary/target_commands-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/target_commands-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/target_commands-stderr.txt b/Tests/RunCMake/InterfaceLibrary/target_commands-stderr.txt index 9362a75..9362a75 100644 --- a/Tests/RunCMake/interface_library/target_commands-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/target_commands-stderr.txt diff --git a/Tests/RunCMake/interface_library/target_commands.cmake b/Tests/RunCMake/InterfaceLibrary/target_commands.cmake index 3182e89..3182e89 100644 --- a/Tests/RunCMake/interface_library/target_commands.cmake +++ b/Tests/RunCMake/InterfaceLibrary/target_commands.cmake diff --git a/Tests/RunCMake/InterfaceLibrary/use_iface.c b/Tests/RunCMake/InterfaceLibrary/use_iface.c new file mode 100644 index 0000000..66293e4 --- /dev/null +++ b/Tests/RunCMake/InterfaceLibrary/use_iface.c @@ -0,0 +1,6 @@ +extern int iface(void); + +int main(void) +{ + return iface(); +} diff --git a/Tests/RunCMake/Languages/CMakeLists.txt b/Tests/RunCMake/Languages/CMakeLists.txt index 8996fef..74b3ff8 100644 --- a/Tests/RunCMake/Languages/CMakeLists.txt +++ b/Tests/RunCMake/Languages/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) -cmake_policy(SET CMP0042 NEW) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Make/CMP0113-Common.cmake b/Tests/RunCMake/Make/CMP0113-Common.cmake new file mode 100644 index 0000000..8ce26c4 --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-Common.cmake @@ -0,0 +1,17 @@ +add_custom_command( + OUTPUT output-not-created + COMMAND ${CMAKE_COMMAND} -E echo output-not-created + DEPENDS ${CMAKE_CURRENT_LIST_FILE} + VERBATIM + ) + +add_custom_command( + OUTPUT output-created + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_FILE} output-created + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output-not-created + VERBATIM + ) + +add_custom_target(drive1 ALL DEPENDS output-not-created) +add_custom_target(drive2 ALL DEPENDS output-created) +add_dependencies(drive2 drive1) diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt new file mode 100644 index 0000000..0af354a --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt @@ -0,0 +1,5 @@ +No rule to make target [^ +]*output-not-created[^ +]*, needed by [^ +]*output-created[^ +]* diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt new file mode 100644 index 0000000..a6b851e --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt @@ -0,0 +1 @@ +Generating output-not-created.*Built target drive1 diff --git a/Tests/RunCMake/Make/CMP0113-NEW.cmake b/Tests/RunCMake/Make/CMP0113-NEW.cmake new file mode 100644 index 0000000..a2d1db5 --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0113 NEW) +include(CMP0113-Common.cmake) diff --git a/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt new file mode 100644 index 0000000..f6e1f0f --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt @@ -0,0 +1 @@ +Generating output-not-created.*Built target drive1.*Generating output-not-created.*Built target drive2 diff --git a/Tests/RunCMake/Make/CMP0113-OLD.cmake b/Tests/RunCMake/Make/CMP0113-OLD.cmake new file mode 100644 index 0000000..b6ab120 --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0113 OLD) +include(CMP0113-Common.cmake) diff --git a/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt new file mode 100644 index 0000000..f6e1f0f --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt @@ -0,0 +1 @@ +Generating output-not-created.*Built target drive1.*Generating output-not-created.*Built target drive2 diff --git a/Tests/RunCMake/Make/CMP0113-WARN.cmake b/Tests/RunCMake/Make/CMP0113-WARN.cmake new file mode 100644 index 0000000..48e035a --- /dev/null +++ b/Tests/RunCMake/Make/CMP0113-WARN.cmake @@ -0,0 +1,2 @@ +# Policy CMP0113 not set. +include(CMP0113-Common.cmake) diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index 6b2721c..5562aca 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -27,14 +27,39 @@ function(run_VerboseBuild) run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) unset(RunCMake-stdout-file) set(_backup_lang "$ENV{LANG}") + set(_backup_lc_Messages "$ENV{LC_MESSAGES}") if(MAKE_IS_GNU) set(RunCMake-stdout-file VerboseBuild-nowork-gnu-stdout.txt) set(ENV{LANG} "C") + set(ENV{LC_MESSAGES} "C") endif() run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) set(ENV{LANG} "${_backup_lang}") + set(ENV{LC_MESSAGES} "${_backup_lc_messages}") endfunction() run_VerboseBuild() run_cmake(CustomCommandDepfile-ERROR) run_cmake(IncludeRegexSubdir) + +function(run_CMP0113 val) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0113-${val}-build) + run_cmake(CMP0113-${val}) + set(RunCMake_TEST_NO_CLEAN 1) + set(_backup_lang "$ENV{LANG}") + set(_backup_lc_Messages "$ENV{LC_MESSAGES}") + if(MAKE_IS_GNU) + set(RunCMake-stderr-file CMP0113-${val}-build-gnu-stderr.txt) + set(ENV{LANG} "C") + set(ENV{LC_MESSAGES} "C") + endif() + run_cmake_command(CMP0113-${val}-build ${CMAKE_COMMAND} --build .) + set(ENV{LANG} "${_backup_lang}") + set(ENV{LC_MESSAGES} "${_backup_lc_messages}") +endfunction() + +if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_CMP0113(WARN) + run_CMP0113(OLD) + run_CMP0113(NEW) +endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll-all-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll-all-build-check.cmake new file mode 100644 index 0000000..a4d2758 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll-all-build-check.cmake @@ -0,0 +1,9 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_release_only_tool_Release} + ${TARGET_EXE_FILE_release_only_tool_Release} + + EXCLUDE + ${TARGET_FILE_release_only_tool_Debug} + ${TARGET_EXE_FILE_release_only_tool_Debug} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake b/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake new file mode 100644 index 0000000..52f84ea --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "") +set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "") +set(CMAKE_CROSS_CONFIGS "all" CACHE STRING "") +set(CMAKE_DEFAULT_CONFIGS "all" CACHE STRING "") + +add_executable(release_only_tool main.c) +set_property(TARGET release_only_tool PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:Release>>") + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(release_only_tool) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 8496d63..6699a09 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -284,6 +284,11 @@ run_ninja(Install default-install build.ninja install) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/install") run_ninja(Install all-install build.ninja install:all) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build) +run_cmake_configure(ExcludeFromAll) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(ExcludeFromAll all "" all:all) + # FIXME Get this working #set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutoMocExecutable-build) #run_cmake_configure(AutoMocExecutable) diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt index 411cd7c..5c7882d 100644 --- a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt @@ -3,7 +3,7 @@ CMake Error at MissingSource.cmake:1 \(add_library\): missing.c - Tried extensions( \.[A-Za-z+]+| - )* + Tried extensions \.c \.C .* +.* Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt b/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt index 65ac8e8..44b5d30 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt +++ b/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST}) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt b/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt index 90afc12..c3922d6 100644 --- a/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt +++ b/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) # MSVC creates extra targets which pollute the stderr unless we set this. diff --git a/Tests/RunCMake/PrecompileHeaders/PchInstantiateTemplates-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchInstantiateTemplates-check.cmake new file mode 100644 index 0000000..81449ca --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchInstantiateTemplates-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/compile_commands.json empty_dir_commands + REGEX "command.*-fpch-instantiate-templates.*empty.dir/cmake_pch[A-Za-z0-9_.]*.h") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/compile_commands.json foo_dir_commands + REGEX "command.*-fpch-instantiate-templates.*foo.dir/cmake_pch[A-Za-z0-9_.]*.h") + +list(LENGTH empty_dir_commands empty_dir_commands_size) +list(LENGTH foo_dir_commands foo_dir_commands_size) + +if (empty_dir_commands_size EQUAL 0) + set(RunCMake_TEST_FAILED "empty target should have -fpch-instantiate-templates compile option present") + return() +endif() + +if (foo_dir_commands_size GREATER 0) + set(RunCMake_TEST_FAILED "foo target should not have -fpch-instantiate-templates compile option present") + return() +endif() diff --git a/Tests/RunCMake/PrecompileHeaders/PchInstantiateTemplates.cmake b/Tests/RunCMake/PrecompileHeaders/PchInstantiateTemplates.cmake new file mode 100644 index 0000000..3aebbe0 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchInstantiateTemplates.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +add_library(empty empty.c) +target_precompile_headers(empty PUBLIC + <stdio.h> + <string.h> +) + +add_library(foo foo.c) +target_precompile_headers(foo PUBLIC + <stdio.h> + <string.h> +) +set_target_properties(foo PROPERTIES PCH_INSTANTIATE_TEMPLATES OFF) diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake index 381b800..74670ba 100644 --- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake +++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake @@ -20,4 +20,9 @@ run_test(PchReuseFromSubdir) run_cmake(PchMultilanguage) if(RunCMake_GENERATOR MATCHES "Make|Ninja") run_cmake(PchWarnInvalid) + + if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.0) + run_cmake(PchInstantiateTemplates) + endif() endif() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index cb20fb1..7d96e50 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -153,7 +153,9 @@ function(run_cmake test) "|contact PGI Sales at" "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" + "|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined." "|[^\n]*is a member of multiple groups" + "|[^\n]*offset in archive not a multiple of 8" "|[^\n]*from Time Machine by path" "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" diff --git a/Tests/RunCMake/SourceProperties/CMakeLists.txt b/Tests/RunCMake/SourceProperties/CMakeLists.txt index a17c8cd..e93f0b6 100644 --- a/Tests/RunCMake/SourceProperties/CMakeLists.txt +++ b/Tests/RunCMake/SourceProperties/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt index aecd4d3..141d66d 100644 --- a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt @@ -19,6 +19,6 @@ CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\): -->\${\$}<-- - syntax error, unexpected \$, expecting } \(7\) + syntax error, unexpected \$, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt index 7448b59..71b9c3c 100644 --- a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt @@ -7,6 +7,6 @@ \${var\\rwith\\rcarriagereturn} - syntax error, unexpected cal_SYMBOL, expecting } \(7\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt index f5e03ed..c43e1be 100644 --- a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt @@ -7,6 +7,6 @@ \${var\\rwith\\rcarriagereturn} - syntax error, unexpected cal_SYMBOL, expecting } \(7\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt index fa16a8a..3a26135 100644 --- a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt @@ -7,6 +7,6 @@ \${var\\ with\\ escaped\\ space} - syntax error, unexpected cal_SYMBOL, expecting } \(7\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt index 07cbf24..0f40649 100644 --- a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt @@ -7,6 +7,6 @@ \${var\\ with\\ escaped\\ space} - syntax error, unexpected cal_SYMBOL, expecting } \(7\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt index 5cc111b..77bd470 100644 --- a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt @@ -7,6 +7,6 @@ \${var\\nwith\\nnewline} - syntax error, unexpected cal_SYMBOL, expecting } \(7\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt index 0067c2f..1d14b1d 100644 --- a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt @@ -7,6 +7,6 @@ \${var\\nwith\\nnewline} - syntax error, unexpected cal_SYMBOL, expecting } \(7\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt index 04bc226..cf6dad5 100644 --- a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt @@ -7,6 +7,6 @@ \${var - syntax error, unexpected \$end, expecting } \(5\) + syntax error, unexpected \$end, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt index 66cf9a2..6e3744a 100644 --- a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt @@ -7,6 +7,6 @@ \${var with space} - syntax error, unexpected cal_SYMBOL, expecting } \(17\) + syntax error, unexpected cal_SYMBOL, expecting } \(3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt index e888096..70e7c12 100644 --- a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt @@ -7,6 +7,6 @@ \${var - syntax error, unexpected \$end, expecting } \(5\) + syntax error, unexpected \$end, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt index b020074..e18268a 100644 --- a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt @@ -7,6 +7,6 @@ \${var with tab} - syntax error, unexpected cal_SYMBOL, expecting } \(15\) + syntax error, unexpected cal_SYMBOL, expecting } \(3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt index d7861e2..144b57c 100644 --- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt @@ -15,6 +15,6 @@ CMake Error at ParenInENV.cmake:2 \(message\): -->\$ENV{e - syntax error, unexpected \$end, expecting } \(9\) + syntax error, unexpected \$end, expecting } \(10\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt index 81b1717..18ca946 100644 --- a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt @@ -7,6 +7,6 @@ CMake Error at ParenInVarName1.cmake:4 \(message\): -->\${e\(x\)}<-- - syntax error, unexpected cal_SYMBOL, expecting } \(10\) + syntax error, unexpected cal_SYMBOL, expecting } \(6\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt index 1e0ce49..cf63dbe 100644 --- a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt @@ -7,6 +7,6 @@ CMake Error at UnterminatedBrace0.cmake:2 \(set\): \${ - syntax error, unexpected \$end, expecting } \(2\) + syntax error, unexpected \$end, expecting } \(3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt index 4e3c2b5..0e6f786 100644 --- a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt +++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt @@ -7,7 +7,7 @@ CMake Warning \(dev\) at UnterminatedBrace1.cmake:3 \(set\): \${ - syntax error, unexpected \$end, expecting } \(2\) + syntax error, unexpected \$end, expecting } \(3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/TargetObjects/CMakeLists.txt b/Tests/RunCMake/TargetObjects/CMakeLists.txt index be9d403..44b5d30 100644 --- a/Tests/RunCMake/TargetObjects/CMakeLists.txt +++ b/Tests/RunCMake/TargetObjects/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST}) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetPolicies/CMakeLists.txt b/Tests/RunCMake/TargetPolicies/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/TargetPolicies/CMakeLists.txt +++ b/Tests/RunCMake/TargetPolicies/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 2454f25..b3f3a5e 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -32,6 +32,8 @@ \* CMP0104 \* CMP0105 \* CMP0108 + \* CMP0112 + \* CMP0113 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetProperties/CMakeLists.txt b/Tests/RunCMake/TargetProperties/CMakeLists.txt index be9d403..44b5d30 100644 --- a/Tests/RunCMake/TargetProperties/CMakeLists.txt +++ b/Tests/RunCMake/TargetProperties/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST}) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt index 90afc12..c3922d6 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) # MSVC creates extra targets which pollute the stderr unless we set this. diff --git a/Tests/RunCMake/TargetSources/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/TargetSources/CMakeLists.txt +++ b/Tests/RunCMake/TargetSources/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_order-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_order-check.cmake index f26ec2e..85e6587 100644 --- a/Tests/RunCMake/UnityBuild/unitybuild_order-check.cmake +++ b/Tests/RunCMake/UnityBuild/unitybuild_order-check.cmake @@ -2,6 +2,6 @@ set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c file(STRINGS ${unitybuild_c} unitybuild_c_strings) string(REGEX MATCH ".*#include.*s3.c.*#include.*s1.c.*#include.*s2.c.*" matched_code ${unitybuild_c_strings}) if(NOT matched_code) - set(RunCMake_TEST_FAILED "Generated unity file doesn't include expected oder of source files") + set(RunCMake_TEST_FAILED "Generated unity file doesn't include expected order of source files") return() endif() diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake new file mode 100644 index 0000000..bcdc101 --- /dev/null +++ b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake @@ -0,0 +1,25 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/iface.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_iface_h 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*iface\\.h") + set(rule "${CMAKE_MATCH_1}") + if(NOT rule STREQUAL "None") + set(RunCMake_TEST_FAILED "iface.h referenced as ${rule} instead of None in\n ${vcProjectFile}") + return() + endif() + if(found_iface_h) + set(RunCMake_TEST_FAILED "iface.h referenced multiple times in\n ${vcProjectFile}") + return() + endif() + set(found_iface_h 1) + endif() +endforeach() +if(NOT found_iface_h) + set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${vcProjectFile}") +endif() diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake new file mode 100644 index 0000000..3672be1 --- /dev/null +++ b/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake @@ -0,0 +1 @@ +add_library(iface INTERFACE iface.h) diff --git a/Tests/RunCMake/VS10Project/LanguageStandard-check.cmake b/Tests/RunCMake/VS10Project/LanguageStandard-check.cmake new file mode 100644 index 0000000..85e2858 --- /dev/null +++ b/Tests/RunCMake/VS10Project/LanguageStandard-check.cmake @@ -0,0 +1,23 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_LanguageStandard_stdcpp17 0) +set(found_LanguageStandard_C_stdc11 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<LanguageStandard>stdcpp17</LanguageStandard>") + set(found_LanguageStandard_stdcpp17 1) + endif() + if(line MATCHES "<LanguageStandard_C>stdc11</LanguageStandard_C>") + set(found_LanguageStandard_C_stdc11 1) + endif() +endforeach() +if(NOT found_LanguageStandard_stdcpp17) + string(APPEND RunCMake_TEST_FAILED "LanguageStandard stdcpp17 not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_LanguageStandard_C_stdc11) + string(APPEND RunCMake_TEST_FAILED "LanguageStandard_C stdc11 not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/LanguageStandard.cmake b/Tests/RunCMake/VS10Project/LanguageStandard.cmake new file mode 100644 index 0000000..f8b62e2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/LanguageStandard.cmake @@ -0,0 +1,5 @@ +enable_language(C) +enable_language(CXX) + +add_library(foo empty.c empty.cxx) +target_compile_features(foo PRIVATE c_std_11 cxx_std_17) diff --git a/Tests/RunCMake/VS10Project/NoImpLib-check.cmake b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake new file mode 100644 index 0000000..50722b2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake @@ -0,0 +1,23 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_ImportLibrary 0) +set(found_TargetExt_dll 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<ImportLibrary>") + set(found_ImportLibrary 1) + endif() + if(line MATCHES "<TargetExt[^\n]*\\.dll") + set(found_TargetExt_dll 1) + endif() +endforeach() +if(found_ImportLibrary) + string(APPEND RunCMake_TEST_FAILED "ImportLibrary incorrectly found in\n ${vcProjectFile}\n") +endif() +if(NOT found_TargetExt_dll) + string(APPEND RunCMake_TEST_FAILED "TargetExt not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/NoImpLib.cmake b/Tests/RunCMake/VS10Project/NoImpLib.cmake new file mode 100644 index 0000000..2c11eac --- /dev/null +++ b/Tests/RunCMake/VS10Project/NoImpLib.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_IMPORT_LIBRARY_SUFFIX "") +add_library(foo SHARED empty.c) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 93ef603..133dacc 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -3,9 +3,15 @@ cmake_policy(SET CMP0057 NEW) include(RunCMake) cmake_policy(SET CMP0054 NEW) +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) + run_cmake(LanguageStandard) +endif() + run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) +run_cmake(InterfaceLibSources) +run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) diff --git a/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake b/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake index 416220b..0d82d3f 100644 --- a/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake +++ b/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake @@ -31,6 +31,6 @@ if (NOT "${OVERRIDEN_TOOLSET}" STREQUAL "MyCustomToolset") endif() if ("${NORMAL_TOOLSET}" STREQUAL "MyCustomToolset") - set(RunCMake_TEST_FAILED "Main toolset was overriden (it shouldn't)") + set(RunCMake_TEST_FAILED "Main toolset was overridden (it shouldn't)") return() endif() diff --git a/Tests/RunCMake/VS10Project/iface.h b/Tests/RunCMake/VS10Project/iface.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/VS10Project/iface.h diff --git a/Tests/RunCMake/VSSolution/CMakeLists.txt b/Tests/RunCMake/VSSolution/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/VSSolution/CMakeLists.txt +++ b/Tests/RunCMake/VSSolution/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Win32GenEx/CMakeLists.txt b/Tests/RunCMake/Win32GenEx/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Win32GenEx/RunCMakeTest.cmake b/Tests/RunCMake/Win32GenEx/RunCMakeTest.cmake new file mode 100644 index 0000000..d5529b0 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/RunCMakeTest.cmake @@ -0,0 +1,28 @@ +include(RunCMake) + +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Win32GenEx-build) + run_cmake(Win32GenEx) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Win32GenEx-debug-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Debug) + run_cmake_command(Win32GenEx-release-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Release) + unset(RunCMake_TEST_NO_CLEAN) +else() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Win32GenEx-debug-build) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + run_cmake(Win32GenEx-debug) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Win32GenEx-debug-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR}) + unset(RunCMake_TEST_NO_CLEAN) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Win32GenEx-release-build) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + run_cmake(Win32GenEx-release) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Win32GenEx-release-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR}) + unset(RunCMake_TEST_NO_CLEAN) +endif() diff --git a/Tests/RunCMake/Win32GenEx/Win32GenEx-debug.cmake b/Tests/RunCMake/Win32GenEx/Win32GenEx-debug.cmake new file mode 100644 index 0000000..74c5bd8 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/Win32GenEx-debug.cmake @@ -0,0 +1 @@ +include(Win32GenEx.cmake) diff --git a/Tests/RunCMake/Win32GenEx/Win32GenEx-release.cmake b/Tests/RunCMake/Win32GenEx/Win32GenEx-release.cmake new file mode 100644 index 0000000..74c5bd8 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/Win32GenEx-release.cmake @@ -0,0 +1 @@ +include(Win32GenEx.cmake) diff --git a/Tests/RunCMake/Win32GenEx/Win32GenEx.cmake b/Tests/RunCMake/Win32GenEx/Win32GenEx.cmake new file mode 100644 index 0000000..80f8b80 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/Win32GenEx.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_executable(Win32GenEx main.c) +set_target_properties(Win32GenEx PROPERTIES + WIN32_EXECUTABLE $<CONFIG:Release> + ) +target_compile_definitions(Win32GenEx PRIVATE $<$<CONFIG:Release>:USE_WIN32_MAIN>) diff --git a/Tests/RunCMake/Win32GenEx/main.c b/Tests/RunCMake/Win32GenEx/main.c new file mode 100644 index 0000000..1cf9f81 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/main.c @@ -0,0 +1,14 @@ +#ifdef USE_WIN32_MAIN +# include <windows.h> + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nShowCmd) +{ + return 0; +} +#else +int main(void) +{ + return 0; +} +#endif diff --git a/Tests/RunCMake/XcodeProject/CMakeLists.txt b/Tests/RunCMake/XcodeProject/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/XcodeProject/CMakeLists.txt +++ b/Tests/RunCMake/XcodeProject/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake index 288735e..3d8fa17 100644 --- a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake +++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake @@ -5,15 +5,18 @@ project(DeploymentTarget C) if(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS") set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") diff --git a/Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake b/Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake new file mode 100644 index 0000000..613951a --- /dev/null +++ b/Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake @@ -0,0 +1,16 @@ +set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/InterfaceLibSources.xcodeproj/project.pbxproj") +if(NOT EXISTS "${xcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.") + return() +endif() + +set(found_iface_h 0) +file(STRINGS "${xcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "PBXFileReference.*explicitFileType.*sourcecode\\.c\\.h.*iface\\.h") + set(found_iface_h 1) + endif() +endforeach() +if(NOT found_iface_h) + set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${xcProjectFile}") +endif() diff --git a/Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake b/Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake new file mode 100644 index 0000000..3672be1 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake @@ -0,0 +1 @@ +add_library(iface INTERFACE iface.h) diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake new file mode 100644 index 0000000..7abc58b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake @@ -0,0 +1,132 @@ +enable_language(C) + +set(prototypes [[ +#include <stdio.h> +#include <zlib.h> +#include <resolv.h> +int func1(); +int func2(); +int func3(); +int func4(); +int func5(); +int func6(); +int func7(); +]]) +set(prototypes_objc [[ +#import <CoreFoundation/CoreFoundation.h> +]]) +set(impl [[ +{ + printf("%p %p\n", compress, res_close); + return func1() + func2() + func3() + func4() + func5() + func6() + func7(); +} +]]) +set(impl_objc [[ +{ + CFStringRef cfStr = CFSTR("This is a string"); + printf("%p %p %ld\n", compress, res_close, (long)CFStringGetLength(cfStr)); + return func1() + func2() + func3() + func4() + func5() + func6() + func7(); +} +]]) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/mainOuter.m + "${prototypes}\n${prototypes_objc}\nint main(int argc, char** argv) ${impl_objc}" +) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/funcOuter.c + "${prototypes}\nint funcOuter() ${impl}" +) + +foreach(i RANGE 1 5) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/func${i}.c + "int func${i}() { return 32 + ${i}; }\n" + ) +endforeach() + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/CMakeLists.txt +[[ +cmake_minimum_required(VERSION 3.18) +project(ExternalFrameworks) +add_library(staticFrameworkExt STATIC func6.c) +add_library(sharedFrameworkExt SHARED func7.c) +set_target_properties(staticFrameworkExt PROPERTIES FRAMEWORK TRUE) +set_target_properties(sharedFrameworkExt PROPERTIES FRAMEWORK TRUE) +]] +) + +foreach(i RANGE 6 7) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/func${i}.c + "int func${i}() { return 32 + ${i}; }\n" + ) +endforeach() + +add_custom_target(prebuildDependencies ALL + COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks -B ${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/build -G Xcode + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/build --target staticFrameworkExt sharedFrameworkExt --config Debug +) +add_executable(app1 mainOuter.m) +add_library(static1 STATIC funcOuter.c) +add_library(shared1 SHARED funcOuter.c) +add_library(module1 MODULE funcOuter.c) +add_library(obj1 OBJECT funcOuter.c) +add_library(staticFramework1 STATIC funcOuter.c) +add_library(sharedFramework1 SHARED funcOuter.c) +set_target_properties(staticFramework1 PROPERTIES FRAMEWORK TRUE) +set_target_properties(sharedFramework1 PROPERTIES FRAMEWORK TRUE) +add_dependencies(app1 prebuildDependencies) +add_dependencies(static1 prebuildDependencies) +add_dependencies(shared1 prebuildDependencies) +add_dependencies(module1 prebuildDependencies) +add_dependencies(obj1 prebuildDependencies) +add_dependencies(staticFramework1 prebuildDependencies) +add_dependencies(sharedFramework1 prebuildDependencies) + +add_library(static2 STATIC func1.c) +add_library(shared2 SHARED func2.c) +add_library(obj2 OBJECT func3.c) +add_library(staticFramework2 STATIC func4.c) +add_library(sharedFramework2 SHARED func5.c) +set_target_properties(staticFramework2 PROPERTIES FRAMEWORK TRUE) +set_target_properties(sharedFramework2 PROPERTIES FRAMEWORK TRUE) + +# Pick some external libraries that are always present in the Xcode SDK +find_library(libz z REQUIRED) +find_library(libresolv resolv REQUIRED) +find_library(CoreFoundation CoreFoundation REQUIRED) +add_library(imported2 UNKNOWN IMPORTED) +set_target_properties(imported2 PROPERTIES IMPORTED_LOCATION ${libz}) + +# Save these for the check script to use +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/foundLibs.cmake " +set(libz \"${libz}\") +set(libresolv \"${libresolv}\") +set(CoreFoundation \"${CoreFoundation}\") +") + +set(mainTargets + app1 + static1 + shared1 + module1 + obj1 + staticFramework1 + sharedFramework1 +) +set(linkToThings + static2 + shared2 + obj2 + staticFramework2 + sharedFramework2 + imported2 + ${libresolv} + ${CoreFoundation} + "${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/build/Debug/sharedFrameworkExt.framework" + "${CMAKE_CURRENT_BINARY_DIR}/ExternalFrameworks/build/Debug/staticFrameworkExt.framework" +) + +foreach(mainTarget IN LISTS mainTargets) + foreach(linkTo IN LISTS linkToThings) + target_link_libraries(${mainTarget} PRIVATE ${linkTo}) + endforeach() +endforeach() diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake new file mode 100644 index 0000000..d07a25b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake @@ -0,0 +1,19 @@ +include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake) +include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake) + +# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path +# ${libz} --> This is for imported2 + +foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1) + checkFlags(OTHER_LDFLAGS ${mainTarget} + "obj2;${libz};${libresolv};CoreFoundation;sharedFrameworkExt;staticFrameworkExt" + "static2;shared2;staticFramework2;sharedFramework2" + ) +endforeach() + +foreach(mainTarget IN ITEMS static1 staticFramework1) + checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget} + "obj2" + "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv};CoreFoundation;sharedFrameworkExt;staticFrameworkExt" + ) +endforeach() diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake new file mode 100644 index 0000000..f9dd643 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake) diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake new file mode 100644 index 0000000..e72bf4d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.18...3.19) + +macro(returnOnError errorMsg) + if(NOT "${errorMsg}" STREQUAL "") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n${errorMsg}" PARENT_SCOPE) + return() + endif() +endmacro() + +function(getTargetFlags mainTarget projFlagsVar flagsVar errorVar) + # The flags variables in the project file might span over multiple lines + # so we can't easily read the flags directly from there. Instead, we use + # the xcodebuild -showBuildSettings option to report it on a single line. + execute_process( + COMMAND ${CMAKE_COMMAND} + --build ${RunCMake_TEST_BINARY_DIR} + --target ${mainTarget} + --config Debug + -- + -showBuildSettings + COMMAND grep ${projFlagsVar} + OUTPUT_VARIABLE flagsContents + RESULT_VARIABLE result + ) + + if(result) + set(${errorVar} "Failed to get flags for ${mainTarget}: ${result}" PARENT_SCOPE) + else() + unset(${errorVar} PARENT_SCOPE) + endif() + set(${flagsVar} "${flagsContents}" PARENT_SCOPE) +endfunction() + +function(checkFlags projFlagsVar mainTarget present absent) + getTargetFlags(${mainTarget} ${projFlagsVar} flags errorMsg) + returnOnError("${errorMsg}") + + foreach(linkTo IN LISTS present) + string(REGEX MATCH "${linkTo}" result "${flags}") + if("${result}" STREQUAL "") + string(APPEND RunCMake_TEST_FAILED + "\n${mainTarget} ${projFlagsVar} is missing ${linkTo}" + ) + endif() + endforeach() + + foreach(linkTo IN LISTS absent) + string(REGEX MATCH "${linkTo}" result "${flags}") + if(NOT "${result}" STREQUAL "") + string(APPEND RunCMake_TEST_FAILED + "\n${mainTarget} ${projFlagsVar} unexpectedly contains ${linkTo}" + ) + endif() + endforeach() + + set(RunCMake_TEST_FAILED ${RunCMake_TEST_FAILED} PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt new file mode 100644 index 0000000..0664304 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt @@ -0,0 +1 @@ +CMake Error: Invalid value for XCODE_LINK_BUILD_PHASE_MODE: INVALID diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake new file mode 100644 index 0000000..0a20d20 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) + +add_executable(app main.cpp) +set_target_properties(app PROPERTIES XCODE_LINK_BUILD_PHASE_MODE INVALID) diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake new file mode 100644 index 0000000..e1484e7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake @@ -0,0 +1,19 @@ +include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake) +include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake) + +# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path +# ${libz} --> This is for imported2 + +foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1) + checkFlags(OTHER_LDFLAGS ${mainTarget} + "obj2" + "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv};CoreFoundation;sharedFrameworkExt;staticFrameworkExt" + ) +endforeach() + +foreach(mainTarget IN ITEMS static1 staticFramework1) + checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget} + "obj2" + "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv};CoreFoundation;sharedFrameworkExt;staticFrameworkExt" + ) +endforeach() diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake new file mode 100644 index 0000000..f9dd643 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake) diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake new file mode 100644 index 0000000..2601676 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake @@ -0,0 +1,19 @@ +include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake) +include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake) + +# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path +# ${libz} --> This is for imported2 + +foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1) + checkFlags(OTHER_LDFLAGS ${mainTarget} + "static2;shared2;staticFramework2;sharedFramework2;obj2;${libz};${libresolv};CoreFoundation;sharedFrameworkExt;staticFrameworkExt" + "" + ) +endforeach() + +foreach(mainTarget IN ITEMS static1 staticFramework1) + checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget} + "obj2" + "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv};CoreFoundation;sharedFrameworkExt;staticFrameworkExt" + ) +endforeach() diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake new file mode 100644 index 0000000..f9dd643 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 342dbbc..62163ac 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(ExplicitCMakeLists) run_cmake(ImplicitCMakeLists) +run_cmake(InterfaceLibSources) run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) @@ -9,6 +10,10 @@ run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) run_cmake(XcodeGenerateTopLevelProjectOnly) +if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + run_cmake(XcodeDuplicateCustomCommand) +endif() + function(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary-build) run_cmake(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary) @@ -18,6 +23,19 @@ endfunction() XcodeGenerateTopLevelProjectOnlyWithObjectLibrary() +function(LinkBinariesBuildPhase mode) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LinkBinariesBuildPhase_${mode}-build) + set(RunCMake_TEST_OPTIONS "-DCMAKE_XCODE_LINK_BUILD_PHASE_MODE=${mode}") + run_cmake(LinkBinariesBuildPhase_${mode}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(LinkBinariesBuildPhase_${mode}-build ${CMAKE_COMMAND} --build .) +endfunction() + +LinkBinariesBuildPhase(NONE) +LinkBinariesBuildPhase(BUILT_ONLY) +LinkBinariesBuildPhase(KNOWN_LOCATION) +run_cmake(LinkBinariesBuildPhase_INVALID) + run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) @@ -119,8 +137,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install) + run_cmake_command(XcodeBundles-build-macOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-macOS ${CMAKE_COMMAND} --build . --target install) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) @@ -136,8 +154,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install) + run_cmake_command(XcodeBundles-build-iOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-iOS ${CMAKE_COMMAND} --build . --target install) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) @@ -155,8 +173,8 @@ if(NOT XCODE_VERSION VERSION_LESS 7) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install) + run_cmake_command(XcodeBundles-build-watchOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-watchOS ${CMAKE_COMMAND} --build . --target install) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) @@ -174,8 +192,8 @@ if(NOT XCODE_VERSION VERSION_LESS 7.1) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install) + run_cmake_command(XcodeBundles-build-tvOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-tvOS ${CMAKE_COMMAND} --build . --target install) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) @@ -188,7 +206,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7) unset(RunCMake_TEST_OPTIONS) endif() -if(NOT XCODE_VERSION VERSION_LESS 6) +if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12) # XcodeIOSInstallCombined set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) set(RunCMake_TEST_NO_CLEAN 1) @@ -309,10 +327,10 @@ endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) function(XcodeRemoveExcessiveISystemSDK SDK) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeRemoveExcessiveISystemSDK-${SDK}-build) - set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS") + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=${SDK}") run_cmake(XcodeRemoveExcessiveISystem) set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build . -- -sdk ${SDK}) + run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build .) endfunction() XcodeRemoveExcessiveISystemSDK(iphoneos) diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index 8c0b470..bc14874 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -4,12 +4,14 @@ cmake_minimum_required(VERSION 3.3) enable_language(C) if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif() if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") diff --git a/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt index 92c9a29..402f9d5 100644 --- a/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt +++ b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt @@ -1 +1,3 @@ -BUILD AGGREGATE TARGET ZERO_CHECK +BUILD AGGREGATE TARGET ZERO_CHECK|PhaseScriptExecution [^ +]*/ZERO_CHECK.build/Script-[^ +]*in target 'ZERO_CHECK' from project 'XcodeDependOnZeroCheck' diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt new file mode 100644 index 0000000..02af783 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error in CMakeLists.txt: + The custom command generating + + [^ +]*/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-build/out.txt + + is attached to multiple targets: + + drive[0-9] + drive[0-9] + + but none of these is a common dependency of the other\(s\). This is not + allowed by the Xcode "new build system". diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake new file mode 100644 index 0000000..3ef1312 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake @@ -0,0 +1,3 @@ +add_custom_command(OUTPUT out.txt COMMAND false) +add_custom_target(drive1 DEPENDS out.txt) +add_custom_target(drive2 DEPENDS out.txt) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index c221033..19f8e2f 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -10,6 +10,7 @@ if(NOT IOS) message(FATAL_ERROR "IOS variable is not set") endif() +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake index 172f2e8..7d14d19 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake @@ -6,6 +6,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 038a890..974ae47 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -6,6 +6,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake index ab31387..75da7b1 100644 --- a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.5) +cmake_minimum_required(VERSION 3.3) project(XcodeInstallIOS) diff --git a/Tests/RunCMake/XcodeProject/iface.h b/Tests/RunCMake/XcodeProject/iface.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/iface.h diff --git a/Tests/RunCMake/XcodeProject/main.cpp b/Tests/RunCMake/XcodeProject/main.cpp index c94753f..f8b643a 100644 --- a/Tests/RunCMake/XcodeProject/main.cpp +++ b/Tests/RunCMake/XcodeProject/main.cpp @@ -1,4 +1,4 @@ -int main(int argc, const char* argv[]) +int main() { return 0; } diff --git a/Tests/RunCMake/XcodeProject/main.m b/Tests/RunCMake/XcodeProject/main.m index 6dc190a..3e70e50 100644 --- a/Tests/RunCMake/XcodeProject/main.m +++ b/Tests/RunCMake/XcodeProject/main.m @@ -1,3 +1,3 @@ -int main(int argc, const char * argv[]) { +int main(void) { return 1; } diff --git a/Tests/RunCMake/add_dependencies/CMakeLists.txt b/Tests/RunCMake/add_dependencies/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/add_dependencies/CMakeLists.txt +++ b/Tests/RunCMake/add_dependencies/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake new file mode 100644 index 0000000..c2ab433 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "abcdefghijklmnopqrstuvwxyz0123456789") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake new file mode 100644 index 0000000..77cd3eb --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "[=[InBracketBeforeSemi;InBracketAfterSemi]=]") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake new file mode 100644 index 0000000..268b622 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME \(\)\ \# ) +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..65bca10 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "$[] #;\t\n\"\\") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..ec90e13 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME " SurroundedByWhitespace ") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake new file mode 100644 index 0000000..f74c3b5 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "!§%&/ü:*😤~") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake new file mode 100644 index 0000000..a1ddb66 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeQuote\"\"AfterEscapedQuote") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake new file mode 100644 index 0000000..11fd4fb --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeSemi;AfterSemi") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake new file mode 100644 index 0000000..38dd28e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeSpace AfterSpace") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake new file mode 100644 index 0000000..bfd082b --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "abc_.+-012") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common.cmake b/Tests/RunCMake/add_test/CMP0110-Common.cmake new file mode 100644 index 0000000..915d171 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common.cmake @@ -0,0 +1,9 @@ +include(CTest) +add_test( + NAME "${TEST_NAME}" + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/CMP0110-Test.cmake" +) +set_property( + TEST "${TEST_NAME}" + PROPERTY ENVIRONMENT CMAKE_add_test_ENVVAR=1 +) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake new file mode 100644 index 0000000..7ea7042 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..7364d56 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \[=\[InBracketBeforeSemi;InBracketAfterSemi\]=\] \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake new file mode 100644 index 0000000..baef07c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake new file mode 100644 index 0000000..c9b06bd --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..5ad8694 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] .+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..86ddf14 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..f9b556a --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-NEW-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..0790536 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..78379cd --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: [ ]SurroundedByWhitespace[ ] \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..2d636a8 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake new file mode 100644 index 0000000..d77a6ce --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake new file mode 100644 index 0000000..2e7a6e1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake new file mode 100644 index 0000000..1c6e1b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake new file mode 100644 index 0000000..38afb85 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake new file mode 100644 index 0000000..62bb638 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake new file mode 100644 index 0000000..bf4e82b --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..093f5d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: InBracketBeforeSemi;InBracketAfterSemi \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake new file mode 100644 index 0000000..05dfeb4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..296e426 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error\. Function missing ending "\)"\. End of file reached\. + + +Errors while running CTest diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake new file mode 100644 index 0000000..1f0c99f --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..c656b4c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..d3b0fac --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..883c5b6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt new file mode 100644 index 0000000..06ad927 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt @@ -0,0 +1,3 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error. Function missing ending "\)". Instead found unterminated + string with text "\\ NOT_AVAILABLE\) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..47e03bc --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-OLD-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..7ee6b50 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..870483e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: SurroundedByWhitespace \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..a20d211 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake new file mode 100644 index 0000000..0e88183 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake new file mode 100644 index 0000000..c910a7c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt new file mode 100644 index 0000000..0d43768 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSemi diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt new file mode 100644 index 0000000..0a6ebed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSemi \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake new file mode 100644 index 0000000..283aeed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt new file mode 100644 index 0000000..2ded1d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSpace diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt new file mode 100644 index 0000000..059c625 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSpace \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake new file mode 100644 index 0000000..46f7c26 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake new file mode 100644 index 0000000..ffc6462 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Test.cmake b/Tests/RunCMake/add_test/CMP0110-Test.cmake new file mode 100644 index 0000000..3f1dfad --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Test.cmake @@ -0,0 +1,3 @@ +if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR}) + message(FATAL_ERROR "Setting property on test did not succeed!") +endif() diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake new file mode 100644 index 0000000..d2af2aa --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..093f5d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: InBracketBeforeSemi;InBracketAfterSemi \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt new file mode 100644 index 0000000..19e60c1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\[=\[InBracketBeforeSemi;InBracketAfterSemi\]=\]´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake new file mode 100644 index 0000000..7887658 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..296e426 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error\. Function missing ending "\)"\. End of file reached\. + + +Errors while running CTest diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt new file mode 100644 index 0000000..057f2d6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\(\) #´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake new file mode 100644 index 0000000..ca27462 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..c656b4c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..d3b0fac --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt new file mode 100644 index 0000000..4f20ab9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\$\[\] #;[ ] + + "\\´ + +This warning is for project developers\. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..3b689c2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt new file mode 100644 index 0000000..06ad927 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt @@ -0,0 +1,3 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error. Function missing ending "\)". Instead found unterminated + string with text "\\ NOT_AVAILABLE\) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt new file mode 100644 index 0000000..4f20ab9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\$\[\] #;[ ] + + "\\´ + +This warning is for project developers\. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..f77ff5c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-WARN-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..77c9ed2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..870483e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: SurroundedByWhitespace \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt new file mode 100644 index 0000000..a392fed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + ` SurroundedByWhitespace ´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..322bb4a --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake new file mode 100644 index 0000000..19fa6e6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt new file mode 100644 index 0000000..39f3a92 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeQuote""AfterEscapedQuote´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake new file mode 100644 index 0000000..33aaad0 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt new file mode 100644 index 0000000..0d43768 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSemi diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt new file mode 100644 index 0000000..0a6ebed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSemi \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt new file mode 100644 index 0000000..5101618 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeSemi;AfterSemi´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake new file mode 100644 index 0000000..c5da394 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt new file mode 100644 index 0000000..2ded1d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSpace diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt new file mode 100644 index 0000000..059c625 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSpace \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt new file mode 100644 index 0000000..862eaa2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeSpace AfterSpace´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake new file mode 100644 index 0000000..1f3234c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake new file mode 100644 index 0000000..687c899 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMakeLists.txt b/Tests/RunCMake/add_test/CMakeLists.txt new file mode 100644 index 0000000..ee8fc29 --- /dev/null +++ b/Tests/RunCMake/add_test/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake new file mode 100644 index 0000000..bf6cbff --- /dev/null +++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake @@ -0,0 +1,35 @@ +include(RunCMake) + +set(ENV{CTEST_OUTPUT_ON_FAILURE} 1) + +function(run_case CASE_NAME) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0110-${CASE_NAME}-build) + run_cmake(CMP0110-${CASE_NAME}) + # Run ctest on the generated CTestTestfile.cmake. + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(CMP0110-${CASE_NAME}-ctest ${CMAKE_CTEST_COMMAND} -C Debug) +endfunction() + +set(cases + AlphaNumeric + ValidSpecialChars + OtherSpecialChars + EscapedSpecialChars + Space + LeadingAndTrailingWhitespace + Semicolon + Quote + BracketArgument + ) + +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + list(APPEND cases FormerInvalidSpecialCharsMC) +else() + list(APPEND cases FormerInvalidSpecialChars) +endif() + +foreach(case IN LISTS cases) + run_case(WARN-${case}) + run_case(OLD-${case}) + run_case(NEW-${case}) +endforeach() diff --git a/Tests/RunCMake/alias_targets/CMakeLists.txt b/Tests/RunCMake/alias_targets/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/alias_targets/CMakeLists.txt +++ b/Tests/RunCMake/alias_targets/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/alias_targets/invalid-name.cmake b/Tests/RunCMake/alias_targets/invalid-name.cmake index bbd39e3..01983e5 100644 --- a/Tests/RunCMake/alias_targets/invalid-name.cmake +++ b/Tests/RunCMake/alias_targets/invalid-name.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.12) enable_language(CXX) add_library(foo empty.cpp) diff --git a/Tests/RunCMake/build_command/CMakeLists.txt b/Tests/RunCMake/build_command/CMakeLists.txt index 73e6a78..f1a83e8 100644 --- a/Tests/RunCMake/build_command/CMakeLists.txt +++ b/Tests/RunCMake/build_command/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) if(NOT NoProject) project(${RunCMake_TEST} NONE) endif() diff --git a/Tests/RunCMake/cmake_language/CallInvalidCommand.cmake b/Tests/RunCMake/cmake_language/CallInvalidCommand.cmake deleted file mode 100644 index 8bee6f2..0000000 --- a/Tests/RunCMake/cmake_language/CallInvalidCommand.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -cmake_language(CALL ${COMMAND}) diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake index 5fb93c8..6480b2e 100644 --- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -2,7 +2,16 @@ include(RunCMake) run_cmake(no_parameters) run_cmake(unknown_meta_operation) -run_cmake(call_invalid_command) +foreach(command IN ITEMS + "function" "ENDFUNCTION" + "macro" "endMACRO" + "if" "elseif" "else" "endif" + "while" "endwhile" + "foreach" "endforeach" + ) + message(STATUS "Running call_invalid_command for ${command}...") + run_cmake_with_options(call_invalid_command -Dcommand=${command}) +endforeach() run_cmake(call_valid_command) run_cmake(call_double_evaluation) run_cmake(call_expanded_command) @@ -23,3 +32,53 @@ run_cmake(eval_message_fatal_error) run_cmake(eval_no_code) run_cmake(eval_no_parameters) run_cmake(eval_variable_outside_message) +run_cmake(defer_call) +run_cmake(defer_call_add_subdirectory) +run_cmake(defer_call_enable_language) +run_cmake(defer_call_ids) +foreach(command IN ITEMS + "function" "endfunction" + "macro" "endmacro" + "if" "elseif" "else" "endif" + "while" "endwhile" + "foreach" "endforeach" + "return" + ) + message(STATUS "Running defer_call_invalid_command for ${command}...") + run_cmake_with_options(defer_call_invalid_command -Dcommand=${command}) +endforeach() +run_cmake(defer_call_invalid_directory) +run_cmake(defer_call_error) +run_cmake(defer_call_missing_directory) +run_cmake(defer_call_policy_PUSH) +run_cmake(defer_call_syntax_error) +run_cmake_with_options(defer_call_trace --trace-expand) +run_cmake_with_options(defer_call_trace_json --trace --trace-format=json-v1) +run_cmake(defer_cancel_call_unknown_argument) +run_cmake(defer_cancel_call_invalid_directory) +run_cmake(defer_cancel_call_id) +run_cmake(defer_cancel_call_id_var) +run_cmake(defer_directory_empty) +run_cmake(defer_directory_missing) +run_cmake(defer_directory_multiple) +run_cmake(defer_id_empty) +run_cmake(defer_id_missing) +run_cmake(defer_id_multiple) +run_cmake(defer_id_var_empty) +run_cmake(defer_id_var_missing) +run_cmake(defer_id_var_multiple) +run_cmake(defer_get_call_ids_missing_var) +run_cmake(defer_get_call_ids_too_many_args) +run_cmake(defer_get_call_ids_invalid_directory) +run_cmake(defer_get_call_ids_id) +run_cmake(defer_get_call_ids_id_var) +run_cmake(defer_get_call_missing_id) +run_cmake(defer_get_call_missing_var) +run_cmake(defer_get_call_too_many_args) +run_cmake(defer_get_call_id_empty) +run_cmake(defer_get_call_unknown_argument) +run_cmake(defer_get_call_id) +run_cmake(defer_get_call_id_var) +run_cmake(defer_missing_arg) +run_cmake(defer_missing_call) +run_cmake(defer_unknown_option) diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name.cmake b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake index e03bb1f..f74d303 100644 --- a/Tests/RunCMake/cmake_language/call_expand_command_name.cmake +++ b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake @@ -1,2 +1,2 @@ set (my_call "CALL") -cmake_language (${my_call} message "OK!") +cmake_language (${my_call} ${empty} message "OK!") diff --git a/Tests/RunCMake/cmake_language/call_expanded_command.cmake b/Tests/RunCMake/cmake_language/call_expanded_command.cmake index e76e612..c52468d 100644 --- a/Tests/RunCMake/cmake_language/call_expanded_command.cmake +++ b/Tests/RunCMake/cmake_language/call_expanded_command.cmake @@ -3,4 +3,4 @@ function (itsok) endfunction() set (cmd CALL itsok) -cmake_language (${cmd}) +cmake_language (${empty} ${cmd}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt index e87e9bc..82411d2 100644 --- a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt @@ -1,4 +1,4 @@ CMake Error at call_expanded_command_and_arguments.cmake:2 \(cmake_language\): - cmake_language called with incorrect number of arguments + cmake_language CALL command's arguments must be literal Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_invalid_command-result.txt b/Tests/RunCMake/cmake_language/call_invalid_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_invalid_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_invalid_command-stderr.txt b/Tests/RunCMake/cmake_language/call_invalid_command-stderr.txt new file mode 100644 index 0000000..4439842 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_invalid_command-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at call_invalid_command.cmake:1 \(cmake_language\): + cmake_language invalid command specified: [A-Za-z_]+ +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/call_invalid_command.cmake b/Tests/RunCMake/cmake_language/call_invalid_command.cmake index 88bf08c..f213895 100644 --- a/Tests/RunCMake/cmake_language/call_invalid_command.cmake +++ b/Tests/RunCMake/cmake_language/call_invalid_command.cmake @@ -1,14 +1 @@ - -foreach (command IN ITEMS "function" "ENDFUNCTION" - "macro" "endMACRO" - "if" "elseif" "else" "endif" - "while" "endwhile" - "foreach" "endforeach") - execute_process(COMMAND "${CMAKE_COMMAND}" -DCOMMAND=${command} - -P "${CMAKE_CURRENT_SOURCE_DIR}/CallInvalidCommand.cmake" - OUTPUT_QUIET ERROR_QUIET - RESULT_VARIABLE result) - if (NOT result) - message (SEND_ERROR "cmake_language(CALL ${command}) unexpectedly successfull.") - endif() -endforeach() +cmake_language(CALL ${command}) diff --git a/Tests/RunCMake/cmake_language/call_message.cmake b/Tests/RunCMake/cmake_language/call_message.cmake index 31aefdf..3b98c80 100644 --- a/Tests/RunCMake/cmake_language/call_message.cmake +++ b/Tests/RunCMake/cmake_language/call_message.cmake @@ -1 +1 @@ -cmake_language(CALL message WORKS!) +cmake_language(CALL ${empty} message WORKS!) diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt index 9e2c08f..f6a0458 100644 --- a/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt +++ b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt @@ -1,2 +1,2 @@ CMake Error at call_no_parameters.cmake:1 \(cmake_language\): - cmake_language called with incorrect number of arguments + cmake_language CALL missing command name diff --git a/Tests/RunCMake/cmake_language/defer_call-stderr.txt b/Tests/RunCMake/cmake_language/defer_call-stderr.txt new file mode 100644 index 0000000..7e8d8ca --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call-stderr.txt @@ -0,0 +1,15 @@ +^CMake Deprecation Warning at defer_call/CMakeLists.txt:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0053 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. ++ +CMake Warning at defer_call/CMakeLists.txt:3 \(message\): + Double-Deferred Warning In Subdirectory: + + '[^']*/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt:DEFERRED:id3' +Call Stack \(most recent call first\): + defer_call/CMakeLists.txt:DEFERRED$ diff --git a/Tests/RunCMake/cmake_language/defer_call-stdout.txt b/Tests/RunCMake/cmake_language/defer_call-stdout.txt new file mode 100644 index 0000000..fcf9f29 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call-stdout.txt @@ -0,0 +1,8 @@ +-- Immediate Message In Subdirectory: ids='__0;__1' +-- Deferred Message In Subdirectory: '[^']*/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt:DEFERRED:id1' +-- Deferred Message In Included File: '[^']*/Tests/RunCMake/cmake_language/defer_call/include.cmake:1' +-- Immediate Message: ids='__0;__1;__2;__3;__4' +-- First Deferred Message +-- Deferred Message From Subdirectory +-- Deferred Message: ids='__4;__5' +-- Final Deferred Message diff --git a/Tests/RunCMake/cmake_language/defer_call.cmake b/Tests/RunCMake/cmake_language/defer_call.cmake new file mode 100644 index 0000000..2e9595f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call.cmake @@ -0,0 +1,12 @@ +set(message_command "message") +set(final_message "This should not be printed because variable evaluation is deferred too.") +cmake_language(DEFER CALL ${message_command} STATUS "First Deferred Message") +add_subdirectory(defer_call) +cmake_language(DEFER CALL cmake_language DEFER CALL "${final_message_command}" STATUS "${final_message}") +cmake_language(DEFER CALL cmake_language DEFER GET_CALL_IDS ids) +cmake_language(DEFER CALL cmake_language EVAL CODE [[message(STATUS "Deferred Message: ids='${ids}'")]]) +cmake_language(DEFER GET_CALL_IDS ids) +message(STATUS "Immediate Message: ids='${ids}'") +set(final_message_command "message") +set(final_message "Final Deferred Message") +set(subdir_message "Deferred Message From Subdirectory") diff --git a/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt new file mode 100644 index 0000000..544b9f4 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0053 OLD) +cmake_language(DEFER ID id1 CALL message STATUS "Deferred Message In Subdirectory: '${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}'") +cmake_language(DEFER ID id2 CALL + cmake_language DEFER ID id3 CALL + message WARNING "Double-Deferred Warning In Subdirectory:\n '${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}'") +cmake_language(DEFER ID id4 CALL include "${CMAKE_CURRENT_LIST_DIR}/include.cmake") + +set(subdir_message "This should not be printed because variable evaluation is in deferred scope.") +cmake_language(DEFER DIRECTORY .. CALL message STATUS "${subdir_message}") +cmake_language(DEFER DIRECTORY .. GET_CALL_IDS ids) +message(STATUS "Immediate Message In Subdirectory: ids='${ids}'") diff --git a/Tests/RunCMake/cmake_language/defer_call/include.cmake b/Tests/RunCMake/cmake_language/defer_call/include.cmake new file mode 100644 index 0000000..272c61b --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call/include.cmake @@ -0,0 +1 @@ +message(STATUS "Deferred Message In Included File: '${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}'") diff --git a/Tests/RunCMake/cmake_language/defer_call_add_subdirectory-result.txt b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_add_subdirectory-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory-stderr.txt new file mode 100644 index 0000000..ec20b8f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_call_add_subdirectory.cmake:1 \(add_subdirectory\): + Subdirectories may not be created during deferred execution. +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED ++ +CMake Error at defer_call_add_subdirectory.cmake:2 \(subdirs\): + Subdirectories may not be created during deferred execution. +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED$ diff --git a/Tests/RunCMake/cmake_language/defer_call_add_subdirectory.cmake b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory.cmake new file mode 100644 index 0000000..6b7ee63 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory.cmake @@ -0,0 +1,2 @@ +cmake_language(DEFER CALL add_subdirectory defer_call_add_subdirectory) +cmake_language(DEFER CALL subdirs defer_call_add_subdirectory) diff --git a/Tests/RunCMake/cmake_language/defer_call_add_subdirectory/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory/CMakeLists.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_add_subdirectory/CMakeLists.txt diff --git a/Tests/RunCMake/cmake_language/defer_call_enable_language-result.txt b/Tests/RunCMake/cmake_language/defer_call_enable_language-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_enable_language-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_enable_language-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_enable_language-stderr.txt new file mode 100644 index 0000000..65a0b99 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_enable_language-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_call_enable_language.cmake:1 \(enable_language\): + Languages may not be enabled during deferred execution. +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED ++ +CMake Error at defer_call_enable_language.cmake:2 \(project\): + Languages may not be enabled during deferred execution. +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED$ diff --git a/Tests/RunCMake/cmake_language/defer_call_enable_language.cmake b/Tests/RunCMake/cmake_language/defer_call_enable_language.cmake new file mode 100644 index 0000000..eb43f80 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_enable_language.cmake @@ -0,0 +1,2 @@ +cmake_language(DEFER CALL enable_language C) +cmake_language(DEFER CALL project foo C) diff --git a/Tests/RunCMake/cmake_language/defer_call_error-result.txt b/Tests/RunCMake/cmake_language/defer_call_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_error-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_error-stderr.txt new file mode 100644 index 0000000..63ce145 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_error-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_call_error.cmake:2 \(message\): + Deferred Error +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED ++ +CMake Error at defer_call_error/CMakeLists.txt:2 \(message\): + Deferred Error from Subdirectory +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED$ diff --git a/Tests/RunCMake/cmake_language/defer_call_error.cmake b/Tests/RunCMake/cmake_language/defer_call_error.cmake new file mode 100644 index 0000000..083e82a --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_error.cmake @@ -0,0 +1,3 @@ +# Error message backtrace points here but call stack shows DEFERRED execution. +cmake_language(DEFER CALL message SEND_ERROR "Deferred Error") +add_subdirectory(defer_call_error) diff --git a/Tests/RunCMake/cmake_language/defer_call_error/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_call_error/CMakeLists.txt new file mode 100644 index 0000000..0acac69 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_error/CMakeLists.txt @@ -0,0 +1,2 @@ +# Error message backtrace points here but call stack shows DEFERRED execution in parent. +cmake_language(DEFER DIRECTORY .. CALL message SEND_ERROR "Deferred Error from Subdirectory") diff --git a/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt b/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt new file mode 100644 index 0000000..2fd194d --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt @@ -0,0 +1,13 @@ +-- Immediate Message: ids='message0;getCallIds1;messageIds1;cancelCall;getCallIds2;messageIds2;toBeCancelled;message3' +-- Immediate Message: message0='message;STATUS;First Deferred Message' +-- Immediate Message: getCallIds1='cmake_language;DEFER;GET_CALL_IDS;ids' +-- Immediate Message: messageIds1='cmake_language;EVAL;CODE;message\(STATUS "Deferred Message: ids='\${ids}'"\)' +-- Immediate Message: cancelCall='cmake_language;DEFER;CANCEL_CALL;toBeCancelled' +-- Immediate Message: getCallIds2='cmake_language;DEFER;GET_CALL_IDS;ids' +-- Immediate Message: messageIds2='cmake_language;EVAL;CODE;message\(STATUS "Deferred Message: ids='\${ids}'"\)' +-- Immediate Message: toBeCancelled='message;STATUS;Cancelled Message' +-- Immediate Message: message3='message;STATUS;Final Deferred Message' +-- First Deferred Message +-- Deferred Message: ids='messageIds1;cancelCall;getCallIds2;messageIds2;toBeCancelled;message3' +-- Deferred Message: ids='messageIds2;message3' +-- Final Deferred Message diff --git a/Tests/RunCMake/cmake_language/defer_call_ids.cmake b/Tests/RunCMake/cmake_language/defer_call_ids.cmake new file mode 100644 index 0000000..2874894 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_ids.cmake @@ -0,0 +1,14 @@ +cmake_language(DEFER ID message0 CALL message STATUS "First Deferred Message") +cmake_language(DEFER ID getCallIds1 CALL cmake_language DEFER GET_CALL_IDS ids) +cmake_language(DEFER ID messageIds1 CALL cmake_language EVAL CODE [[message(STATUS "Deferred Message: ids='${ids}'")]]) +cmake_language(DEFER ID cancelCall CALL cmake_language DEFER CANCEL_CALL toBeCancelled) +cmake_language(DEFER ID getCallIds2 CALL cmake_language DEFER GET_CALL_IDS ids) +cmake_language(DEFER ID messageIds2 CALL cmake_language EVAL CODE [[message(STATUS "Deferred Message: ids='${ids}'")]]) +cmake_language(DEFER ID toBeCancelled CALL message STATUS "Cancelled Message") +cmake_language(DEFER ID message3 CALL message STATUS "Final Deferred Message") +cmake_language(DEFER GET_CALL_IDS ids) +message(STATUS "Immediate Message: ids='${ids}'") +foreach(id ${ids}) + cmake_language(DEFER GET_CALL ${id} call) + message(STATUS "Immediate Message: ${id}='${call}'") +endforeach() diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_command-result.txt b/Tests/RunCMake/cmake_language/defer_call_invalid_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_command-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_invalid_command-stderr.txt new file mode 100644 index 0000000..4cdbf0c --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_command-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_call_invalid_command.cmake:1 \(cmake_language\): + cmake_language invalid command specified: [A-Za-z_]+ +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_command.cmake b/Tests/RunCMake/cmake_language/defer_call_invalid_command.cmake new file mode 100644 index 0000000..d6cc936 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_command.cmake @@ -0,0 +1 @@ +cmake_language(DEFER CALL ${command}) diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_directory-result.txt b/Tests/RunCMake/cmake_language/defer_call_invalid_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_directory-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_invalid_directory-stderr.txt new file mode 100644 index 0000000..afe9a0e --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_directory-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_call_invalid_directory.cmake:2 \(cmake_language\): + cmake_language DEFER CALL may not be scheduled in directory: + + [^ +]*/Tests/RunCMake/cmake_language/defer_call_invalid_directory-build/defer_call_invalid_directory + + at this time. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_directory.cmake b/Tests/RunCMake/cmake_language/defer_call_invalid_directory.cmake new file mode 100644 index 0000000..cc1eb8d --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_directory.cmake @@ -0,0 +1,2 @@ +add_subdirectory(defer_call_invalid_directory) +cmake_language(DEFER DIRECTORY defer_call_invalid_directory CALL message "Should not be allowed.") diff --git a/Tests/RunCMake/cmake_language/defer_call_invalid_directory/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_call_invalid_directory/CMakeLists.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_invalid_directory/CMakeLists.txt diff --git a/Tests/RunCMake/cmake_language/defer_call_missing_directory-result.txt b/Tests/RunCMake/cmake_language/defer_call_missing_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_missing_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_missing_directory-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_missing_directory-stderr.txt new file mode 100644 index 0000000..db4f90e --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_missing_directory-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_call_missing_directory.cmake:1 \(cmake_language\): + cmake_language DEFER DIRECTORY: + + [^ +]*/Tests/RunCMake/cmake_language/does_not_exist + + is not known. It may not have been processed yet. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_call_missing_directory.cmake b/Tests/RunCMake/cmake_language/defer_call_missing_directory.cmake new file mode 100644 index 0000000..01f4c40 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_missing_directory.cmake @@ -0,0 +1 @@ +cmake_language(DEFER DIRECTORY does_not_exist CALL message "Should not be allowed.") diff --git a/Tests/RunCMake/cmake_language/defer_call_policy_PUSH-result.txt b/Tests/RunCMake/cmake_language/defer_call_policy_PUSH-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_policy_PUSH-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_policy_PUSH-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_policy_PUSH-stderr.txt new file mode 100644 index 0000000..923be13 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_policy_PUSH-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at CMakeLists.txt:DEFERRED: + cmake_policy PUSH without matching POP$ diff --git a/Tests/RunCMake/cmake_language/defer_call_policy_PUSH.cmake b/Tests/RunCMake/cmake_language/defer_call_policy_PUSH.cmake new file mode 100644 index 0000000..66cb760 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_policy_PUSH.cmake @@ -0,0 +1 @@ +cmake_language(DEFER CALL cmake_policy PUSH) diff --git a/Tests/RunCMake/cmake_language/defer_call_syntax_error-result.txt b/Tests/RunCMake/cmake_language/defer_call_syntax_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_syntax_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_call_syntax_error-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_syntax_error-stderr.txt new file mode 100644 index 0000000..80db4aa --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_syntax_error-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at defer_call_syntax_error.cmake:2 \(message\): + Syntax error in cmake code at + + [^ +]*/Tests/RunCMake/cmake_language/defer_call_syntax_error.cmake:2 + + when parsing string + + Deferred \\X Error + + Invalid character escape '\\X'. +Call Stack \(most recent call first\): + CMakeLists.txt:DEFERRED$ diff --git a/Tests/RunCMake/cmake_language/defer_call_syntax_error.cmake b/Tests/RunCMake/cmake_language/defer_call_syntax_error.cmake new file mode 100644 index 0000000..c3c044b --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_syntax_error.cmake @@ -0,0 +1,2 @@ +# Argument syntax error evaluated at deferred call site. +cmake_language(DEFER CALL message "Deferred \X Error") diff --git a/Tests/RunCMake/cmake_language/defer_call_trace-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_trace-stderr.txt new file mode 100644 index 0000000..b61b236 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_trace-stderr.txt @@ -0,0 +1,8 @@ +[^ +]*/Tests/RunCMake/cmake_language/defer_call_trace.cmake\(2\): cmake_language\(DEFER CALL message Deferred Message \) +[^ +]*/Tests/RunCMake/cmake_language/defer_call_trace.cmake\(3\): message\(Immediate Message \) +Immediate Message +[^ +]*/Tests/RunCMake/cmake_language/defer_call_trace.cmake\(2\):DEFERRED:__0: message\(Deferred Message \) +Deferred Message$ diff --git a/Tests/RunCMake/cmake_language/defer_call_trace.cmake b/Tests/RunCMake/cmake_language/defer_call_trace.cmake new file mode 100644 index 0000000..5ed383f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_trace.cmake @@ -0,0 +1,3 @@ +# The --trace and --trace-expand output point here for deferred call. +cmake_language(DEFER CALL message "Deferred Message") +message("Immediate Message") diff --git a/Tests/RunCMake/cmake_language/defer_call_trace_json-stderr.txt b/Tests/RunCMake/cmake_language/defer_call_trace_json-stderr.txt new file mode 100644 index 0000000..647beb0 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_trace_json-stderr.txt @@ -0,0 +1,5 @@ +{"args":\["DEFER","CALL","message","Deferred Message"\],"cmd":"cmake_language","file":"[^"]*/Tests/RunCMake/cmake_language/defer_call_trace_json.cmake","frame":2,"line":2,"time":[0-9.]+} +{"args":\["Immediate Message"\],"cmd":"message","file":"[^"]*/Tests/RunCMake/cmake_language/defer_call_trace_json.cmake","frame":2,"line":3,"time":[0-9.]+} +Immediate Message +{"args":\["Deferred Message"],"cmd":"message","defer":"__0","file":"[^"]*/Tests/RunCMake/cmake_language/defer_call_trace_json.cmake","frame":1,"line":2,"time":[0-9.]+} +Deferred Message$ diff --git a/Tests/RunCMake/cmake_language/defer_call_trace_json.cmake b/Tests/RunCMake/cmake_language/defer_call_trace_json.cmake new file mode 100644 index 0000000..5ed383f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_call_trace_json.cmake @@ -0,0 +1,3 @@ +# The --trace and --trace-expand output point here for deferred call. +cmake_language(DEFER CALL message "Deferred Message") +message("Immediate Message") diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_id-result.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_id-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_id-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_id-stderr.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_id-stderr.txt new file mode 100644 index 0000000..8a13c0d --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_id-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_cancel_call_id.cmake:1 \(cmake_language\): + cmake_language DEFER CANCEL_CALL does not accept ID or ID_VAR. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_id.cmake b/Tests/RunCMake/cmake_language/defer_cancel_call_id.cmake new file mode 100644 index 0000000..6e5b5c8 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_id.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID id CANCEL_CALL) diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_id_var-result.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_id_var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_id_var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_id_var-stderr.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_id_var-stderr.txt new file mode 100644 index 0000000..5783c50 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_id_var-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_cancel_call_id_var.cmake:1 \(cmake_language\): + cmake_language DEFER CANCEL_CALL does not accept ID or ID_VAR. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_id_var.cmake b/Tests/RunCMake/cmake_language/defer_cancel_call_id_var.cmake new file mode 100644 index 0000000..9f75221 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_id_var.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID_VAR id_var CANCEL_CALL) diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-result.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-stderr.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-stderr.txt new file mode 100644 index 0000000..cacbf9a --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_cancel_call_invalid_directory.cmake:2 \(cmake_language\): + cmake_language DEFER CANCEL_CALL may not update directory: + + [^ +]*/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory-build/defer_cancel_call_invalid_directory + + at this time. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory.cmake b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory.cmake new file mode 100644 index 0000000..29a8fc2 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory.cmake @@ -0,0 +1,2 @@ +add_subdirectory(defer_cancel_call_invalid_directory) +cmake_language(DEFER DIRECTORY defer_cancel_call_invalid_directory CANCEL_CALL _) diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory/CMakeLists.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_invalid_directory/CMakeLists.txt diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument-result.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument-stderr.txt b/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument-stderr.txt new file mode 100644 index 0000000..eb8f2b9 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at defer_cancel_call_unknown_argument.cmake:1 \(cmake_language\): + cmake_language DEFER CANCEL_CALL unknown argument: + + UNKNOWN +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument.cmake b/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument.cmake new file mode 100644 index 0000000..fbc6309 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_cancel_call_unknown_argument.cmake @@ -0,0 +1 @@ +cmake_language(DEFER CANCEL_CALL UNKNOWN) diff --git a/Tests/RunCMake/cmake_language/defer_directory_empty-result.txt b/Tests/RunCMake/cmake_language/defer_directory_empty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_empty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_directory_empty-stderr.txt b/Tests/RunCMake/cmake_language/defer_directory_empty-stderr.txt new file mode 100644 index 0000000..587dfa9 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_empty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_directory_empty.cmake:1 \(cmake_language\): + cmake_language DEFER DIRECTORY may not be empty +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_directory_empty.cmake b/Tests/RunCMake/cmake_language/defer_directory_empty.cmake new file mode 100644 index 0000000..f4e4553 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_empty.cmake @@ -0,0 +1 @@ +cmake_language(DEFER DIRECTORY "") diff --git a/Tests/RunCMake/cmake_language/defer_directory_missing-result.txt b/Tests/RunCMake/cmake_language/defer_directory_missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_directory_missing-stderr.txt b/Tests/RunCMake/cmake_language/defer_directory_missing-stderr.txt new file mode 100644 index 0000000..1db8e99 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_missing-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_directory_missing.cmake:1 \(cmake_language\): + cmake_language DEFER DIRECTORY missing value +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_directory_missing.cmake b/Tests/RunCMake/cmake_language/defer_directory_missing.cmake new file mode 100644 index 0000000..fbdb177 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_missing.cmake @@ -0,0 +1 @@ +cmake_language(DEFER DIRECTORY) diff --git a/Tests/RunCMake/cmake_language/defer_directory_multiple-result.txt b/Tests/RunCMake/cmake_language/defer_directory_multiple-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_multiple-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_directory_multiple-stderr.txt b/Tests/RunCMake/cmake_language/defer_directory_multiple-stderr.txt new file mode 100644 index 0000000..f4d09b9 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_multiple-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_directory_multiple.cmake:1 \(cmake_language\): + cmake_language DEFER given multiple DIRECTORY arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_directory_multiple.cmake b/Tests/RunCMake/cmake_language/defer_directory_multiple.cmake new file mode 100644 index 0000000..baf037b --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_directory_multiple.cmake @@ -0,0 +1 @@ +cmake_language(DEFER DIRECTORY . DIRECTORY x CALL message "Should not be allowed.") diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_id-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_id-stderr.txt new file mode 100644 index 0000000..e161a5f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_id.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL does not accept ID or ID_VAR. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id.cmake b/Tests/RunCMake/cmake_language/defer_get_call_id.cmake new file mode 100644 index 0000000..7a395ea --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID id GET_CALL) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id_empty-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_id_empty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id_empty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id_empty-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_id_empty-stderr.txt new file mode 100644 index 0000000..c7c534b --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id_empty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_id_empty.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL id may not be empty +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id_empty.cmake b/Tests/RunCMake/cmake_language/defer_get_call_id_empty.cmake new file mode 100644 index 0000000..4f39f2d --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id_empty.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL "" var) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id_var-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_id_var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id_var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id_var-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_id_var-stderr.txt new file mode 100644 index 0000000..2cfd942 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id_var-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_id_var.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL does not accept ID or ID_VAR. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_id_var.cmake b/Tests/RunCMake/cmake_language/defer_get_call_id_var.cmake new file mode 100644 index 0000000..ade0815 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_id_var.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID_VAR id_var GET_CALL) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_id-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_id-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_id-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_id-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_id-stderr.txt new file mode 100644 index 0000000..072ee45 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_id-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_ids_id.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL_IDS does not accept ID or ID_VAR. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_id.cmake b/Tests/RunCMake/cmake_language/defer_get_call_ids_id.cmake new file mode 100644 index 0000000..4eb2555 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_id.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID id GET_CALL_IDS) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var-stderr.txt new file mode 100644 index 0000000..e4a288c --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_ids_id_var.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL_IDS does not accept ID or ID_VAR. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var.cmake b/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var.cmake new file mode 100644 index 0000000..c27de79 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_id_var.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID_VAR id_var GET_CALL_IDS) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-stderr.txt new file mode 100644 index 0000000..edebe32 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at defer_get_call_ids_invalid_directory.cmake:2 \(cmake_language\): + cmake_language DEFER GET_CALL_IDS may not access directory: + + [^ +]*/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory-build/defer_get_call_ids_invalid_directory + + at this time. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory.cmake b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory.cmake new file mode 100644 index 0000000..81f098e --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory.cmake @@ -0,0 +1,2 @@ +add_subdirectory(defer_get_call_ids_invalid_directory) +cmake_language(DEFER DIRECTORY defer_get_call_ids_invalid_directory GET_CALL_IDS var) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory/CMakeLists.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory/CMakeLists.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_invalid_directory/CMakeLists.txt diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var-stderr.txt new file mode 100644 index 0000000..a2951cf --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_ids_missing_var.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL_IDS missing output variable +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var.cmake b/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var.cmake new file mode 100644 index 0000000..b171f04 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_missing_var.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL_IDS) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args-stderr.txt new file mode 100644 index 0000000..5691519 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_ids_too_many_args.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL_IDS given too many arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args.cmake b/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args.cmake new file mode 100644 index 0000000..0158684 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_ids_too_many_args.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL_IDS var extra) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_missing_id-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_missing_id-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_missing_id-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_missing_id-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_missing_id-stderr.txt new file mode 100644 index 0000000..081aa95 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_missing_id-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_missing_id.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL missing id +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_missing_id.cmake b/Tests/RunCMake/cmake_language/defer_get_call_missing_id.cmake new file mode 100644 index 0000000..0542abc --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_missing_id.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_missing_var-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_missing_var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_missing_var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_missing_var-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_missing_var-stderr.txt new file mode 100644 index 0000000..1b2641f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_missing_var-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_missing_var.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL missing output variable +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_missing_var.cmake b/Tests/RunCMake/cmake_language/defer_get_call_missing_var.cmake new file mode 100644 index 0000000..7916d29 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_missing_var.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL id) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_too_many_args-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_too_many_args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_too_many_args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_too_many_args-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_too_many_args-stderr.txt new file mode 100644 index 0000000..b6ee2d6 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_too_many_args-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_get_call_too_many_args.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL given too many arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_too_many_args.cmake b/Tests/RunCMake/cmake_language/defer_get_call_too_many_args.cmake new file mode 100644 index 0000000..ed65779 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_too_many_args.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL id var extra) diff --git a/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument-result.txt b/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument-stderr.txt b/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument-stderr.txt new file mode 100644 index 0000000..ac16596 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at defer_get_call_unknown_argument.cmake:1 \(cmake_language\): + cmake_language DEFER GET_CALL unknown argument: + + UNKNOWN +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument.cmake b/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument.cmake new file mode 100644 index 0000000..d0caa39 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_get_call_unknown_argument.cmake @@ -0,0 +1 @@ +cmake_language(DEFER GET_CALL UNKNOWN var) diff --git a/Tests/RunCMake/cmake_language/defer_id_empty-result.txt b/Tests/RunCMake/cmake_language/defer_id_empty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_empty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_id_empty-stderr.txt b/Tests/RunCMake/cmake_language/defer_id_empty-stderr.txt new file mode 100644 index 0000000..1e7f772 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_empty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_id_empty.cmake:1 \(cmake_language\): + cmake_language DEFER ID may not be empty +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_id_empty.cmake b/Tests/RunCMake/cmake_language/defer_id_empty.cmake new file mode 100644 index 0000000..326762c --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_empty.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID "") diff --git a/Tests/RunCMake/cmake_language/defer_id_missing-result.txt b/Tests/RunCMake/cmake_language/defer_id_missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_id_missing-stderr.txt b/Tests/RunCMake/cmake_language/defer_id_missing-stderr.txt new file mode 100644 index 0000000..cef5f0e --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_missing-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_id_missing.cmake:1 \(cmake_language\): + cmake_language DEFER ID missing value +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_id_missing.cmake b/Tests/RunCMake/cmake_language/defer_id_missing.cmake new file mode 100644 index 0000000..4de687d --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_missing.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID) diff --git a/Tests/RunCMake/cmake_language/defer_id_multiple-result.txt b/Tests/RunCMake/cmake_language/defer_id_multiple-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_multiple-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_id_multiple-stderr.txt b/Tests/RunCMake/cmake_language/defer_id_multiple-stderr.txt new file mode 100644 index 0000000..1725521 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_multiple-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_id_multiple.cmake:1 \(cmake_language\): + cmake_language DEFER given multiple ID arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_id_multiple.cmake b/Tests/RunCMake/cmake_language/defer_id_multiple.cmake new file mode 100644 index 0000000..69187af --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_multiple.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID a ID b CALL message "Should not be allowed.") diff --git a/Tests/RunCMake/cmake_language/defer_id_var_empty-result.txt b/Tests/RunCMake/cmake_language/defer_id_var_empty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_empty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_id_var_empty-stderr.txt b/Tests/RunCMake/cmake_language/defer_id_var_empty-stderr.txt new file mode 100644 index 0000000..bb5cd43 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_empty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_id_var_empty.cmake:1 \(cmake_language\): + cmake_language DEFER ID_VAR may not be empty +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_id_var_empty.cmake b/Tests/RunCMake/cmake_language/defer_id_var_empty.cmake new file mode 100644 index 0000000..c7198f5 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_empty.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID_VAR "") diff --git a/Tests/RunCMake/cmake_language/defer_id_var_missing-result.txt b/Tests/RunCMake/cmake_language/defer_id_var_missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_id_var_missing-stderr.txt b/Tests/RunCMake/cmake_language/defer_id_var_missing-stderr.txt new file mode 100644 index 0000000..f4e0d6e --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_missing-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_id_var_missing.cmake:1 \(cmake_language\): + cmake_language DEFER ID_VAR missing variable name +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_id_var_missing.cmake b/Tests/RunCMake/cmake_language/defer_id_var_missing.cmake new file mode 100644 index 0000000..359d149 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_missing.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID_VAR) diff --git a/Tests/RunCMake/cmake_language/defer_id_var_multiple-result.txt b/Tests/RunCMake/cmake_language/defer_id_var_multiple-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_multiple-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_id_var_multiple-stderr.txt b/Tests/RunCMake/cmake_language/defer_id_var_multiple-stderr.txt new file mode 100644 index 0000000..4368b06 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_multiple-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_id_var_multiple.cmake:1 \(cmake_language\): + cmake_language DEFER given multiple ID_VAR arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_id_var_multiple.cmake b/Tests/RunCMake/cmake_language/defer_id_var_multiple.cmake new file mode 100644 index 0000000..665ea94 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_id_var_multiple.cmake @@ -0,0 +1 @@ +cmake_language(DEFER ID_VAR a ID_VAR b CALL message "Should not be allowed.") diff --git a/Tests/RunCMake/cmake_language/defer_missing_arg-result.txt b/Tests/RunCMake/cmake_language/defer_missing_arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_missing_arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_missing_arg-stderr.txt b/Tests/RunCMake/cmake_language/defer_missing_arg-stderr.txt new file mode 100644 index 0000000..3e656cd --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_missing_arg-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_missing_arg.cmake:1 \(cmake_language\): + cmake_language DEFER requires at least one argument +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_missing_arg.cmake b/Tests/RunCMake/cmake_language/defer_missing_arg.cmake new file mode 100644 index 0000000..737a8c8 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_missing_arg.cmake @@ -0,0 +1 @@ +cmake_language(DEFER) diff --git a/Tests/RunCMake/cmake_language/defer_missing_call-result.txt b/Tests/RunCMake/cmake_language/defer_missing_call-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_missing_call-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_missing_call-stderr.txt b/Tests/RunCMake/cmake_language/defer_missing_call-stderr.txt new file mode 100644 index 0000000..7eeef76 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_missing_call-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at defer_missing_call.cmake:1 \(cmake_language\): + cmake_language DEFER must be followed by a CALL argument +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_missing_call.cmake b/Tests/RunCMake/cmake_language/defer_missing_call.cmake new file mode 100644 index 0000000..0b330ef --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_missing_call.cmake @@ -0,0 +1 @@ +cmake_language(DEFER DIRECTORY .) diff --git a/Tests/RunCMake/cmake_language/defer_unknown_option-result.txt b/Tests/RunCMake/cmake_language/defer_unknown_option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_unknown_option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/defer_unknown_option-stderr.txt b/Tests/RunCMake/cmake_language/defer_unknown_option-stderr.txt new file mode 100644 index 0000000..95d87c6 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_unknown_option-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at defer_unknown_option.cmake:1 \(cmake_language\): + cmake_language DEFER unknown option: + + UNKNOWN +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/defer_unknown_option.cmake b/Tests/RunCMake/cmake_language/defer_unknown_option.cmake new file mode 100644 index 0000000..876b3f1 --- /dev/null +++ b/Tests/RunCMake/cmake_language/defer_unknown_option.cmake @@ -0,0 +1 @@ +cmake_language(DEFER UNKNOWN) diff --git a/Tests/RunCMake/cmake_language/no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt index 194bbe3..1862c77 100644 --- a/Tests/RunCMake/cmake_language/no_parameters-stderr.txt +++ b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt @@ -1,2 +1,2 @@ CMake Error at no_parameters.cmake:1 \(cmake_language\): - cmake_language called with incorrect number of arguments + cmake_language CALL missing command name diff --git a/Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt new file mode 100644 index 0000000..7d40dcb --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt @@ -0,0 +1,26 @@ +^CMake Deprecation Warning at Before2812.cmake:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at Before2812.cmake:2 \(cmake_policy\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at Before2812.cmake:6 \(cmake_policy\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_minimum_required/Before2812.cmake b/Tests/RunCMake/cmake_minimum_required/Before2812.cmake new file mode 100644 index 0000000..220e359 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before2812.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8.11) +cmake_policy(VERSION 2.6) +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call +cmake_policy(POP) +cmake_policy(VERSION 2.8.11) diff --git a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt index e8db6b0..667561e 100644 --- a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt +++ b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt index a874466..81d26d2 100644 --- a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt @@ -1,3 +1,12 @@ +^CMake Deprecation Warning at CompatBefore24.cmake:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error in CMakeLists.txt: You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less than 2.4. This version of CMake only supports backwards compatibility with diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake index 1030211..3a959bb 100644 --- a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -4,6 +4,7 @@ run_cmake(Before24) run_cmake(CompatBefore24) run_cmake(Future) run_cmake(PolicyBefore24) +run_cmake(Before2812) run_cmake(Range) run_cmake(RangeBad) run_cmake(Unknown) diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake new file mode 100644 index 0000000..4fd3c7d --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake @@ -0,0 +1,39 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "../../a/d") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f") +if (NOT path STREQUAL "/x/y/a/f/../../a/d") + list (APPEND errors "'${path}' instead of '/x/y/a/f/../../a/d'") +endif() + +set (path "../../a/d") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE) +if (NOT path STREQUAL "/x/y/a/d") + list (APPEND errors "'${path}' instead of '/x/y/a/d'") +endif() + +set (path "../../a/d") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE OUTPUT_VARIABLE output) +if (NOT path STREQUAL "../../a/d") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/x/y/a/d") + list (APPEND errors "'${output}' instead of '/x/y/a/d'") +endif() + +set (path "/a/d/../e") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f") +if (NOT path STREQUAL "/a/d/../e") + list (APPEND errors "'${path}' instead of '/a/d/../e'") +endif() + +set (path "/a/d/../e") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE) +if (NOT path STREQUAL "/a/e") + list (APPEND errors "'${path}' instead of '/a/e'") +endif() + + +check_errors (ABSOLUTE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND.cmake b/Tests/RunCMake/cmake_path/APPEND.cmake new file mode 100644 index 0000000..565b26d --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND.cmake @@ -0,0 +1,77 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +cmake_path (APPEND path "/a/b" "c") +if (NOT path STREQUAL "/a/b/c") + list (APPEND errors "'${path}' instead of '/a/b/c'") +endif() + +set (path "/a/b") +cmake_path (APPEND path "c") +if (NOT path STREQUAL "/a/b/c") + list (APPEND errors "'${path}' instead of '/a/b/c'") +endif() + +cmake_path (APPEND path "x/y" "z" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/b/c") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/a/b/c/x/y/z") + list (APPEND errors "'${output}' instead of '/a/b/c/x/y/z'") +endif() + +set (path "a") +cmake_path (APPEND path "") +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +cmake_path (APPEND path "/b") +if (NOT path STREQUAL "/b") + list (APPEND errors "'${path}' instead of '/b'") +endif() + +if (WIN32) + set (path "a") + cmake_path (APPEND path "c:/b") + if (NOT path STREQUAL "c:/b") + list (APPEND errors "'${path}' instead of 'c:/b'") + endif() + + set (path "a") + cmake_path (APPEND path "c:") + if (NOT path STREQUAL "c:") + list (APPEND errors "'${path}' instead of 'c:'") + endif() + cmake_path (APPEND path "") + if (NOT path STREQUAL "c:") + list (APPEND errors "'${path}' instead of 'c:'") + endif() + + set (path "c:a") + cmake_path (APPEND path "/b") + if (NOT path STREQUAL "c:/b") + list (APPEND errors "'${path}' instead of 'c:/b'") + endif() + + set (path "c:a") + cmake_path (APPEND path "c:b") + if (NOT path STREQUAL "c:a/b") + list (APPEND errors "'${path}' instead of 'c:a/b'") + endif() + + set (path "//host") + cmake_path (APPEND path "b") + if (NOT path STREQUAL "//host/b") + list (APPEND errors "'${path}' instead of '//host/b'") + endif() + + set (path "//host/") + cmake_path (APPEND path "b") + if (NOT path STREQUAL "//host/b") + list (APPEND errors "'${path}' instead of '//host/b'") + endif() +endif() + +check_errors (APPEND ${errors}) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake new file mode 100644 index 0000000..b9320f3 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake @@ -0,0 +1,43 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +cmake_path(CMAKE_PATH path "/x/y/z/../../a/d") +if (NOT path STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'") +endif() +cmake_path(CMAKE_PATH path NORMALIZE "/x/y/z/../../a/d") +if (NOT path STREQUAL "/x/a/d") + list (APPEND errors "'${path}' instead of '/x/a/d'") +endif() + +if (WIN32) + cmake_path(CMAKE_PATH path "/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'") + endif() + cmake_path(CMAKE_PATH path NORMALIZE "/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "/x/a/d") + list (APPEND errors "'${path}' instead of '/x/a/d'") + endif() + + cmake_path(CMAKE_PATH path "//?/c:/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "c:/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of 'c:/x/y/z/../../a/d'") + endif() + cmake_path(CMAKE_PATH path NORMALIZE "//?/c:/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "c:/x/a/d") + list (APPEND errors "'${path}' instead of 'c:/x/a/d'") + endif() + + cmake_path(CMAKE_PATH path "\\\\?\\UNC/host/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "//host/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of '//host/x/y/z/../../a/d'") + endif() + cmake_path(CMAKE_PATH path NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "//host/x/a/d") + list (APPEND errors "'${path}' instead of '//host/x/a/d'") + endif() +endif() + +check_errors (CMAKE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/CMakeLists.txt b/Tests/RunCMake/cmake_path/CMakeLists.txt new file mode 100644 index 0000000..1f195c6 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18...3.19) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt new file mode 100644 index 0000000..674d942 --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at COMPARE-wrong-operator.cmake:[0-9]+ \(cmake_path\): + cmake_path COMPARE called with an unknown comparison operator: FOO. diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake new file mode 100644 index 0000000..7da5d29 --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake @@ -0,0 +1,3 @@ + +set (path "/a/b") +cmake_path(COMPARE path FOO "/other" output) diff --git a/Tests/RunCMake/cmake_path/COMPARE.cmake b/Tests/RunCMake/cmake_path/COMPARE.cmake new file mode 100644 index 0000000..bc6b9b4 --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE.cmake @@ -0,0 +1,22 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a///b/c") +cmake_path(COMPARE path EQUAL "a/b/c" output) +if (NOT output) + list (APPEND errors "'${path}' not equal to 'a/b/c'") +endif() + +set (path "a/b/d/../c") +cmake_path(COMPARE path NOT_EQUAL "a/b/c" output) +if (NOT output) + list (APPEND errors "'${path}' equal to 'a/b/c'") +endif() +cmake_path(NORMAL_PATH path) +cmake_path(COMPARE path EQUAL "a/b/c" output) +if (NOT output) + list (APPEND errors "'${path}' not equal to 'a/b/c'") +endif() + +check_errors (COMPARE ${errors}) diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT.cmake b/Tests/RunCMake/cmake_path/CONCAT.cmake new file mode 100644 index 0000000..62b5eb0 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT.cmake @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "/a/b") +cmake_path (CONCAT path "cd") +if (NOT path STREQUAL "/a/bcd") + list (APPEND errors "'${path}' instead of 'a/bcd'") +endif() + +set (path "/a/b") +cmake_path (CONCAT path "cd" "ef" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/b") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/a/bcdef") + list (APPEND errors "'${output}' instead of 'a/bcdef'") +endif() + +check_errors (CONCAT ${errors}) diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt new file mode 100644 index 0000000..9aa75ec --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at CONVERT-wrong-operator.cmake:[0-9]+ \(cmake_path\): + cmake_path CONVERT called with an unknown action: FOO. diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake new file mode 100644 index 0000000..12ffccc --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake @@ -0,0 +1,2 @@ + +cmake_path(CONVERT "/a/b" FOO output) diff --git a/Tests/RunCMake/cmake_path/CONVERT.cmake b/Tests/RunCMake/cmake_path/CONVERT.cmake new file mode 100644 index 0000000..b08bc26 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT.cmake @@ -0,0 +1,110 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output) +if (NOT output STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'") +endif() +cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) +if (NOT output STREQUAL "/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'") +endif() + +if (WIN32) + cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'") + endif() + cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'") + endif() + + cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "c:/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/y/z/../../a/d'") + endif() + cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "c:/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/a/d'") + endif() + + cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "//host/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/y/z/../../a/d'") + endif() + cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "//host/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/a/d'") + endif() +endif() + +if (WIN32) + cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d;c:/a/b/c/../d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d;c:/a/b/c/../d'") + endif() + cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d;c:/a/b/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;c:/a/b/d'") + endif() +else() + cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d;/a/b/c/../d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${outputh}' instead of '/x/y/z/../../a/d;/a/b/c/../d'") + endif() + cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d;/a/b/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;/a/b/d'") + endif() +endif() + + +if (WIN32) + cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "c:\\a\\b\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\b\\d'") + endif() + + cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "\\\\host\\a\\b\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d'") + endif() + cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "\\\\host\\a\\b\\d;c:\\a\\b\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d;c:\\a\\b\\d'") + endif() +else() + cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "/a//b/c/../d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a//b/c/../d'") + endif() + cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/a/b/d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a/b/d'") + endif() + cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d:/a/b/c/../d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d:/a/b/c/../d'") + endif() + cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d:/a/b/d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/a/d:/a/b/d'") + endif() +endif() + + +check_errors (CONVERT ${errors}) diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt new file mode 100644 index 0000000..71afc92 --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at GET-wrong-operator.cmake:[0-9]+ \(cmake_path\): + cmake_path GET called with an unknown action: FOO. diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake new file mode 100644 index 0000000..e09d6d7 --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake @@ -0,0 +1,3 @@ + +set (path "/a/b") +cmake_path(GET path FOO output) diff --git a/Tests/RunCMake/cmake_path/GET.cmake b/Tests/RunCMake/cmake_path/GET.cmake new file mode 100644 index 0000000..e68e654 --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET.cmake @@ -0,0 +1,248 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +############################################### +## First test with a path defining all elements +############################################### +if (WIN32) + set (path "C:/aa/bb/cc.ext1.ext2") +else() + set (path "/aa/bb/cc.ext1.ext2") +endif() + +cmake_path(GET path ROOT_NAME output) +if (WIN32) + if (NOT output STREQUAL "C:") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") + endif() +else() + if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") + endif() +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (WIN32) + if (NOT output STREQUAL "C:/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") + endif() +else() + if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") + endif() +endif() + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL "cc.ext1.ext2") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL ".ext1.ext2") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() +cmake_path(GET path EXTENSION LAST_ONLY output) +if (NOT output STREQUAL ".ext2") + list (APPEND errors "EXTENSION LAST_ONLY returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL "cc") + list (APPEND errors "STEM returns bad data: ${output}") +endif() +cmake_path(GET path STEM LAST_ONLY output) +if (NOT output STREQUAL "cc.ext1") + list (APPEND errors "STEM LAST_ONLY returns bad data: ${output}") +endif() + +cmake_path(GET path RELATIVE_PATH output) +if (NOT output STREQUAL "aa/bb/cc.ext1.ext2") + list (APPEND errors "RELATIVE_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path PARENT_PATH output) +if (WIN32) + if (NOT output STREQUAL "C:/aa/bb") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") + endif() +else() + if (NOT output STREQUAL "/aa/bb") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") + endif() +endif() + +###################################### +## second, tests with missing elements +###################################### +set (path "aa/bb/") + +cmake_path(GET path ROOT_NAME output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL "") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL "") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL "") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +cmake_path(GET path RELATIVE_PATH output) +if (NOT output STREQUAL path) + list (APPEND errors "RELATIVE_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path PARENT_PATH output) +if (NOT output STREQUAL "aa/bb") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") +endif() + +################################## +set (path "/aa/bb/") + +cmake_path(GET path ROOT_NAME output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") +endif() + +################################### +set (path "/") + +cmake_path(GET path ROOT_NAME output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL "") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL "") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL "") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +cmake_path(GET path RELATIVE_PATH output) +if (NOT output STREQUAL "") + list (APPEND errors "RELATIVE_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path PARENT_PATH output) +if (NOT output STREQUAL "/") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") +endif() + +################################### +set (path ".file") + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL ".file") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL "") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL ".file") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +################################### +set (path ".file.ext") + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL ".file.ext") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL ".ext") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() +cmake_path(GET path EXTENSION LAST_ONLY output) +if (NOT output STREQUAL ".ext") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL ".file") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +################################### +set (path ".file.ext1.ext2") + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL ".file.ext1.ext2") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL ".ext1.ext2") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() +cmake_path(GET path EXTENSION LAST_ONLY output) +if (NOT output STREQUAL ".ext2") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL ".file") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +check_errors (GET ${errors}) diff --git a/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH.cmake b/Tests/RunCMake/cmake_path/HASH.cmake new file mode 100644 index 0000000..dfcf2b2 --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH.cmake @@ -0,0 +1,27 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path1 "a///b/c") +cmake_path(HASH path1 hash1) +set (path2 "a/b////c") +cmake_path(HASH path2 hash2) +if (NOT hash1 STREQUAL hash2) + list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'") +endif() + +set (path1 "a///b/c/../d") +cmake_path(HASH path1 hash1) +set (path2 "a/b////d") +cmake_path(HASH path2 hash2) +if (hash1 STREQUAL hash2) + list (APPEND errors "'hash values equal for '${path1}' and '${path2}'") +endif() +cmake_path(HASH path1 hash1 NORMALIZE) +cmake_path(HASH path2 NORMALIZE hash2) +if (NOT hash1 STREQUAL hash2) + list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'") +endif() + + +check_errors (HASH ${errors}) diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ITEM.cmake b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake new file mode 100644 index 0000000..eb73bd5 --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake @@ -0,0 +1,232 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "/a/b") +cmake_path(HAS_ROOT_NAME path output) +if (output) + list (APPEND errors "ROOT_NAME: ${path} has root name") +endif() +cmake_path(HAS_ROOT_DIRECTORY path output) +if (NOT output) + list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory") +endif() +cmake_path(HAS_ROOT_PATH path output) +if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") +endif() + +set (path "a/b") +cmake_path(HAS_ROOT_PATH path output) +if (output) + list (APPEND errors "ROOT_PATH: ${path} has root path") +endif() + +set (path "/a/b") +cmake_path(HAS_FILENAME path output) +if (NOT output) + list (APPEND errors "FILENAME: ${path} does not have filename") +endif() +set (path "a.b") +cmake_path(HAS_FILENAME path output) +if (NOT output) + list (APPEND errors "FILENAME: ${path} does not have filename") +endif() +set (path "/a/b/") +cmake_path(HAS_FILENAME path output) +if (output) + list (APPEND errors "FILENAME: ${path} has filename") +endif() +set (path "/") +cmake_path(HAS_FILENAME path output) +if (output) + list (APPEND errors "FILENAME: ${path} has filename") +endif() + +set (path "/a/b") +cmake_path(HAS_STEM path output) +if (NOT output) + list (APPEND errors "STEM: ${path} does not have stem") +endif() +set (path "a.b") +cmake_path(HAS_STEM path output) +if (NOT output) + list (APPEND errors "STEM: ${path} does not have stem") +endif() +set (path ".a") +cmake_path(HAS_STEM path output) +if (NOT output) + list (APPEND errors "STEM: ${path} does not have stem") +endif() +set (path "/a/") +cmake_path(HAS_STEM path output) +if (output) + list (APPEND errors "STEM: ${path} has stem") +endif() +set (path "/") +cmake_path(HAS_STEM path output) +if (output) + list (APPEND errors "STEM: ${path} has stem") +endif() + +set (path "/a/b.c") +cmake_path(HAS_EXTENSION path output) +if (NOT output) + list (APPEND errors "EXTENSION: ${path} does not have extension") +endif() +set (path "b.c") +cmake_path(HAS_EXTENSION path output) +if (NOT output) + list (APPEND errors "EXTENSION: ${path} does not have extension") +endif() +set (path "/.a") +cmake_path(HAS_EXTENSION path output) +if (output) + list (APPEND errors "EXTENSION: ${path} has extension") +endif() +set (path "/a/") +cmake_path(HAS_EXTENSION path output) +if (output) + list (APPEND errors "EXTENSION: ${path} has extension") +endif() +set (path "/") +cmake_path(HAS_EXTENSION path output) +if (output) + list (APPEND errors "EXTENSION: ${path} has extension") +endif() + +set (path "/a/b") +cmake_path(HAS_RELATIVE_PATH path output) +if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") +endif() +set (path "/") +cmake_path(HAS_RELATIVE_PATH path output) +if (output) + list (APPEND errors "RELATIVE_PATH: ${path} has relative path") +endif() + +set (path "/a/b") +cmake_path(HAS_PARENT_PATH path output) +if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") +endif() +set (path "/") +cmake_path(HAS_PARENT_PATH path output) +if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") +endif() +set (path "a") +cmake_path(HAS_PARENT_PATH path output) +if (output) + list (APPEND errors "PARENT_PATH: ${path} has parent path") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (NOT output) + list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "c:a/b") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (output) + list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "//host/b") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (NOT output) + list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "//host") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (output) + list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "c:/a/b") + cmake_path(HAS_RELATIVE_PATH path output) + if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") + endif() + + set (path "c:a/b") + cmake_path(HAS_RELATIVE_PATH path output) + if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") + endif() + + set (path "//host/b") + cmake_path(HAS_RELATIVE_PATH path output) + if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") + endif() + + set (path "c:/a/b") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "c:/") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "c:") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "//host/") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "//host") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() +endif() + + +check_errors (HAS ${errors}) diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake new file mode 100644 index 0000000..794e786 --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake @@ -0,0 +1,48 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a") +else() + set (path "/a") +endif() +cmake_path(IS_ABSOLUTE path output) +if (NOT output) + list (APPEND errors "'${path} is not absolute") +endif() + +set (path "a/b") +cmake_path(IS_ABSOLUTE path output) +if (output) + list (APPEND errors "'${path} is absolute") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(IS_ABSOLUTE path output) + if (NOT output) + list (APPEND errors "'${path} is not absolute") + endif() + + set (path "//host/b") + cmake_path(IS_ABSOLUTE path output) + if (NOT output) + list (APPEND errors "'${path} is not absolute") + endif() + + set (path "/a") + cmake_path(IS_ABSOLUTE path output) + if (output) + list (APPEND errors "'${path} is absolute") + endif() + + set (path "c:a") + cmake_path(IS_ABSOLUTE path output) + if (output) + list (APPEND errors "'${path} is absolute") + endif() +endif() + + +check_errors (IS_ABSOLUTE ${errors}) diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX.cmake b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake new file mode 100644 index 0000000..53da93b --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake @@ -0,0 +1,22 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a///b/c") +cmake_path(IS_PREFIX path "a/b/c/d" output) +if (NOT output) + list (APPEND errors "'${path} is not prefix of 'a/b/c/d'") +endif() + +set (path "a///b/c/../d") +cmake_path(IS_PREFIX path "a/b/d/e" output) +if (output) + list (APPEND errors "'${path} is prefix of 'a/b/d/e'") +endif() +cmake_path(IS_PREFIX path "a/b/d/e" NORMALIZE output) +if (NOT output) + list (APPEND errors "'${path} is not prefix of 'a/b/d/e'") +endif() + + +check_errors (IS_PREFIX ${errors}) diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake new file mode 100644 index 0000000..ad12253 --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake @@ -0,0 +1,48 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a") +else() + set (path "/a") +endif() +cmake_path(IS_RELATIVE path output) +if (output) + list (APPEND errors "'${path} is relative") +endif() + +set (path "a/b") +cmake_path(IS_RELATIVE path output) +if (NOT output) + list (APPEND errors "'${path} is not relative") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(IS_RELATIVE path output) + if (output) + list (APPEND errors "'${path} is relative") + endif() + + set (path "//host/b") + cmake_path(IS_RELATIVE path output) + if (output) + list (APPEND errors "'${path} is relative") + endif() + + set (path "/a") + cmake_path(IS_RELATIVE path output) + if (NOT output) + list (APPEND errors "'${path} is not relative") + endif() + + set (path "c:a") + cmake_path(IS_RELATIVE path output) + if (NOT output) + list (APPEND errors "'${path} is not relative") + endif() +endif() + + +check_errors (IS_RELATIVE ${errors}) diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake new file mode 100644 index 0000000..066c44d --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake @@ -0,0 +1,37 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a//b\\c/..\\d") + cmake_path(NATIVE_PATH path output) + if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d") + list (APPEND errors "'${output}' instead of 'c:\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(NATIVE_PATH path output NORMALIZE) + if (NOT output STREQUAL "c:\\a\\b\\d") + list (APPEND errors "'${output}' instead of 'c:\\a\\b\\d'") + endif() + + set (path "//host/a//b\\c/..\\d") + cmake_path(NATIVE_PATH path output) + if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d") + list (APPEND errors "'${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(NATIVE_PATH path output NORMALIZE) + if (NOT output STREQUAL "\\\\host\\a\\b\\d") + list (APPEND errors "'${output}' instead of '\\\\host\\a\\b\\d'") + endif() +else() + set (path "/a//b/c/../d") + cmake_path(NATIVE_PATH path output) + if (NOT output STREQUAL "/a//b/c/../d") + list (APPEND errors "'${output}' instead of '/a//b/c/../d'") + endif() + cmake_path(NATIVE_PATH path NORMALIZE output) + if (NOT output STREQUAL "/a/b/d") + list (APPEND errors "'${output}' instead of '/a/b/d'") + endif() +endif() + +check_errors (NATIVE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake new file mode 100644 index 0000000..88db76a --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake @@ -0,0 +1,46 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/./b/..") +cmake_path(NORMAL_PATH path) +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +set (path "a/.///b/../") +cmake_path(NORMAL_PATH path) +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +set (path "a/.///b/../") +cmake_path(NORMAL_PATH path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/.///b/../") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/") + list (APPEND errors "'${output}' instead of 'a/'") +endif() + +if (WIN32) + set (path "//host/./b/..") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "//host/") + list (APPEND errors "'${path}' instead of '//host/'") + endif() + + set (path "//host/./b/../") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "//host/") + list (APPEND errors "'${path}' instead of '//host/'") + endif() + + set (path "c://a/.///b/../") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "c:/a/") + list (APPEND errors "'${path}' instead of 'c:/a/'") + endif() +endif() + +check_errors (NORMAL_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt new file mode 100644 index 0000000..e1d6592 --- /dev/null +++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path OUTPUT_VARIABLE requires an argument. diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake new file mode 100644 index 0000000..ad23377 --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake @@ -0,0 +1,41 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a/d") + cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "c:/a/d") + list (APPEND errors "'${path}' instead of 'c:/a/d'") + endif() +else() + set (path "/a/d") + cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "/a/d") + list (APPEND errors "'${path}' instead of '/a/d'") + endif() +endif() + +set (path "/a/d") +cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "/a/b/c" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/d") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "../../d") + list (APPEND errors "'${output}' instead of '../../d'") +endif() + +set (path "${CMAKE_CURRENT_SOURCE_DIR}/a/d") +cmake_path(PROXIMATE_PATH path) +if (NOT path STREQUAL "a/d") + list (APPEND errors "'${path}' instead of 'a/d'") +endif() + +set (path "a/b/c") +cmake_path(PROXIMATE_PATH path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + + +check_errors (PROXIMATE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake new file mode 100644 index 0000000..522a899 --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake @@ -0,0 +1,76 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "/a//d") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/b/c") +if (NOT path STREQUAL "../../d") + list (APPEND errors "'${path}' instead of '../../d'") +endif() + +set (path "/a//b///c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/d") +if (NOT path STREQUAL "../b/c") + list (APPEND errors "'${path}' instead of '../b/c'") +endif() + +set (path "a/b/c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a") +if (NOT path STREQUAL "b/c") + list (APPEND errors "'${path}' instead of 'b/c'") +endif() + +set (path "a/b/c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c/x/y") +if (NOT path STREQUAL "../..") + list (APPEND errors "'${path}' instead of '../..'") +endif() + +set (path "a/b/c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c") +if (NOT path STREQUAL ".") + list (APPEND errors "'${path}' instead of '.'") +endif() + +set (path "a/b") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "c/d") +if (NOT path STREQUAL "../../a/b") + list (APPEND errors "'${path}' instead of '../../a/b'") +endif() + +set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b") +cmake_path(RELATIVE_PATH path) +if (NOT path STREQUAL "../../b") + list (APPEND errors "'${path}' instead of '../../b'") +endif() + +set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b") +cmake_path(RELATIVE_PATH path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/../../b") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "../../b") + list (APPEND errors "'${output}' instead of '../../b'") +endif() + +if (WIN32) + set (path "/a/d") + cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "/a/d") + list (APPEND errors "'${path}' instead of '/a/d'") + endif() + + set (path "c:/a/d") + cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "") + list (APPEND errors "'${path}' instead of ''") + endif() +elseif() + set (path "/a/d") + cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "") + list (APPEND errors "'${path}' instead of ''") + endif() +endif() + +check_errors (RELATIVE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake new file mode 100644 index 0000000..ac06fde --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake @@ -0,0 +1,52 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REMOVE_EXTENSION path LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e") + list (APPEND errors "'${path}' instead of 'a/b/c.e'") +endif() +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REMOVE_EXTENSION path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/c") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +set (path "a/b/c") +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/.c") +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/.c") + list (APPEND errors "'${path}' instead of 'a/b/.c'") +endif() +cmake_path (REMOVE_EXTENSION path LAST_ONLY) +if (NOT path STREQUAL "a/b/.c") + list (APPEND errors "'${path}' instead of 'a/b/.c'") +endif() + +set (path "a/b/.") +cmake_path (REMOVE_EXTENSION path LAST_ONLY) +if (NOT path STREQUAL "a/b/.") + list (APPEND errors "'${path}' instead of 'a/b/.'") +endif() + +check_errors (REMOVE_EXTENSION ${errors}) diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake new file mode 100644 index 0000000..385dcd0 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake @@ -0,0 +1,25 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REMOVE_FILENAME path) +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +cmake_path (REMOVE_FILENAME path) +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REMOVE_FILENAME path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +check_errors (REMOVE_FILENAME ${errors}) diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake new file mode 100644 index 0000000..45c1575 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake @@ -0,0 +1,58 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REPLACE_EXTENSION path ".x") +if (NOT path STREQUAL "a/b/c.x") + list (APPEND errors "'${path}' instead of 'a/b/c.x'") +endif() +cmake_path (REPLACE_EXTENSION path ".y") +if (NOT path STREQUAL "a/b/c.y") + list (APPEND errors "'${path}' instead of 'a/b/c.y'") +endif() +cmake_path (REPLACE_EXTENSION path "") +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e.x") + list (APPEND errors "'${path}' instead of 'a/b/c.e.x'") +endif() +cmake_path (REPLACE_EXTENSION path ".y" LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e.y") + list (APPEND errors "'${path}' instead of 'a/b/c.e.y'") +endif() +cmake_path (REPLACE_EXTENSION path "" LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e") + list (APPEND errors "'${path}' instead of 'a/b/c.e'") +endif() + +set (path "/a/.b") +cmake_path (REPLACE_EXTENSION path ".x") +if (NOT path STREQUAL "/a/.b.x") + list (APPEND errors "'${path}' instead of '/a/.b.x'") +endif() +cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY) +if (NOT path STREQUAL "/a/.b.x") + list (APPEND errors "'${path}' instead of '/a/.b.x'") +endif() + +set (path "/a/b") +cmake_path (REPLACE_EXTENSION path ".x") +if (NOT path STREQUAL "/a/b.x") + list (APPEND errors "'${path}' instead of '/a/b.x'") +endif() + +set (path "/a/b/") +cmake_path (REPLACE_EXTENSION path ".x" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/b/") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/a/b/.x") + list (APPEND errors "'${output}' instead of '/a/b/.x'") +endif() + +check_errors (REPLACE_EXTENSION ${errors}) diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake new file mode 100644 index 0000000..f7a9600 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake @@ -0,0 +1,26 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REPLACE_FILENAME path "x.y") +if (NOT path STREQUAL "a/b/x.y") + list (APPEND errors "'${path}' instead of 'a/b/x.y'") +endif() + +set (path "a/b/") +cmake_path (REPLACE_FILENAME path "x.y") +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REPLACE_FILENAME path "" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +check_errors (REPLACE_FILENAME ${errors}) diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake new file mode 100644 index 0000000..ca9cba6 --- /dev/null +++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake @@ -0,0 +1,191 @@ +include(RunCMake) + +# Validate parsing arguments + +## input path is not a variable +set (RunCMake-stderr-file "wrong-path-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + run_cmake_command (GET-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET wrong_path ${subcommand} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### COMPARE sub-command +foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) + run_cmake_command (COMPARE-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE wrong_path ${subcommand} path2 output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CONCAT REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args path2) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path ${extra_args} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## missing output parameter +set (RunCMake-stderr-file "missing-output-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + run_cmake_command (GET-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### CONVERT sub-command +foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST) + run_cmake_command (CONVERT-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### COMPARE sub-command +foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) + run_cmake_command (COMPARE-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args path2) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## OUTPUT_VARIABLE without argument +set (RunCMake-stderr-file "OUTPUT_VARIABLE-no-arg-stderr.txt") + +foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## Invalid output variable +set (RunCMake-stderr-file "invalid-output-var-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + run_cmake_command (GET-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### CONVERT sub-command +foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST) + run_cmake_command (CONVERT-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### COMPARE sub-command +foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) + run_cmake_command (COMPARE-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args path2) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-OUTPUT_VARIABLE-invalid-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## Unexpected arguments +set (RunCMake-stderr-file "unexpected-arg-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + if (subcommand STREQUAL "EXTENSION" OR subcommand STREQUAL "STEM") + set (extra_args LAST_ONLY) + else() + unset (extra_args) + endif() + run_cmake_command (GET-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand} ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### CONVERT sub-command +foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST) + run_cmake_command (CONVERT-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand} output unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + if (command STREQUAL "REPLACE_FILENAME" OR command STREQUAL "REPLACE_EXTENSION") + set (extra_args input) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX + HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args input) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() +unset (RunCMake-stderr-file) + +run_cmake(GET-wrong-operator) +run_cmake(CONVERT-wrong-operator) +run_cmake(COMPARE-wrong-operator) + +set (RunCMake_TEST_OPTIONS "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}") + +run_cmake(GET) +run_cmake(APPEND) +run_cmake(CONCAT) +run_cmake(REMOVE_FILENAME) +run_cmake(REPLACE_FILENAME) +run_cmake(REMOVE_EXTENSION) +run_cmake(REPLACE_EXTENSION) +run_cmake(NORMAL_PATH) +run_cmake(RELATIVE_PATH) +run_cmake(PROXIMATE_PATH) +run_cmake(ABSOLUTE_PATH) +run_cmake(CMAKE_PATH) +run_cmake(NATIVE_PATH) +run_cmake(CONVERT) +run_cmake(COMPARE) +run_cmake(HAS_ITEM) +run_cmake(IS_ABSOLUTE) +run_cmake(IS_RELATIVE) +run_cmake(IS_PREFIX) +run_cmake(HASH) diff --git a/Tests/RunCMake/cmake_path/call-cmake_path.cmake b/Tests/RunCMake/cmake_path/call-cmake_path.cmake new file mode 100644 index 0000000..70fd6f5 --- /dev/null +++ b/Tests/RunCMake/cmake_path/call-cmake_path.cmake @@ -0,0 +1,19 @@ + +cmake_minimum_required(VERSION 3.18...3.19) + +# define input variable +set (path "") + +separate_arguments(CMAKE_PATH_ARGUMENTS UNIX_COMMAND "${CMAKE_PATH_ARGUMENTS}") + +if (CHECK_INVALID_OUTPUT) + # special handling for CMAKE_PATH + list(GET CMAKE_PATH_ARGUMENTS 0 command) + if (command STREQUAL "CMAKE_PATH") + cmake_path(CMAKE_PATH "" "input") + else() + cmake_path(${CMAKE_PATH_ARGUMENTS} "") + endif() +else() + cmake_path(${CMAKE_PATH_ARGUMENTS}) +endif() diff --git a/Tests/RunCMake/cmake_path/check_errors.cmake b/Tests/RunCMake/cmake_path/check_errors.cmake new file mode 100644 index 0000000..d136971 --- /dev/null +++ b/Tests/RunCMake/cmake_path/check_errors.cmake @@ -0,0 +1,12 @@ + +function (CHECK_ERRORS command) + set (errors ${ARGN}) + if (errors) + string (LENGTH "${command}" length) + math (EXPR count "${length} + 2") + string (REPEAT " " ${count} shift) + list (TRANSFORM errors PREPEND "${shift}") + list (JOIN errors "\n" msg) + message (FATAL_ERROR "${command}: ${msg}") + endif() +endfunction() diff --git a/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt new file mode 100644 index 0000000..32a8948 --- /dev/null +++ b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path Invalid name for output variable. diff --git a/Tests/RunCMake/cmake_path/missing-output-stderr.txt b/Tests/RunCMake/cmake_path/missing-output-stderr.txt new file mode 100644 index 0000000..8ac049b --- /dev/null +++ b/Tests/RunCMake/cmake_path/missing-output-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path [A-Z_]+ must be called with ((at least )?(two|three|four)|two or three|three or four) arguments. diff --git a/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt new file mode 100644 index 0000000..8f0e2f2 --- /dev/null +++ b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path [A-Z_]+ (called with unexpected|must be called with two) arguments. diff --git a/Tests/RunCMake/cmake_path/wrong-path-stderr.txt b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt new file mode 100644 index 0000000..c42b5a2 --- /dev/null +++ b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path undefined variable for input path. diff --git a/Tests/RunCMake/configure_file/NoSourcePermissions.cmake b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake new file mode 100644 index 0000000..c6ad131 --- /dev/null +++ b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake @@ -0,0 +1,10 @@ +configure_file(NoSourcePermissions.sh NoSourcePermissions.sh.out + NO_SOURCE_PERMISSIONS) + +if (UNIX) + execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/NoSourcePermissions.sh.out + RESULT_VARIABLE result) + if (result EQUAL "0") + message(FATAL_ERROR "Copied file has executable permissions") + endif() +endif() diff --git a/Tests/RunCMake/configure_file/NoSourcePermissions.sh b/Tests/RunCMake/configure_file/NoSourcePermissions.sh new file mode 100755 index 0000000..0aa8f41 --- /dev/null +++ b/Tests/RunCMake/configure_file/NoSourcePermissions.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +#Testing NO_SOURCE_PERMISSIONS option of configure_file. diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index 32a0770..71694fb 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(NewLineStyle-NoArg) run_cmake(NewLineStyle-WrongArg) run_cmake(NewLineStyle-ValidArg) run_cmake(NewLineStyle-COPYONLY) +run_cmake(NoSourcePermissions) if(RunCMake_GENERATOR MATCHES "Make") # Use a single build tree for a few tests without cleaning. diff --git a/Tests/RunCMake/ctest_build/BuildCommandFailure-check.cmake b/Tests/RunCMake/ctest_build/BuildCommandFailure-check.cmake new file mode 100644 index 0000000..feac3ce --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildCommandFailure-check.cmake @@ -0,0 +1,12 @@ +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml LIMIT 4096) + if(NOT build_xml MATCHES [[this command failed]]) + string(REPLACE "\n" "\n " build_xml " ${build_xml}") + set(RunCMake_TEST_FAILED + "Build.xml does not have expected error message:\n${build_xml}" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_build/BuildCommandFailure-result.txt b/Tests/RunCMake/ctest_build/BuildCommandFailure-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildCommandFailure-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_build/BuildCommandFailure-stderr.txt b/Tests/RunCMake/ctest_build/BuildCommandFailure-stderr.txt new file mode 100644 index 0000000..bbe9410 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildCommandFailure-stderr.txt @@ -0,0 +1 @@ +^Error\(s\) when building project diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index b2e562a..072fbac 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -48,8 +48,12 @@ function(run_BuildChangeId) endfunction() run_BuildChangeId() -set(RunCMake_USE_LAUNCHERS FALSE) set(RunCMake_USE_CUSTOM_BUILD_COMMAND TRUE) +set(RunCMake_BUILD_COMMAND "${FAKE_BUILD_COMMAND_EXE}") +run_ctest(BuildCommandFailure) +unset(RunCMake_BUILD_COMMAND) + +set(RunCMake_USE_LAUNCHERS FALSE) set(RunCMake_BUILD_COMMAND "${COLOR_WARNING}") run_ctest(IgnoreColor) unset(RunCMake_BUILD_COMMAND) diff --git a/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in index 3b8edf4..68a0fcb 100644 --- a/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.3) project(CTestTestMemcheck@CASE_NAME@ NONE) include(CTest) diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-result.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt new file mode 100644 index 0000000..d302b5c --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt @@ -0,0 +1 @@ +Defect count: 23 diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt new file mode 100644 index 0000000..034ee1e --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt @@ -0,0 +1,13 @@ +Memory checking results: +Uninitialized __global__ memory read - 1 +Unused memory - 1 +Host API memory access error - 1 +Barrier error - 2 +Invalid __global__ read - 1 +cudaErrorLaunchFailure - 2 +Fatal UVM GPU fault - 1 +Fatal UVM CPU fault - 1 +Memory leak - 1 +Potential WAR hazard detected - 4 +Potential RAW hazard detected - 4 +Race reported - 4 diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index ab4c5ab..2b3165b 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -175,3 +175,15 @@ unset(CMAKELISTS_EXTRA_CODE) unset(CTEST_EXTRA_CODE) unset(CTEST_MEMCHECK_ARGS) unset(CTEST_SUFFIX_CODE) + +#----------------------------------------------------------------------------- +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testCudaMemcheck.cmake\") +") +set(CTEST_SUFFIX_CODE "message(\"Defect count: \${defect_count}\")") +set(CTEST_MEMCHECK_ARGS "DEFECT_COUNT defect_count") +run_mc_test(DummyCudaMemcheck "${PSEUDO_CUDA_MEMCHECK}") +unset(CTEST_MEMCHECK_ARGS) +unset(CTEST_SUFFIX_CODE) +unset(CTEST_EXTRA_CODE) diff --git a/Tests/RunCMake/ctest_memcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in index 50b4b6a..eedf080 100644 --- a/Tests/RunCMake/ctest_memcheck/test.cmake.in +++ b/Tests/RunCMake/ctest_memcheck/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.3) # Settings: set(CTEST_SITE "@SITE@") diff --git a/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake b/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake new file mode 100644 index 0000000..adc7a1a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake @@ -0,0 +1,279 @@ +# this file simulates an execution of cuda-memcheck + +set(LOG_FILE "$ENV{PSEUDO_LOGFILE}") +message("LOG_FILE=[${LOG_FILE}]") + +# clear the log file +file(REMOVE "${LOG_FILE}") + +# create an error of each type of sanitizer tool and failure + +# initcheck +file(APPEND "${LOG_FILE}" +"========= CUDA-MEMCHECK +========= Uninitialized __global__ memory read of size 4 +========= at 0x00000020 in test(int*, int*) +========= by thread (0,0,0) in block (0,0,0) +========= Address 0x1303d80000 +========= Saved host backtrace up to driver entry point +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./uninit-read [0x101d9] +========= Host Frame:./uninit-read [0x10267] +========= Host Frame:./uninit-read [0x465b5] +========= Host Frame:./uninit-read [0x3342] +========= Host Frame:./uninit-read [0x3143] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./uninit-read [0x31e2] +========= +========= Unused memory in allocation 0x1303d80000 of size 16 bytes +========= Not written any memory. +========= 100.00% of allocation were unused. +========= Saved host backtrace up to driver entry point +========= Host Frame:/lib64/libcuda.so.1 (cuMemAlloc_v2 + 0x1b7) [0x26ec97] +========= Host Frame:./uninit-read [0x2bbd3] +========= Host Frame:./uninit-read [0x71ab] +========= Host Frame:./uninit-read [0x3c84f] +========= Host Frame:./uninit-read [0x3111] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./uninit-read [0x31e2] +========= +========= Host API memory access error at host access to 0x1303fd1400 of size 25600 bytes +========= Uninitialized access at 0x1303fd4600 on access by cudaMemcopy source. +========= Saved host backtrace up to driver entry point at error +========= Host Frame:/usr/lib/x86_64-linux-gnu/libcuda.so.1 (cuMemcpyDtoH_v2 + 0x1ec) [0x29200c] +========= Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x38aaa] +========= Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x18946] +========= Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 (cudaMemcpy + 0x1a2) [0x3b8c2] +========= Host Frame:/something/somewhere [0xcafe] +========= +========= ERROR SUMMARY: 2 errors +") + + +# synccheck +file(APPEND "${LOG_FILE}" +"========= CUDA-MEMCHECK +========= Barrier error detected. Divergent thread(s) in warp +========= at 0x00000058 in test(int*, int*) +========= by thread (1,0,0) in block (0,0,0) +========= Device Frame:test(int*, int*) (test(int*, int*) : 0x60) +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./sync [0x101d9] +========= Host Frame:./sync [0x10267] +========= Host Frame:./sync [0x465b5] +========= Host Frame:./sync [0x3342] +========= Host Frame:./sync [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./sync [0x31e2] +========= +========= Barrier error detected. Divergent thread(s) in warp +========= at 0x00000058 in test(int*, int*) +========= by thread (0,0,0) in block (0,0,0) +========= Device Frame:test(int*, int*) (test(int*, int*) : 0x60) +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./sync [0x101d9] +========= Host Frame:./sync [0x10267] +========= Host Frame:./sync [0x465b5] +========= Host Frame:./sync [0x3342] +========= Host Frame:./sync [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./sync [0x31e2] +========= +========= ERROR SUMMARY: 2 errors +") + +# memcheck +file(APPEND "${LOG_FILE}" +"========= CUDA-MEMCHECK +========= Invalid __global__ read of size 4 +========= at 0x00000020 in test(int*, int*) +========= by thread (0,0,0) in block (0,0,0) +========= Address 0x00000000 is out of bounds +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./invalid-read [0x101d9] +========= Host Frame:./invalid-read [0x10267] +========= Host Frame:./invalid-read [0x465b5] +========= Host Frame:./invalid-read [0x3342] +========= Host Frame:./invalid-read [0x3142] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./invalid-read [0x31e2] +========= +========= Program hit cudaErrorLaunchFailure (error 719) due to \"unspecified launch failure\" on CUDA API call to cudaDeviceSynchronize. +========= Saved host backtrace up to driver entry point at error +========= Host Frame:/lib64/libcuda.so.1 [0x3ac5a3] +========= Host Frame:./invalid-read [0x2e576] +========= Host Frame:./invalid-read [0x3147] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./invalid-read [0x31e2] +========= +========= Program hit cudaErrorLaunchFailure (error 719) due to \"unspecified launch failure\" on CUDA API call to cudaFree. +========= Saved host backtrace up to driver entry point at error +========= Host Frame:/lib64/libcuda.so.1 [0x3ac5a3] +========= Host Frame:./invalid-read [0x3c106] +========= Host Frame:./invalid-read [0x3150] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./invalid-read [0x31e2] +========= +========= Fatal UVM GPU fault of type invalid pde due to invalid address +========= during atomic access to address 0x20be00000 +========= +========= Fatal UVM CPU fault due to invalid operation +========= during read access to address 0x1357c92000 +========= +========= LEAK SUMMARY: 0 bytes leaked in 0 allocations +========= ERROR SUMMARY: 3 errors +") + +# memcheck with leak-check full +file(APPEND "${LOG_FILE}" +"========= CUDA-MEMCHECK +========= Leaked 10 bytes at 0x1303d80000 +========= Saved host backtrace up to driver entry point at cudaMalloc time +========= Host Frame:/lib64/libcuda.so.1 (cuMemAlloc_v2 + 0x1b7) [0x26ec97] +========= Host Frame:./leak [0x2bab3] +========= Host Frame:./leak [0x708b] +========= Host Frame:./leak [0x3c72f] +========= Host Frame:./leak [0x3113] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./leak [0x3174] +========= +========= LEAK SUMMARY: 10 bytes leaked in 1 allocations +========= ERROR SUMMARY: 1 error +") + +# racecheck with racecheck-report all +file(APPEND "${LOG_FILE}" +"========= CUDA-MEMCHECK +========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x3 in block (0, 0, 0) : +========= Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*) +========= Current Value : 0, Incoming Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x2 in block (0, 0, 0) : +========= Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*) +========= Current Value : 0, Incoming Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x1 in block (0, 0, 0) : +========= Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*) +========= Current Value : 0, Incoming Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x0 in block (0, 0, 0) : +========= Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*) +========= Current Value : 0, Incoming Value : 1 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x3 in block (0, 0, 0) : +========= Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*) +========= Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Current Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x2 in block (0, 0, 0) : +========= Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*) +========= Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Current Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x1 in block (0, 0, 0) : +========= Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*) +========= Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Current Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x0 in block (0, 0, 0) : +========= Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*) +========= Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*) +========= Current Value : 0 +========= Saved host backtrace up to driver entry point at kernel launch time +========= Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6] +========= Host Frame:./race [0x101d9] +========= Host Frame:./race [0x10267] +========= Host Frame:./race [0x465b5] +========= Host Frame:./race [0x3342] +========= Host Frame:./race [0x314a] +========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505] +========= Host Frame:./race [0x31e2] +========= +========= WARN: Race reported between Read access at 0x00000170 in ./race.cu:4:test(int*, int*) +========= and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [4 hazards] +========= and Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) [4 hazards] +========= +========= WARN: Race reported between Write access at 0x00000148 in ./race.cu:3:test(int*, int*) +========= and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [124 hazards] +========= and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards] +========= +========= WARN: Race reported between Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) +========= and Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) [124 hazards] +========= and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards] +========= +========= WARN: Race reported between Write access at 0x00000148 in ./race.cu:3:test(int*, int*) +========= and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [124 hazards] +========= and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards] +========= +========= RACECHECK SUMMARY: 12 hazards displayed (0 errors, 12 warnings) +") diff --git a/Tests/RunCMake/ctest_update/test.cmake.in b/Tests/RunCMake/ctest_update/test.cmake.in index 25b8423..01aab26 100644 --- a/Tests/RunCMake/ctest_update/test.cmake.in +++ b/Tests/RunCMake/ctest_update/test.cmake.in @@ -10,7 +10,7 @@ set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -# FIXME: update test to do someting meaningful with this. +# FIXME: update test to do something meaningful with this. set(CTEST_UPDATE_COMMAND "not-actually-used") set(ctest_test_args "@CASE_CTEST_UPDATE_ARGS@") diff --git a/Tests/RunCMake/execute_process/AnyCommandError-result.txt b/Tests/RunCMake/execute_process/AnyCommandError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt b/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt new file mode 100644 index 0000000..0380562 --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*AnyCommandError.cmake:1 \(execute_process\): + execute_process failed command indexes: 2, 3, 4 diff --git a/Tests/RunCMake/execute_process/AnyCommandError.cmake b/Tests/RunCMake/execute_process/AnyCommandError.cmake new file mode 100644 index 0000000..f8ec385 --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandError.cmake @@ -0,0 +1,8 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL ANY +) diff --git a/Tests/RunCMake/execute_process/CommandError-result.txt b/Tests/RunCMake/execute_process/CommandError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/CommandError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/CommandError-stderr.txt b/Tests/RunCMake/execute_process/CommandError-stderr.txt new file mode 100644 index 0000000..c28f3a3 --- /dev/null +++ b/Tests/RunCMake/execute_process/CommandError-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*CommandError.cmake:1 \(execute_process\): + execute_process COMMAND_ERROR_IS_FATAL option can be ANY or LAST diff --git a/Tests/RunCMake/execute_process/CommandError.cmake b/Tests/RunCMake/execute_process/CommandError.cmake new file mode 100644 index 0000000..da58928 --- /dev/null +++ b/Tests/RunCMake/execute_process/CommandError.cmake @@ -0,0 +1,3 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL ALL +) diff --git a/Tests/RunCMake/execute_process/LastCommandError-result.txt b/Tests/RunCMake/execute_process/LastCommandError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/LastCommandError-stderr.txt b/Tests/RunCMake/execute_process/LastCommandError-stderr.txt new file mode 100644 index 0000000..ff191b3 --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandError-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*LastCommandError.cmake:1 \(execute_process\): + execute_process last command failed diff --git a/Tests/RunCMake/execute_process/LastCommandError.cmake b/Tests/RunCMake/execute_process/LastCommandError.cmake new file mode 100644 index 0000000..6116a5c --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandError.cmake @@ -0,0 +1,8 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + COMMAND_ERROR_IS_FATAL LAST +) diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index 89ad6b2..f4c3d19 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -26,3 +26,7 @@ run_cmake_command(EchoCommand3 ${CMAKE_COMMAND} ${RunCMake_SOURCE_DIR}/EchoCommand.cmake) run_cmake_command(EchoVariable ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/EchoVariable.cmake) + +run_cmake_command(AnyCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/AnyCommandError.cmake) +run_cmake_command(LastCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandError.cmake) +run_cmake_command(CommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/CommandError.cmake) diff --git a/Tests/RunCMake/export/CMakeLists.txt b/Tests/RunCMake/export/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/export/CMakeLists.txt +++ b/Tests/RunCMake/export/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/export/NamelinkOnlyExport.cmake b/Tests/RunCMake/export/NamelinkOnlyExport.cmake new file mode 100644 index 0000000..4bdd180 --- /dev/null +++ b/Tests/RunCMake/export/NamelinkOnlyExport.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) +add_library(foo SHARED empty.cpp) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + NAMELINK_ONLY +) +export(EXPORT fooExport FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 1c74762..95c8d5c 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -15,3 +15,5 @@ run_cmake(ForbiddenToExportPropertyWithGenExp) run_cmake(ExportPropertiesUndefined) run_cmake(DependOnNotExport) run_cmake(DependOnDoubleExport) +run_cmake(UnknownExport) +run_cmake(NamelinkOnlyExport) diff --git a/Tests/RunCMake/export/UnknownExport-result.txt b/Tests/RunCMake/export/UnknownExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/UnknownExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/UnknownExport-stderr.txt b/Tests/RunCMake/export/UnknownExport-stderr.txt new file mode 100644 index 0000000..a8f8453 --- /dev/null +++ b/Tests/RunCMake/export/UnknownExport-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UnknownExport\.cmake:[0-9]+ \(export\): + export Export set "fooExport" not found\. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/UnknownExport.cmake b/Tests/RunCMake/export/UnknownExport.cmake new file mode 100644 index 0000000..bf82d1f --- /dev/null +++ b/Tests/RunCMake/export/UnknownExport.cmake @@ -0,0 +1,2 @@ +enable_language(CXX) +export(EXPORT fooExport FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") diff --git a/Tests/RunCMake/fake_build_command.c b/Tests/RunCMake/fake_build_command.c new file mode 100644 index 0000000..d87335b --- /dev/null +++ b/Tests/RunCMake/fake_build_command.c @@ -0,0 +1,6 @@ +#include <stdio.h> +int main(void) +{ + printf("this command failed\n"); + return 1; +} diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt new file mode 100644 index 0000000..b22387b --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CHMOD-all-perms\.cmake:[0-9]+ \(file\): + file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS + from the invocation +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake new file mode 100644 index 0000000..b49583d --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake @@ -0,0 +1,6 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt new file mode 100644 index 0000000..8d09e35 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CHMOD-invalid-path\.cmake:[0-9]+ \(file\): + file does not exist: + + .*/chmod-tests/I_dont_exist +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake new file mode 100644 index 0000000..36915c1 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake @@ -0,0 +1,4 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/I_dont_exist PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt new file mode 100644 index 0000000..84ba2a2 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CHMOD-invalid-perms\.cmake:[0-9]+ \(file\): + file INVALID_PERMISSION is an invalid permission specifier +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake new file mode 100644 index 0000000..22cab0b --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS INVALID_PERMISSION) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt new file mode 100644 index 0000000..2c248f8 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CHMOD-no-keyword\.cmake:[0-9]+ \(file\): + file No permissions given +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake new file mode 100644 index 0000000..8b62106 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt new file mode 100644 index 0000000..a18609f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CHMOD-no-perms\.cmake:[0-9]+ \(file\): + file No permissions given +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake new file mode 100644 index 0000000..9fbd359 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake new file mode 100644 index 0000000..87e3e57 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake new file mode 100644 index 0000000..d9226b8 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake @@ -0,0 +1,6 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ OWNER_WRITE) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt new file mode 100644 index 0000000..1c87a59 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CHMOD-write-only\.cmake:[0-9]+ \(file\): + file failed to open for reading \(Permission denied\): + + .*/chmod-tests/a +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake new file mode 100644 index 0000000..1289efc --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake @@ -0,0 +1,6 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a "CONTENT") +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_WRITE) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a content) diff --git a/Tests/RunCMake/file-CHMOD/CMakeLists.txt b/Tests/RunCMake/file-CHMOD/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake new file mode 100644 index 0000000..c7bff15 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake @@ -0,0 +1,19 @@ +include(RunCMake) + +run_cmake(CHMOD-no-perms) +run_cmake(CHMOD-no-keyword) +run_cmake(CHMOD-all-perms) +run_cmake(CHMOD-invalid-perms) +run_cmake(CHMOD-invalid-path) +run_cmake(CHMOD-ok) +run_cmake(CHMOD-override) + +if(UNIX) + execute_process(COMMAND id -u $ENV{USER} + OUTPUT_VARIABLE uid + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +if(NOT WIN32 AND NOT "${uid}" STREQUAL "0") + run_cmake(CHMOD-write-only) +endif() diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash-result.txt b/Tests/RunCMake/file/DOWNLOAD-no-save-hash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-no-save-hash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-no-save-hash-stderr.txt new file mode 100644 index 0000000..b0f0d19 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-no-save-hash-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at DOWNLOAD-no-save-hash\.cmake:[0-9]+ \(file\): + file DOWNLOAD cannot calculate hash if file is not saved\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash.cmake b/Tests/RunCMake/file/DOWNLOAD-no-save-hash.cmake new file mode 100644 index 0000000..ce959a7 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-no-save-hash.cmake @@ -0,0 +1,8 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-no-save-md5.txt" + EXPECTED_HASH MD5=55555555555555555555555555555555 + STATUS status + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash.txt b/Tests/RunCMake/file/DOWNLOAD-no-save-hash.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-no-save-hash.txt diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake index fe87c78..684c196 100644 --- a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake @@ -8,3 +8,9 @@ file(GLOB_RECURSE ) string(SHA1 CONTENT_LIST_HASH "${CONTENT_LIST}") add_custom_target(CONTENT_ECHO ALL ${CMAKE_COMMAND} -E echo ${CONTENT_LIST_HASH}) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + # Xcode's "new build system" does not reload the project file if it is updated + # during the build. Print the output we expect the build to print just to make + # the test pass. + message(STATUS "CONTENT_LIST_HASH: ${CONTENT_LIST_HASH}") +endif() diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt new file mode 100644 index 0000000..7c58aeb --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\): + file BASE_DIRECTORY requires a value diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake new file mode 100644 index 0000000..132aee6 --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake @@ -0,0 +1,2 @@ + +file(REAL_PATH "some-path" real_path BASE_DIRECTORY) diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt new file mode 100644 index 0000000..301db75 --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at REAL_PATH-unexpected-arg.cmake:[0-9]+ \(file\): + file REAL_PATH called with unexpected arguments diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake new file mode 100644 index 0000000..144f30b --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake @@ -0,0 +1,2 @@ + +file(REAL_PATH "some-path" real_path extra_arg) diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake new file mode 100644 index 0000000..be25706 --- /dev/null +++ b/Tests/RunCMake/file/REAL_PATH.cmake @@ -0,0 +1,14 @@ + +file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/test.txt") +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test.sym") +file(CREATE_LINK "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/test.sym" SYMBOLIC) + +file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/test.sym" real_path) +if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") +endif() + +file(REAL_PATH "test.sym" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") +if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") +endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index a4de1d3..22813eb 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -11,6 +11,7 @@ run_cmake(DOWNLOAD-netrc-bad) run_cmake(DOWNLOAD-tls-cainfo-not-set) run_cmake(DOWNLOAD-tls-verify-not-set) run_cmake(DOWNLOAD-pass-not-set) +run_cmake(DOWNLOAD-no-save-hash) run_cmake(TOUCH) run_cmake(TOUCH-error-in-source-directory) run_cmake(TOUCH-error-missing-directory) @@ -71,6 +72,9 @@ if(NOT WIN32 OR CYGWIN) run_cmake(READ_SYMLINK-noexist) run_cmake(READ_SYMLINK-notsymlink) run_cmake(INSTALL-FOLLOW_SYMLINK_CHAIN) + run_cmake(REAL_PATH-unexpected-arg) + run_cmake(REAL_PATH-no-base-dir) + run_cmake(REAL_PATH) endif() if(RunCMake_GENERATOR MATCHES "Ninja") diff --git a/Tests/RunCMake/find_dependency/CMakeLists.txt b/Tests/RunCMake/find_dependency/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/find_dependency/CMakeLists.txt +++ b/Tests/RunCMake/find_dependency/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_package/CMakeLists.txt b/Tests/RunCMake/find_package/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/find_package/CMakeLists.txt +++ b/Tests/RunCMake/find_package/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_package/EmptyVersionRange-result.txt b/Tests/RunCMake/find_package/EmptyVersionRange-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/EmptyVersionRange-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt b/Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt new file mode 100644 index 0000000..9c00b96 --- /dev/null +++ b/Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at EmptyVersionRange.cmake:[0-9]+ \(find_package\): + find_package specified version range is empty. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at EmptyVersionRange.cmake:[0-9]+ \(find_package\): + find_package specified version range is empty. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_package/EmptyVersionRange.cmake b/Tests/RunCMake/find_package/EmptyVersionRange.cmake new file mode 100644 index 0000000..553e297 --- /dev/null +++ b/Tests/RunCMake/find_package/EmptyVersionRange.cmake @@ -0,0 +1,3 @@ +find_package(VersionRange 2.3...1.2) + +find_package(VersionRange 2.3...<2.3) diff --git a/Tests/RunCMake/find_package/FindVersionRange.cmake b/Tests/RunCMake/find_package/FindVersionRange.cmake new file mode 100644 index 0000000..27e5b90 --- /dev/null +++ b/Tests/RunCMake/find_package/FindVersionRange.cmake @@ -0,0 +1,82 @@ + +if (NOT VersionRange_FIND_VERSION_COMPLETE STREQUAL VersionRange_SPECIFIED_VERSION_COMPLETE) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_COMPLETE: ${VersionRange_FIND_VERSION_COMPLETE}") +endif() + +if (NOT VersionRange_FIND_VERSION VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION: ${VersionRange_FIND_VERSION}") +endif() +if (NOT VersionRange_FIND_VERSION_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MAJOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAJOR: ${VersionRange_FIND_VERSION_MAJOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MINOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MINOR: ${VersionRange_FIND_VERSION_MINOR}") +endif() +if (NOT VersionRange_FIND_VERSION_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_PATCH) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_PATCH: ${VersionRange_FIND_VERSION_PATCH}") +endif() +if (NOT VersionRange_FIND_VERSION_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_TWEAK) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_TWEAK: ${VersionRange_FIND_VERSION_TWEAK}") +endif() + +if (NOT VersionRange_FIND_VERSION_RANGE STREQUAL VersionRange_SPECIFIED_VERSION_RANGE) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE: ${VersionRange_FIND_VERSION_RANGE}") +endif() +if (NOT VersionRange_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MIN: ${VersionRange_FIND_VERSION_RANGE_MIN}") +endif() +if (VersionRange_FIND_VERSION_RANGE MATCHES "<[0-9.]+$") + if (NOT VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MAX: ${VersionRange_FIND_VERSION_RANGE_MAX}") + endif() +else() + if (NOT VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MAX: ${VersionRange_FIND_VERSION_RANGE_MAX}") + endif() +endif() + +if (NOT VersionRange_FIND_VERSION_MIN VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN: ${VersionRange_FIND_VERSION_MIN}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MAJOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_MAJOR: ${VersionRange_FIND_VERSION_MIN_MAJOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MINOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_MINOR: ${VersionRange_FIND_VERSION_MIN_MINOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_PATCH) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_PATCH: ${VersionRange_FIND_VERSION_MIN_PATCH}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_TWEAK) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_TWEAK: ${VersionRange_FIND_VERSION_MIN_TWEAK}") +endif() + +if (NOT VersionRange_FIND_VERSION_MAX VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX: ${VersionRange_FIND_VERSION_MAX}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_MAJOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX_MAJOR: ${VersionRange_FIND_VERSION_MAX_MAJOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_MINOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX_MINOR: ${VersionRange_FIND_VERSION_MAX_MINOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_PATCH) + message (SEND_ERROR "Wrong value for VersionRange_VERSION_FIND_MAX_PATCH: ${VersionRange_FIND_VERSION_MAX_PATCH}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_TWEAK) + message (SEND_ERROR "Wrong value for VersionRange_VERSION_FIND_MAX_TWEAK: ${VersionRange_FIND_VERSION_MAX_TWEAK}") +endif() + +if ((VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" + AND "2.3.4.5" VERSION_LESS_EQUAL VersionRange_FIND_VERSION_MAX) + OR (VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" + AND "2.3.4.5" VERSION_LESS VersionRange_FIND_VERSION_MAX)) +set (VersionRange_FOUND TRUE) +set (VersionRange_VERSION 2.3.4.5) +set (VersionRange_VERSION_MAJOR 2) +set (VersionRange_VERSION_MINOR 3) +set (VersionRange_VERSION_PATCH 4) +set (VersionRange_VERSION_TWEAK 5) +else() + set (VersionRange_FOUND FALSE) +endif() diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt index b336b56..ebfd7d0 100644 --- a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt +++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt @@ -1,9 +1,10 @@ CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): - find_package called without NO_MODULE option and no FindNotHere.cmake - module is in CMAKE_MODULE_PATH. Add NO_MODULE to exclusively request - Config mode and search for a package configuration file provided by NotHere - \(NotHereConfig.cmake or nothere-config.cmake\). Otherwise make - FindNotHere.cmake available in CMAKE_MODULE_PATH. + find_package called without either MODULE or CONFIG option and no + FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to + exclusively request Module mode and fail if FindNotHere.cmake is missing. + Add CONFIG to exclusively request Config mode and search for a package + configuration file provided by NotHere \(NotHereConfig.cmake or + nothere-config.cmake\). \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 5186297..a899f46 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -29,6 +29,17 @@ run_cmake(WrongVersionConfig) run_cmake(CMP0084-OLD) run_cmake(CMP0084-WARN) run_cmake(CMP0084-NEW) +run_cmake(WrongVersionRange) +run_cmake(EmptyVersionRange) +run_cmake(VersionRangeWithEXACT) +run_cmake(VersionRange) +run_cmake(VersionRange2) +run_cmake(VersionRange3) +run_cmake(VersionRange4) +run_cmake(VersionRangeConfig) +run_cmake(VersionRangeConfig2) +run_cmake(VersionRangeConfigStd) +run_cmake(VersionRangeConfigStd2) if(UNIX) run_cmake(SetFoundResolved) endif() diff --git a/Tests/RunCMake/find_package/VersionRange.cmake b/Tests/RunCMake/find_package/VersionRange.cmake new file mode 100644 index 0000000..30b88a8 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange.cmake @@ -0,0 +1,37 @@ + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MIN 1.2.3.4) +set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 1) +set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 2) +set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 3) +set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 4) +set (VersionRange_SPECIFIED_VERSION_MAX 5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 5) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 6) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 7) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 8) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRange2.cmake b/Tests/RunCMake/find_package/VersionRange2.cmake new file mode 100644 index 0000000..9adcc64 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange2.cmake @@ -0,0 +1,37 @@ + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...<5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...<5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MIN 1.2.3.4) +set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 1) +set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 2) +set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 3) +set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 4) +set (VersionRange_SPECIFIED_VERSION_MAX 5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 5) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 6) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 7) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 8) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRange3.cmake b/Tests/RunCMake/find_package/VersionRange3.cmake new file mode 100644 index 0000000..41efac4 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange3.cmake @@ -0,0 +1,49 @@ + +# show the effect of the exclusion or inclusion of the upper endpoint + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...<2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...<2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MIN 1.2.3.4) +set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 1) +set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 2) +set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 3) +set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 4) +set (VersionRange_SPECIFIED_VERSION_MAX 2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 2) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 3) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 4) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 5) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange found unexpectedly.") +endif() + + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...2.3.4.5) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRange4.cmake b/Tests/RunCMake/find_package/VersionRange4.cmake new file mode 100644 index 0000000..0953d04 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange4.cmake @@ -0,0 +1,39 @@ + +# show the effect of the exclusion or inclusion of the upper endpoint + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 2.3.4.5...2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_RANGE 2.3.4.5...2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MIN 2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 2) +set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 3) +set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 4) +set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 5) +set (VersionRange_SPECIFIED_VERSION_MAX 2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 2) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 3) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 4) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 5) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake new file mode 100644 index 0000000..e9f6076 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake @@ -0,0 +1,74 @@ + +if (NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...5.6.7.8" + AND NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...<5.6.7.8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_COMPLETE: ${PACKAGE_FIND_VERSION_COMPLETE}") +endif() + +if (NOT PACKAGE_FIND_VERSION VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION: ${PACKAGE_FIND_VERSION}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAJOR: ${PACKAGE_FIND_VERSION_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MINOR: ${PACKAGE_FIND_VERSION_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_PATCH: ${PACKAGE_FIND_VERSION_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_TWEAK: ${PACKAGE_FIND_VERSION_TWEAK}") +endif() + +if (NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...5.6.7.8" + AND NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...<5.6.7.8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE: ${PACKAGE_FIND_VERSION_RANGE}") +endif() + +if (NOT PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MIN: ${PACKAGE_FIND_VERSION_RANGE_MIN}") +endif() +if (PACKAGE_FIND_VERSION_RANGE MATCHES "<[0-9.]+$") + if (NOT PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MAX: ${PACKAGE_FIND_VERSION_RANGE_MAX}") + endif() +else() + if (NOT PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MAX: ${PACKAGE_FIND_VERSION_RANGE_MAX}") + endif() +endif() + +if (NOT PACKAGE_FIND_VERSION_MIN VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN: ${PACKAGE_FIND_VERSION_MIN}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_MAJOR: ${PACKAGE_FIND_VERSION_MIN_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_MINOR: ${PACKAGE_FIND_VERSION_MIN_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_PATCH: ${PACKAGE_FIND_VERSION_MIN_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_TWEAK: ${PACKAGE_FIND_VERSION_MIN_TWEAK}") +endif() + +if (NOT PACKAGE_FIND_VERSION_MAX VERSION_EQUAL "5.6.7.8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX: ${PACKAGE_FIND_VERSION_MAX}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_MAJOR VERSION_EQUAL "5") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_MAJOR: ${PACKAGE_FIND_VERSION_MAX_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_MINOR VERSION_EQUAL "6") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_MINOR: ${PACKAGE_FIND_VERSION_MAX_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_PATCH VERSION_EQUAL "7") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAXPATCH: ${PACKAGE_FIND_VERSION_MAX_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_TWEAK VERSION_EQUAL "8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_TWEAK: ${PACKAGE_FIND_VERSION_MAX_TWEAK}") +endif() + +set (PACKAGE_VERSION 2.3.4.5) +set (PACKAGE_VERSION_COMPATIBLE TRUE) diff --git a/Tests/RunCMake/find_package/VersionRangeConfig.cmake b/Tests/RunCMake/find_package/VersionRangeConfig.cmake new file mode 100644 index 0000000..b39a966 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfig.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4...5.6.7.8 CONFIG NAMES VersionRangeCfg) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfig2.cmake b/Tests/RunCMake/find_package/VersionRangeConfig2.cmake new file mode 100644 index 0000000..04c570a --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfig2.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4...<5.6.7.8 CONFIG NAMES VersionRangeCfg) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake b/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake new file mode 100644 index 0000000..3ffc72f --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4 CONFIG NAMES VersionRangeStd) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake b/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake new file mode 100644 index 0000000..8b48828 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4...5.6.7.8 CONFIG NAMES VersionRangeStd) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake diff --git a/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake new file mode 100644 index 0000000..6e9151c --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake @@ -0,0 +1,24 @@ + +if (NOT PACKAGE_FIND_VERSION VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION: ${PACKAGE_FIND_VERSION}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAJOR: ${PACKAGE_FIND_VERSION_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MINOR: ${PACKAGE_FIND_VERSION_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_PATCH: ${PACKAGE_FIND_VERSION_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_TWEAK: ${PACKAGE_FIND_VERSION_TWEAK}") +endif() + +set (PACKAGE_VERSION 2.3.4.5) + +if (PACKAGE_FIND_VERSION VERSION_LESS_EQUAL PACKAGE_VERSION) + set (PACKAGE_VERSION_COMPATIBLE TRUE) +else() + set (PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt b/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt b/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt new file mode 100644 index 0000000..6319aee --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at VersionRangeWithEXACT.cmake:[0-9]+ \(find_package\): + find_package EXACT cannot be specified with a version range. diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake b/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake new file mode 100644 index 0000000..419c7c5 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake @@ -0,0 +1 @@ +find_package(VersionRange 1.2...3.4 EXACT) diff --git a/Tests/RunCMake/find_package/WrongVersionRange-result.txt b/Tests/RunCMake/find_package/WrongVersionRange-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/WrongVersionRange-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt b/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt new file mode 100644 index 0000000..fe0b088 --- /dev/null +++ b/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt @@ -0,0 +1,28 @@ +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2\.\.\." +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "\.\.\.1\.2" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2\.\.\.\.2\.3" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2\.\.\.>2\.3" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2>\.\.\.2\.3" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_package/WrongVersionRange.cmake b/Tests/RunCMake/find_package/WrongVersionRange.cmake new file mode 100644 index 0000000..9851ade --- /dev/null +++ b/Tests/RunCMake/find_package/WrongVersionRange.cmake @@ -0,0 +1,9 @@ +find_package(VersionRange 1.2...) + +find_package(VersionRange ...1.2) + +find_package(VersionRange 1.2....2.3) + +find_package(VersionRange 1.2...>2.3) + +find_package(VersionRange 1.2>...2.3) diff --git a/Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt b/Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt new file mode 100644 index 0000000..331d465 --- /dev/null +++ b/Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt @@ -0,0 +1 @@ +-- FakeApp_EXECUTABLE='.*/Tests/RunCMake/find_program/BundleSpaceInName-build/Fake app.app/Contents/MacOS/Fake app' diff --git a/Tests/RunCMake/find_program/BundleSpaceInName.cmake b/Tests/RunCMake/find_program/BundleSpaceInName.cmake new file mode 100644 index 0000000..9152d5b --- /dev/null +++ b/Tests/RunCMake/find_program/BundleSpaceInName.cmake @@ -0,0 +1,8 @@ +set(fakeApp "${CMAKE_CURRENT_BINARY_DIR}/Fake app.app/Contents/MacOS/Fake app") +file(WRITE "${fakeApp}" "#!/bin/sh\n") +execute_process(COMMAND chmod a+rx "${fakeApp}") + +find_program(FakeApp_EXECUTABLE NAMES "Fake app" NO_DEFAULT_PATH + PATHS "${CMAKE_CURRENT_BINARY_DIR}" +) +message(STATUS "FakeApp_EXECUTABLE='${FakeApp_EXECUTABLE}'") diff --git a/Tests/RunCMake/find_program/ExeNoRead.cmake b/Tests/RunCMake/find_program/CMP0109-Common.cmake index 7e22dc5..525413a 100644 --- a/Tests/RunCMake/find_program/ExeNoRead.cmake +++ b/Tests/RunCMake/find_program/CMP0109-Common.cmake @@ -1,4 +1,7 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ExeNoRead" "#!/bin/sh\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ReadNoExe" "#ReadNoExe") execute_process(COMMAND chmod -r+x "${CMAKE_CURRENT_BINARY_DIR}/ExeNoRead") find_program(ExeNoRead_EXECUTABLE NAMES ExeNoRead NO_DEFAULT_PATH PATHS "${CMAKE_CURRENT_BINARY_DIR}") message(STATUS "ExeNoRead_EXECUTABLE='${ExeNoRead_EXECUTABLE}'") +find_program(ReadNoExe_EXECUTABLE NAMES ReadNoExe NO_DEFAULT_PATH PATHS "${CMAKE_CURRENT_BINARY_DIR}") +message(STATUS "ReadNoExe_EXECUTABLE='${ReadNoExe_EXECUTABLE}'") diff --git a/Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt b/Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt new file mode 100644 index 0000000..2744463 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt @@ -0,0 +1,2 @@ +-- ExeNoRead_EXECUTABLE='.*/Tests/RunCMake/find_program/CMP0109-NEW-build/ExeNoRead' +-- ReadNoExe_EXECUTABLE='ReadNoExe_EXECUTABLE-NOTFOUND' diff --git a/Tests/RunCMake/find_program/CMP0109-NEW.cmake b/Tests/RunCMake/find_program/CMP0109-NEW.cmake new file mode 100644 index 0000000..b4a4033 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0109 NEW) +include(CMP0109-Common.cmake) diff --git a/Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt b/Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt new file mode 100644 index 0000000..1a0e2a8 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt @@ -0,0 +1,2 @@ +-- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND' +-- ReadNoExe_EXECUTABLE='.*/Tests/RunCMake/find_program/CMP0109-OLD-build/ReadNoExe' diff --git a/Tests/RunCMake/find_program/CMP0109-OLD.cmake b/Tests/RunCMake/find_program/CMP0109-OLD.cmake new file mode 100644 index 0000000..8260161 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0109 OLD) +include(CMP0109-Common.cmake) diff --git a/Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt b/Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt new file mode 100644 index 0000000..202fc6d --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt @@ -0,0 +1,29 @@ +^CMake Warning \(dev\) at CMP0109-Common.cmake:4 \(find_program\): + Policy CMP0109 is not set: find_program\(\) requires permission to execute + but not to read. Run "cmake --help-policy CMP0109" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + The file + + .*/Tests/RunCMake/find_program/CMP0109-WARN-build/ExeNoRead + + is executable but not readable. CMake is ignoring it for compatibility. +Call Stack \(most recent call first\): + CMP0109-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0109-Common.cmake:6 \(find_program\): + Policy CMP0109 is not set: find_program\(\) requires permission to execute + but not to read. Run "cmake --help-policy CMP0109" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + The file + + .*/Tests/RunCMake/find_program/CMP0109-WARN-build/ReadNoExe + + is readable but not executable. CMake is using it for compatibility. +Call Stack \(most recent call first\): + CMP0109-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt b/Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt new file mode 100644 index 0000000..baf560f --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt @@ -0,0 +1,2 @@ +-- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND' +-- ReadNoExe_EXECUTABLE='.*/Tests/RunCMake/find_program/CMP0109-WARN-build/ReadNoExe' diff --git a/Tests/RunCMake/find_program/CMP0109-WARN.cmake b/Tests/RunCMake/find_program/CMP0109-WARN.cmake new file mode 100644 index 0000000..a3d59af --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-WARN.cmake @@ -0,0 +1 @@ +include(CMP0109-Common.cmake) diff --git a/Tests/RunCMake/find_program/ExeNoRead-stdout.txt b/Tests/RunCMake/find_program/ExeNoRead-stdout.txt deleted file mode 100644 index f231178..0000000 --- a/Tests/RunCMake/find_program/ExeNoRead-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND' diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 2bb777b..3e23920 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -17,6 +17,12 @@ else() OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT "${uid}" STREQUAL "0") - run_cmake(ExeNoRead) + run_cmake(CMP0109-WARN) + run_cmake(CMP0109-OLD) + run_cmake(CMP0109-NEW) endif() endif() + +if(APPLE) + run_cmake(BundleSpaceInName) +endif() diff --git a/Tests/RunCMake/foreach/foreach-ZIP_LISTS-multiple-iter-vars-test.cmake b/Tests/RunCMake/foreach/foreach-ZIP_LISTS-multiple-iter-vars-test.cmake index 9647dea..3b03ed7 100644 --- a/Tests/RunCMake/foreach/foreach-ZIP_LISTS-multiple-iter-vars-test.cmake +++ b/Tests/RunCMake/foreach/foreach-ZIP_LISTS-multiple-iter-vars-test.cmake @@ -8,13 +8,13 @@ function(foreachTest result list_var_1 list_var_2 list_var_3) list(APPEND CMAKE_MESSAGE_INDENT "| ") foreach(first second third IN ZIP_LISTS ${list_var_1} ${list_var_2} ${list_var_3}) if(NOT first) - set(first "[undefiend]") + set(first "[undefined]") endif() if(NOT second) - set(second "[undefiend]") + set(second "[undefined]") endif() if(NOT third) - set(third "[undefiend]") + set(third "[undefined]") endif() if(NOT _arg_MUTE) message(STATUS "${first}, ${second}, ${third}") diff --git a/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test-stdout.txt b/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test-stdout.txt index 25433fd..4730a86 100644 --- a/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test-stdout.txt +++ b/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test-stdout.txt @@ -14,6 +14,6 @@ -- | one, satu, raz -- | two, dua, dva -- | three, tiga, tri --- | \[undefiend\], empat, \[undefiend\] +-- | \[undefined\], empat, \[undefined\] -- End output -- <<< test variable value restored -- PASSED >>> diff --git a/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test.cmake b/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test.cmake index 56cfe64..aa0ed07 100644 --- a/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test.cmake +++ b/Tests/RunCMake/foreach/foreach-ZIP_LISTS-test.cmake @@ -9,7 +9,7 @@ function(foreachTest result list_var_1 list_var_2 list_var_3) foreach(num IN ZIP_LISTS ${list_var_1} ${list_var_2} ${list_var_3}) foreach(i RANGE 2) if(NOT num_${i}) - set(num_${i} "[undefiend]") + set(num_${i} "[undefined]") endif() endforeach() if(NOT _arg_MUTE) diff --git a/Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt b/Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt b/Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt new file mode 100644 index 0000000..af08afa --- /dev/null +++ b/Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at IncorrectArguments.cmake:1 \(get_filename_component\): + get_filename_component called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_filename_component/IncorrectArguments.cmake b/Tests/RunCMake/get_filename_component/IncorrectArguments.cmake new file mode 100644 index 0000000..e329e29 --- /dev/null +++ b/Tests/RunCMake/get_filename_component/IncorrectArguments.cmake @@ -0,0 +1,2 @@ +get_filename_component(var) +message("The error is fatal, so this should not print") diff --git a/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake b/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake index 156fc8f..a7820a0 100644 --- a/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +run_cmake(IncorrectArguments) run_cmake(KnownComponents) run_cmake(UnknownComponent) diff --git a/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt b/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt index b146e5b..f86a688 100644 --- a/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt +++ b/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at UnknownComponent.cmake:1 \(get_filename_component\): +^CMake Error at UnknownComponent.cmake:1 \(get_filename_component\): get_filename_component unknown component BOGUS Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_filename_component/UnknownComponent.cmake b/Tests/RunCMake/get_filename_component/UnknownComponent.cmake index 06abc51..19521ba 100644 --- a/Tests/RunCMake/get_filename_component/UnknownComponent.cmake +++ b/Tests/RunCMake/get_filename_component/UnknownComponent.cmake @@ -1 +1,2 @@ get_filename_component(var "/path/to/filename.ext.in" BOGUS) +message("The error is fatal, so this should not print") diff --git a/Tests/RunCMake/get_property/CMakeLists.txt b/Tests/RunCMake/get_property/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/get_property/CMakeLists.txt +++ b/Tests/RunCMake/get_property/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/if/CMakeLists.txt b/Tests/RunCMake/if/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/if/CMakeLists.txt +++ b/Tests/RunCMake/if/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include/CMakeLists.txt b/Tests/RunCMake/include/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/include/CMakeLists.txt +++ b/Tests/RunCMake/include/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/CMakeLists.txt b/Tests/RunCMake/include_external_msproject/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/include_external_msproject/CMakeLists.txt +++ b/Tests/RunCMake/include_external_msproject/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 0a2ba63..0162519 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -63,7 +63,7 @@ function(check_custom_platform TARGET_FILE PROJECT_NAME PLATFORM_NAME RESULT) return() endif() - # probably whould be better to use configuration name + # probably would be better to use configuration name # extracted from CMAKE_CONFIGURATION_TYPES than just hardcoded "Debug" instead set(REG_EXP "^(\t)*\\{${FOUND_GUID}\\}\\.Debug[^ ]*\\.ActiveCfg = Debug\\|${PLATFORM_NAME}$") check_line_exists(${TARGET_FILE} REG_EXP) diff --git a/Tests/RunCMake/install/EXPORT-NamelinkOnly.cmake b/Tests/RunCMake/install/EXPORT-NamelinkOnly.cmake new file mode 100644 index 0000000..1c310d1 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-NamelinkOnly.cmake @@ -0,0 +1,12 @@ +enable_language(C) +add_library(foo SHARED empty.c) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + NAMELINK_ONLY +) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) diff --git a/Tests/RunCMake/install/EXPORT-UnknownExport-result.txt b/Tests/RunCMake/install/EXPORT-UnknownExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-UnknownExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/EXPORT-UnknownExport-stderr.txt b/Tests/RunCMake/install/EXPORT-UnknownExport-stderr.txt new file mode 100644 index 0000000..bd49fa2 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-UnknownExport-stderr.txt @@ -0,0 +1 @@ +CMake Error: INSTALL\(EXPORT\) given unknown export "fooExport" diff --git a/Tests/RunCMake/install/EXPORT-UnknownExport.cmake b/Tests/RunCMake/install/EXPORT-UnknownExport.cmake new file mode 100644 index 0000000..2dbba4e --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-UnknownExport.cmake @@ -0,0 +1,5 @@ +enable_language(C) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake new file mode 100644 index 0000000..8750a76 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake @@ -0,0 +1,11 @@ + +set(objs obj1 obj2) +set(targets sse2 sse4 avx avx2) +foreach(o IN LISTS objs) + set(item "objs/${o}\\.ispc\\.(o|obj)") + check_installed("${item}") + foreach(t IN LISTS targets) + set(item "objs/${o}\\.ispc_${t}\\.(o|obj)") + check_installed("${item}") + endforeach() +endforeach() diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake new file mode 100644 index 0000000..ad542ed --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake @@ -0,0 +1,4 @@ +enable_language(ISPC) +add_library(objs OBJECT obj1.ispc obj2.ispc) +set_target_properties(objs PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4") +install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index d83a07c..5aab88c 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -76,6 +76,8 @@ run_cmake(DIRECTORY-DESTINATION-bad) run_cmake(FILES-DESTINATION-bad) run_cmake(TARGETS-DESTINATION-bad) run_cmake(EXPORT-OldIFace) +run_cmake(EXPORT-UnknownExport) +run_cmake(EXPORT-NamelinkOnly) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) @@ -96,6 +98,11 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES} run_install_test(FILES-TARGET_OBJECTS) endif() +if(CMake_TEST_ISPC) + run_install_test(FILES-EXTRA_ISPC_TARGET_OBJECTS) +endif() + + run_install_test(TARGETS-InstallFromSubDir) run_install_test(TARGETS-OPTIONAL) run_install_test(FILES-OPTIONAL) diff --git a/Tests/RunCMake/install/obj1.ispc b/Tests/RunCMake/install/obj1.ispc new file mode 100644 index 0000000..0dc983c --- /dev/null +++ b/Tests/RunCMake/install/obj1.ispc @@ -0,0 +1,4 @@ + +float func1(float a, float b) { + return a + b / 2.; +} diff --git a/Tests/RunCMake/install/obj2.ispc b/Tests/RunCMake/install/obj2.ispc new file mode 100644 index 0000000..7b2aeb9 --- /dev/null +++ b/Tests/RunCMake/install/obj2.ispc @@ -0,0 +1,4 @@ + +float func2(float a, float b) { + return a + b / 2.; +} diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake deleted file mode 100644 index 5a6af1d..0000000 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ /dev/null @@ -1,13 +0,0 @@ -include(RunCMake) - -run_cmake(invalid_name) -run_cmake(target_commands) -run_cmake(no_shared_libs) -run_cmake(whitelist) -run_cmake(invalid_signature) -run_cmake(global-interface) -run_cmake(genex_link) -run_cmake(add_custom_command-TARGET) -run_cmake(IMPORTED_LIBNAME-bad-value) -run_cmake(IMPORTED_LIBNAME-non-iface) -run_cmake(IMPORTED_LIBNAME-non-imported) diff --git a/Tests/RunCMake/interface_library/whitelist-stderr.txt b/Tests/RunCMake/interface_library/whitelist-stderr.txt deleted file mode 100644 index 577c0cc..0000000 --- a/Tests/RunCMake/interface_library/whitelist-stderr.txt +++ /dev/null @@ -1,19 +0,0 @@ -CMake Error at whitelist.cmake:4 \(set_property\): - INTERFACE_LIBRARY targets may only have whitelisted properties. The - property "OUTPUT_NAME" is not allowed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - -CMake Error at whitelist.cmake:5 \(set_property\): - INTERFACE_LIBRARY targets may only have whitelisted properties. The - property "OUTPUT_NAME" is not allowed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - -CMake Error at whitelist.cmake:6 \(get_target_property\): - INTERFACE_LIBRARY targets may only have whitelisted properties. The - property "OUTPUT_NAME" is not allowed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/whitelist.cmake b/Tests/RunCMake/interface_library/whitelist.cmake deleted file mode 100644 index 0db6375..0000000 --- a/Tests/RunCMake/interface_library/whitelist.cmake +++ /dev/null @@ -1,25 +0,0 @@ - -add_library(iface INTERFACE) - -set_property(TARGET iface PROPERTY OUTPUT_NAME output) -set_property(TARGET iface APPEND PROPERTY OUTPUT_NAME append) -get_target_property(outname iface OUTPUT_NAME) - -# Properties starting with `_` are allowed. -set_property(TARGET iface PROPERTY "_custom_property" output) -set_property(TARGET iface APPEND PROPERTY "_custom_property" append) -get_target_property(outname iface "_custom_property") - -# Properties starting with a lowercase letter are allowed. -set_property(TARGET iface PROPERTY "custom_property" output) -set_property(TARGET iface APPEND PROPERTY "custom_property" append) -get_target_property(outname iface "custom_property") - -# PUBLIC_HEADER / PRIVATE_HEADER properties are allowed -set_property(TARGET iface PROPERTY PUBLIC_HEADER foo.h) -set_property(TARGET iface APPEND PROPERTY PUBLIC_HEADER bar.h) -get_target_property(outname iface PUBLIC_HEADER) - -set_property(TARGET iface PROPERTY PRIVATE_HEADER foo.h) -set_property(TARGET iface APPEND PROPERTY PRIVATE_HEADER bar.h) -get_target_property(outname iface PRIVATE_HEADER) diff --git a/Tests/RunCMake/list/CMakeLists.txt b/Tests/RunCMake/list/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/list/CMakeLists.txt +++ b/Tests/RunCMake/list/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt index a0f8837..9103bd2 100644 --- a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt +++ b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt @@ -1,4 +1,13 @@ -^CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): +^CMake Deprecation Warning at GET-CMP0007-WARN.cmake:1 \(cmake_policy\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument <min> value or use a ...<max> suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): Policy CMP0007 is not set: list command no longer ignores empty elements. Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy command to set the policy and suppress this warning. List has value = diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/math/CMakeLists.txt +++ b/Tests/RunCMake/math/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/message/CMakeLists.txt b/Tests/RunCMake/message/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/message/CMakeLists.txt +++ b/Tests/RunCMake/message/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/no_install_prefix/CMakeLists.txt b/Tests/RunCMake/no_install_prefix/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/no_install_prefix/CMakeLists.txt +++ b/Tests/RunCMake/no_install_prefix/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/project/CMakeLists.txt b/Tests/RunCMake/project/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/project/CMakeLists.txt +++ b/Tests/RunCMake/project/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/separate_arguments/MultipleArguments-result.txt b/Tests/RunCMake/separate_arguments/MultipleArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/MultipleArguments-stderr.txt b/Tests/RunCMake/separate_arguments/MultipleArguments-stderr.txt new file mode 100644 index 0000000..bbf1cf2 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleArguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at MultipleArguments.cmake:[0-9]+ \(separate_arguments\): + separate_arguments given unexpected argument\(s\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/MultipleArguments.cmake b/Tests/RunCMake/separate_arguments/MultipleArguments.cmake new file mode 100644 index 0000000..d38a03b --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleArguments.cmake @@ -0,0 +1,2 @@ + +separate_arguments (var UNIX_COMMAND arg1 arg2) diff --git a/Tests/RunCMake/separate_arguments/MultipleCommands-result.txt b/Tests/RunCMake/separate_arguments/MultipleCommands-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleCommands-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/MultipleCommands-stderr.txt b/Tests/RunCMake/separate_arguments/MultipleCommands-stderr.txt new file mode 100644 index 0000000..9dca8f6 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleCommands-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at MultipleCommands.cmake:[0-9]+ \(separate_arguments\): + separate_arguments 'UNIX_COMMAND', 'WINDOWS_COMMAND' and 'NATIVE_COMMAND' + are mutually exclusive +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at MultipleCommands.cmake:[0-9]+ \(separate_arguments\): + separate_arguments 'UNIX_COMMAND', 'WINDOWS_COMMAND' and 'NATIVE_COMMAND' + are mutually exclusive +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at MultipleCommands.cmake:[0-9]+ \(separate_arguments\): + separate_arguments 'UNIX_COMMAND', 'WINDOWS_COMMAND' and 'NATIVE_COMMAND' + are mutually exclusive +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/MultipleCommands.cmake b/Tests/RunCMake/separate_arguments/MultipleCommands.cmake new file mode 100644 index 0000000..cb71fcb --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleCommands.cmake @@ -0,0 +1,6 @@ + +separate_arguments(var UNIX_COMMAND WINDOWS_COMMAND) + +separate_arguments(var UNIX_COMMAND NATIVE_COMMAND) + +separate_arguments(var WINDOWS_COMMAND NATIVE_COMMAND) diff --git a/Tests/RunCMake/separate_arguments/NativeCommand.cmake b/Tests/RunCMake/separate_arguments/NativeCommand.cmake index 1cb009e..0051a79 100644 --- a/Tests/RunCMake/separate_arguments/NativeCommand.cmake +++ b/Tests/RunCMake/separate_arguments/NativeCommand.cmake @@ -17,3 +17,8 @@ if(NOT "${native_out}" STREQUAL "${native_exp}") message(FATAL_ERROR "separate_arguments native-style failed. " "Expected\n [${native_exp}]\nbut got\n [${native_out}]\n") endif() + +separate_arguments(empty_out NATIVE_COMMAND) +if(NOT empty_out STREQUAL "") + message(FATAL_ERROR "separate_arguments native-style failed on no arguments") +endif() diff --git a/Tests/RunCMake/separate_arguments/ProgramCommand.cmake b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake new file mode 100644 index 0000000..bdf5810 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake @@ -0,0 +1,48 @@ + +separate_arguments (out UNIX_COMMAND PROGRAM "xx a b c") +if (out) + message (SEND_ERROR "unexpected result with nonexistent program") +endif() + +set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe") +file(MAKE_DIRECTORY "${TEST_EXE_DIR}") +file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}") +cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe) + +set (ENV{PATH} "${TEST_EXE_DIR}") + + +separate_arguments (out UNIX_COMMAND PROGRAM "${cmake_exe}") +list (LENGTH out length) +if (length EQUAL 0) + message(FATAL_ERROR "existent program not found") +endif() +if (NOT length EQUAL 2) + message(FATAL_ERROR "unexpected arguments") +endif() +list(GET out 0 cmake) +list(GET out 1 args) +if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}") + message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'") +endif() +if (NOT args STREQUAL "") + message (SEND_ERROR "bad value for args: '${args}' instead of ''") +endif() + + +separate_arguments (out UNIX_COMMAND PROGRAM "${cmake_exe} a b c") +list (LENGTH out length) +if (length EQUAL 0) + message(FATAL_ERROR "existent program not found") +endif() +if (NOT length EQUAL 2) + message(FATAL_ERROR "unexpected arguments") +endif() +list(GET out 0 cmake) +list(GET out 1 args) +if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}") + message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'") +endif() +if (NOT args STREQUAL " a b c") + message (SEND_ERROR "bad value for args: '${args}' instead of ' a b c'") +endif() diff --git a/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake new file mode 100644 index 0000000..2826cc9 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake @@ -0,0 +1,28 @@ + +separate_arguments (out UNIX_COMMAND PROGRAM SEPARATE_ARGS "xx a b c") +if (out) + message (SEND_ERROR "unexpected result with nonexistent program") +endif() + +set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe") +file(MAKE_DIRECTORY "${TEST_EXE_DIR}") +file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}") +cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe) + +set (ENV{PATH} "${TEST_EXE_DIR}") + +separate_arguments (out UNIX_COMMAND PROGRAM SEPARATE_ARGS "${cmake_exe} a b c") +list (LENGTH out length) +if (length EQUAL 0) + message(FATAL_ERROR "existent program not found") +endif() +if (NOT length EQUAL 4) + message(FATAL_ERROR "unexpected arguments") +endif() +list(POP_FRONT out cmake) +if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}") + message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'") +endif() +if (NOT out STREQUAL "a;b;c") + message (SEND_ERROR "bad path for args: '${out}' instead of 'a;b;c'") +endif() diff --git a/Tests/RunCMake/separate_arguments/ProgramOnly-result.txt b/Tests/RunCMake/separate_arguments/ProgramOnly-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramOnly-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/ProgramOnly-stderr.txt b/Tests/RunCMake/separate_arguments/ProgramOnly-stderr.txt new file mode 100644 index 0000000..e34ca4c --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramOnly-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at ProgramOnly.cmake:[0-9]+ \(separate_arguments\): + separate_arguments missing required option: 'UNIX_COMMAND' or + 'WINDOWS_COMMAND' or 'NATIVE_COMMAND' +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/ProgramOnly.cmake b/Tests/RunCMake/separate_arguments/ProgramOnly.cmake new file mode 100644 index 0000000..cc21d2b --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramOnly.cmake @@ -0,0 +1,2 @@ + +separate_arguments (var PROGRAM arg) diff --git a/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake index 07951bb..3c02c49 100644 --- a/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake +++ b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake @@ -1,7 +1,15 @@ include(RunCMake) +run_cmake(MultipleCommands) +run_cmake(MultipleArguments) +run_cmake(ProgramOnly) +run_cmake(SeparateArgsOnly) + run_cmake(EmptyCommand) run_cmake(PlainCommand) run_cmake(UnixCommand) run_cmake(WindowsCommand) run_cmake(NativeCommand) + +run_cmake(ProgramCommand) +run_cmake(ProgramCommandWithSeparateArgs) diff --git a/Tests/RunCMake/separate_arguments/SeparateArgsOnly-result.txt b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/SeparateArgsOnly-stderr.txt b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-stderr.txt new file mode 100644 index 0000000..e87b1cb --- /dev/null +++ b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SeparateArgsOnly.cmake:[0-9]+ \(separate_arguments\): + separate_arguments `SEPARATE_ARGS` option requires `PROGRAM' option +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/SeparateArgsOnly.cmake b/Tests/RunCMake/separate_arguments/SeparateArgsOnly.cmake new file mode 100644 index 0000000..876fd7c --- /dev/null +++ b/Tests/RunCMake/separate_arguments/SeparateArgsOnly.cmake @@ -0,0 +1,2 @@ + +separate_arguments (var UNIX_COMMAND SEPARATE_ARGS arg) diff --git a/Tests/RunCMake/separate_arguments/UnixCommand.cmake b/Tests/RunCMake/separate_arguments/UnixCommand.cmake index 0b5767a..c56cd63 100644 --- a/Tests/RunCMake/separate_arguments/UnixCommand.cmake +++ b/Tests/RunCMake/separate_arguments/UnixCommand.cmake @@ -6,3 +6,8 @@ if(NOT "${unix_out}" STREQUAL "${unix_exp}") message(FATAL_ERROR "separate_arguments unix-style failed. " "Expected\n [${unix_exp}]\nbut got\n [${unix_out}]\n") endif() + +separate_arguments(empty_out UNIX_COMMAND) +if(NOT empty_out STREQUAL "") + message(FATAL_ERROR "separate_arguments unix-style failed on no arguments") +endif() diff --git a/Tests/RunCMake/separate_arguments/WindowsCommand.cmake b/Tests/RunCMake/separate_arguments/WindowsCommand.cmake index 86aa14a..cd07494 100644 --- a/Tests/RunCMake/separate_arguments/WindowsCommand.cmake +++ b/Tests/RunCMake/separate_arguments/WindowsCommand.cmake @@ -6,3 +6,8 @@ if(NOT "${windows_out}" STREQUAL "${windows_exp}") message(FATAL_ERROR "separate_arguments windows-style failed. " "Expected\n [${windows_exp}]\nbut got\n [${windows_out}]\n") endif() + +separate_arguments(empty_out WINDOWS_COMMAND) +if(NOT empty_out STREQUAL "") + message(FATAL_ERROR "separate_arguments windows-style failed on no arguments") +endif() diff --git a/Tests/RunCMake/string/CMakeLists.txt b/Tests/RunCMake/string/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/string/CMakeLists.txt +++ b/Tests/RunCMake/string/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/string/JSON.cmake b/Tests/RunCMake/string/JSON.cmake new file mode 100644 index 0000000..ab4194d --- /dev/null +++ b/Tests/RunCMake/string/JSON.cmake @@ -0,0 +1,342 @@ +function(assert_strequal actual expected) + if(NOT expected STREQUAL actual) + message(SEND_ERROR "Output:\n${actual}\nDid not match expected:\n${expected}\n") + endif() +endfunction() + +function(assert_strequal_error actual expected error) + if(error) + message(SEND_ERROR "Unexpected error: ${error}") + endif() + assert_strequal("${actual}" "${expected}") +endfunction() + +function(assert_json_equal error actual expected) + if(error) + message(SEND_ERROR "Unexpected error: ${error}") + endif() + string(JSON eql EQUAL "${actual}" "${expected}") + if(NOT eql) + message(SEND_ERROR "Expected equality got\n ${actual}\n expected\n${expected}") + endif() +endfunction() + +# test EQUAL +string(JSON result EQUAL +[=[ {"foo":"bar"} ]=] +[=[ +{ +"foo": "bar" +} +]=]) +if(NOT result) + message(SEND_ERROR "Expected ON got ${result}") +endif() + +string(JSON result EQUAL +[=[ {"foo":"bar"} ]=] +[=[ +{ +"foo1": "bar" +} +]=]) +if(result) + message(SEND_ERROR "Expected OFF got ${result}") +endif() + + + +set(json1 [=[ +{ + "foo" : "bar", + "array" : [5, "val", {"some": "other"}, null], + "types" : { + "null" : null, + "number" : 5, + "string" : "foo", + "boolean" : false, + "array" : [1,2,3], + "object" : {} + }, + "values" : { + "null" : null, + "number" : 5, + "string" : "foo", + "false" : false, + "true" : true + }, + "special" : { + "foo;bar" : "value1", + ";" : "value2", + "semicolon" : ";", + "list" : ["one", "two;three", "four"], + "quote" : "\"", + "\"" : "quote", + "backslash" : "\\", + "\\" : "backslash", + "slash" : "\/", + "\/" : "slash", + "newline" : "\n", + "\n" : "newline", + "return" : "\r", + "\r" : "return", + "tab" : "\t", + "\t" : "tab", + "backspace" : "\b", + "\b" : "backspace", + "formfeed" : "\f", + "\f" : "formfeed" + } +} +]=]) + +string(JSON result GET "${json1}" foo) +assert_strequal("${result}" bar) +string(JSON result GET "${json1}" array 0) +assert_strequal("${result}" 5) +string(JSON result GET "${json1}" array 1) +assert_strequal("${result}" val) +string(JSON result GET "${json1}" array 2 some) +assert_strequal("${result}" other) + +string(JSON result GET "${json1}" values null) +assert_strequal("${result}" "") +string(JSON result GET "${json1}" values number) +assert_strequal("${result}" 5) +string(JSON result GET "${json1}" values string) +assert_strequal("${result}" "foo") +string(JSON result GET "${json1}" values true) +assert_strequal("${result}" "ON") +if(NOT result) + message(SEND_ERROR "Output did not match expected: TRUE actual: ${result}") +endif() +string(JSON result GET "${json1}" values false) +assert_strequal("${result}" "OFF") +if(result) + message(SEND_ERROR "Output did not match expected: FALSE actual: ${result}") +endif() + +string(JSON result ERROR_VARIABLE error GET "${json1}" foo) +assert_strequal_error("${result}" "bar" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" notThere) +assert_strequal("${result}" "notThere-NOTFOUND") +assert_strequal("${error}" "member 'notThere' not found") + +string(JSON result ERROR_VARIABLE error GET "${json1}" 0) +assert_strequal("${result}" "0-NOTFOUND") +assert_strequal("${error}" "member '0' not found") + +string(JSON result ERROR_VARIABLE error GET "${json1}" array 10) +assert_strequal("${result}" "array-10-NOTFOUND") +assert_strequal("${error}" "expected an index less then 4 got '10'") + +string(JSON result ERROR_VARIABLE error GET "${json1}" array 2 some notThere) +assert_strequal("${result}" "array-2-some-notThere-NOTFOUND") +assert_strequal("${error}" "invalid path 'array 2 some notThere', need element of OBJECT or ARRAY type to lookup 'notThere' got STRING") + +# special chars +string(JSON result ERROR_VARIABLE error GET "${json1}" special "foo;bar") +assert_strequal_error("${result}" "value1" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special ";") +assert_strequal_error("${result}" "value2" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special semicolon) +assert_strequal_error("${result}" ";" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" special list 1) +assert_strequal_error("${result}" "two;three" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}") +assert_json_equal("${error}" "${result}" "${json1}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" array) +assert_json_equal("${error}" "${result}" [=[ [5, "val", {"some": "other"}, null] ]=]) + +string(JSON result ERROR_VARIABLE error GET "${json1}" special quote) +assert_strequal_error("${result}" "\"" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special "\"") +assert_strequal_error("${result}" "quote" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" special backslash) +assert_strequal_error("${result}" "\\" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special "\\") +assert_strequal_error("${result}" "backslash" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" special slash) +assert_strequal_error("${result}" "/" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special "/") +assert_strequal_error("${result}" "slash" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" special newline) +assert_strequal_error("${result}" "\n" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special "\n") +assert_strequal_error("${result}" "newline" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" special return) +assert_strequal_error("${result}" "\r" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special "\r") +assert_strequal_error("${result}" "return" "${error}") + +string(JSON result ERROR_VARIABLE error GET "${json1}" special tab) +assert_strequal_error("${result}" "\t" "${error}") +string(JSON result ERROR_VARIABLE error GET "${json1}" special "\t") +assert_strequal_error("${result}" "tab" "${error}") + +file(READ ${CMAKE_CURRENT_LIST_DIR}/json/unicode.json unicode) +string(JSON char ERROR_VARIABLE error GET "${unicode}" backspace) +string(JSON result ERROR_VARIABLE error GET "${unicode}" "${char}") +assert_strequal_error("${result}" "backspace" "${error}") + +file(READ ${CMAKE_CURRENT_LIST_DIR}/json/unicode.json unicode) +string(JSON char ERROR_VARIABLE error GET "${unicode}" backspace) +string(JSON result ERROR_VARIABLE error GET "${unicode}" "${char}") +assert_strequal_error("${result}" "backspace" "${error}") + +string(JSON char ERROR_VARIABLE error GET "${unicode}" formfeed) +string(JSON result ERROR_VARIABLE error GET "${unicode}" "${char}") +assert_strequal_error("${result}" "formfeed" "${error}") + +string(JSON char ERROR_VARIABLE error GET "${unicode}" datalinkescape) +string(JSON result ERROR_VARIABLE error GET "${unicode}" "${char}") +assert_strequal_error("${result}" "datalinkescape" "${error}") + +# Test TYPE +string(JSON result TYPE "${json1}" types null) +assert_strequal("${result}" NULL) +string(JSON result TYPE "${json1}" types number) +assert_strequal("${result}" NUMBER) +string(JSON result TYPE "${json1}" types string) +assert_strequal("${result}" STRING) +string(JSON result TYPE "${json1}" types boolean) +assert_strequal("${result}" BOOLEAN) +string(JSON result TYPE "${json1}" types array) +assert_strequal("${result}" ARRAY) +string(JSON result TYPE "${json1}" types object) +assert_strequal("${result}" OBJECT) + +# Test LENGTH +string(JSON result ERROR_VARIABLE error LENGTH "${json1}") +assert_strequal("${result}" 5) +if(error) + message(SEND_ERROR "Unexpected error: ${error}") +endif() + +string(JSON result ERROR_VARIABLE error LENGTH "${json1}" array) +assert_strequal("${result}" 4) +if(error) + message(SEND_ERROR "Unexpected error: ${error}") +endif() + +string(JSON result ERROR_VARIABLE error LENGTH "${json1}" foo) +assert_strequal("${result}" "foo-NOTFOUND") +assert_strequal("${error}" "LENGTH needs to be called with an element of type ARRAY or OBJECT, got STRING") + +# Test MEMBER +string(JSON result ERROR_VARIABLE error MEMBER "${json1}" values 2) +assert_strequal("${result}" "number") +if(error) + message(SEND_ERROR "Unexpected error: ${error}") +endif() + +string(JSON result ERROR_VARIABLE error MEMBER "${json1}" values 100) +assert_strequal("${result}" "values-100-NOTFOUND") +assert_strequal("${error}" "expected an index less then 5 got '100'") + +# Test length loops +string(JSON arrayLength ERROR_VARIABLE error LENGTH "${json1}" types array) +if(error) + message(SEND_ERROR "Unexpected error: ${error}") +endif() +set(values "") +math(EXPR arrayLength "${arrayLength}-1") +foreach(index RANGE ${arrayLength}) + string(JSON value ERROR_VARIABLE error GET "${json1}" types array ${index}) + if(error) + message(SEND_ERROR "Unexpected error: ${error}") + endif() + list(APPEND values "${value}") +endforeach() +assert_strequal("${values}" "1;2;3") + +string(JSON valuesLength ERROR_VARIABLE error LENGTH "${json1}" values) +if(error) + message(SEND_ERROR "Unexpected error: ${error}") +endif() +set(values "") +set(members "") +math(EXPR valuesLength "${valuesLength}-1") +foreach(index RANGE ${valuesLength}) + string(JSON member ERROR_VARIABLE error MEMBER "${json1}" values ${index}) + if(error) + message(SEND_ERROR "Unexpected error: ${error}") + endif() + string(JSON value ERROR_VARIABLE error GET "${json1}" values ${member}) + if(error) + message(SEND_ERROR "Unexpected error: ${error}") + endif() + + list(APPEND members "${member}") + list(APPEND values "${value}") +endforeach() +assert_strequal("${members}" "false;null;number;string;true") +assert_strequal("${values}" "OFF;;5;foo;ON") + +# Test REMOVE +set(json2 [=[{ + "foo" : "bar", + "array" : [5, "val", {"some": "other"}, null] +}]=]) +string(JSON result ERROR_VARIABLE error REMOVE ${json2} foo) +assert_json_equal("${error}" "${result}" +[=[{ + "array" : [5, "val", {"some": "other"}, null] +}]=]) + +string(JSON result ERROR_VARIABLE error REMOVE ${json2} array 1) +assert_json_equal("${error}" "${result}" +[=[{ + "foo" : "bar", + "array" : [5, {"some": "other"}, null] +}]=]) + +string(JSON result ERROR_VARIABLE error REMOVE ${json2} array 100) +assert_strequal("${result}" "array-100-NOTFOUND") +assert_strequal("${error}" "expected an index less then 4 got '100'") + +# Test SET +string(JSON result ERROR_VARIABLE error SET ${json2} new 5) +assert_json_equal("${error}" "${result}" +[=[{ + "foo" : "bar", + "array" : [5, "val", {"some": "other"}, null], + "new" : 5 +}]=]) + +string(JSON result ERROR_VARIABLE error SET ${json2} new [=[ {"obj" : false} ]=]) +assert_json_equal("${error}" "${result}" +[=[{ + "foo" : "bar", + "array" : [5, "val", {"some": "other"}, null], + "new" : {"obj" : false} +}]=]) + +string(JSON result ERROR_VARIABLE error SET ${json2} array 0 6) +assert_json_equal("${error}" "${result}" +[=[{ + "foo" : "bar", + "array" : [6, "val", {"some": "other"}, null] +}]=]) + +string(JSON result ERROR_VARIABLE error SET ${json2} array 5 [["append"]]) +assert_json_equal("${error}" "${result}" +[=[{ + "foo" : "bar", + "array" : [5, "val", {"some": "other"}, null, "append"] +}]=]) + +string(JSON result ERROR_VARIABLE error SET ${json2} array 100 [["append"]]) +assert_json_equal("${error}" "${result}" +[=[{ + "foo" : "bar", + "array" : [5, "val", {"some": "other"}, null, "append"] +}]=]) diff --git a/Tests/RunCMake/string/JSONNoArgs-result.txt b/Tests/RunCMake/string/JSONNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JSONNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JSONNoArgs-stderr.txt b/Tests/RunCMake/string/JSONNoArgs-stderr.txt new file mode 100644 index 0000000..426735a --- /dev/null +++ b/Tests/RunCMake/string/JSONNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JSONNoArgs.cmake:1 \(string\): + string sub-command JSON missing out-var argument. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/JSONNoArgs.cmake b/Tests/RunCMake/string/JSONNoArgs.cmake new file mode 100644 index 0000000..4463fe4 --- /dev/null +++ b/Tests/RunCMake/string/JSONNoArgs.cmake @@ -0,0 +1 @@ +string(JSON) diff --git a/Tests/RunCMake/string/JSONNoJson-result.txt b/Tests/RunCMake/string/JSONNoJson-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JSONNoJson-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JSONNoJson-stderr.txt b/Tests/RunCMake/string/JSONNoJson-stderr.txt new file mode 100644 index 0000000..26804df --- /dev/null +++ b/Tests/RunCMake/string/JSONNoJson-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JSONNoJson.cmake:1 \(string\): + string sub-command JSON missing json string argument. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/JSONNoJson.cmake b/Tests/RunCMake/string/JSONNoJson.cmake new file mode 100644 index 0000000..4f819f1 --- /dev/null +++ b/Tests/RunCMake/string/JSONNoJson.cmake @@ -0,0 +1 @@ +string(JSON var GET) diff --git a/Tests/RunCMake/string/JSONOneArg-result.txt b/Tests/RunCMake/string/JSONOneArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JSONOneArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JSONOneArg-stderr.txt b/Tests/RunCMake/string/JSONOneArg-stderr.txt new file mode 100644 index 0000000..282139c --- /dev/null +++ b/Tests/RunCMake/string/JSONOneArg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JSONOneArg.cmake:1 \(string\): + string sub-command JSON missing mode argument. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/JSONOneArg.cmake b/Tests/RunCMake/string/JSONOneArg.cmake new file mode 100644 index 0000000..143f9ca --- /dev/null +++ b/Tests/RunCMake/string/JSONOneArg.cmake @@ -0,0 +1 @@ +string(JSON var) diff --git a/Tests/RunCMake/string/JSONWrongMode-result.txt b/Tests/RunCMake/string/JSONWrongMode-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JSONWrongMode-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JSONWrongMode-stderr.txt b/Tests/RunCMake/string/JSONWrongMode-stderr.txt new file mode 100644 index 0000000..c70991b --- /dev/null +++ b/Tests/RunCMake/string/JSONWrongMode-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at JSONWrongMode.cmake:1 \(string\): + string sub-command JSON got an invalid mode 'FOO', expected one of GET, + GET_ARRAY, TYPE, MEMBER, MEMBERS, LENGTH, REMOVE, SET, EQUAL. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/JSONWrongMode.cmake b/Tests/RunCMake/string/JSONWrongMode.cmake new file mode 100644 index 0000000..7301f7a --- /dev/null +++ b/Tests/RunCMake/string/JSONWrongMode.cmake @@ -0,0 +1 @@ +string(JSON var FOO) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index bb7cb17..ff0bb51 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -1,5 +1,12 @@ include(RunCMake) +run_cmake(JSON) + +run_cmake(JSONNoJson) +run_cmake(JSONWrongMode) +run_cmake(JSONOneArg) +run_cmake(JSONNoArgs) + run_cmake(Append) run_cmake(AppendNoArgs) diff --git a/Tests/RunCMake/string/json/unicode.json b/Tests/RunCMake/string/json/unicode.json new file mode 100644 index 0000000..86fd232 --- /dev/null +++ b/Tests/RunCMake/string/json/unicode.json @@ -0,0 +1,8 @@ +{ + "backspace" : "\b", + "\b" : "backspace", + "formfeed" : "\f", + "\f" : "formfeed" , + "datalinkescape" : "\u0010", + "\u0010" : "datalinkescape" +} diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake index 2e9cba8..6c72546 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.11) project(CMP0022-WARN) add_library(foo SHARED empty_vs6_1.cpp) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake index fcc8da0..dfdf70b 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.11) project(CMP0022-WARN) add_library(foo SHARED empty_vs6_1.cpp) diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt index 8f85fbf..667561e 100644 --- a/Tests/RunCMake/target_link_libraries/CMakeLists.txt +++ b/Tests/RunCMake/target_link_libraries/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake index bab537e..d6ddfae 100644 --- a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake @@ -3,7 +3,8 @@ set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") add_library(imported SHARED IMPORTED) set_target_properties(imported PROPERTIES - IMPORTED_LOCATION "imported" + IMPORTED_LOCATION "imported${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "imported${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LINK_DEPENDENT_LIBRARIES "/path/to/libSharedDep.so" ) add_executable(empty empty.c) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake index 9b97918..9f86b18 100644 --- a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0022 NEW) enable_language(C) add_library(foo STATIC empty.c) add_library(not_exported STATIC empty.c) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake index 7122ae9..20ec438 100644 --- a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0022 NEW) enable_language(C) add_library(foo STATIC empty.c) target_link_libraries(foo PRIVATE not_a_target) diff --git a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake index f52fa30..608f47b 100644 --- a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake +++ b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake @@ -1,4 +1,5 @@ enable_language(C) add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +set_target_properties(UnknownImportedGlobal PROPERTIES IMPORTED_LOCATION "unknown.${CMAKE_SHARED_LIBRARY_SUFFIX}") add_library(mylib empty.c) target_link_libraries(mylib UnknownImportedGlobal) diff --git a/Tests/RunCMake/try_compile/CMP0056.cmake b/Tests/RunCMake/try_compile/CMP0056.cmake index e8d3d4a..2ab79d5 100644 --- a/Tests/RunCMake/try_compile/CMP0056.cmake +++ b/Tests/RunCMake/try_compile/CMP0056.cmake @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.1) enable_language(C) set(obj "${CMAKE_C_OUTPUT_EXTENSION}") if(BORLAND) diff --git a/Tests/RunCMake/try_compile/CMakeLists.txt b/Tests/RunCMake/try_compile/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/try_compile/CMakeLists.txt +++ b/Tests/RunCMake/try_compile/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt index 3c6bdf6..bcf95d5 100644 --- a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): - CUDA_STANDARD is set to invalid value '3' + CUDA_STANDARD is set to invalid value '4' + CMake Error at CudaStandard.cmake:[0-9]+ \(try_compile\): Failed to generate test project build system. diff --git a/Tests/RunCMake/try_compile/CudaStandard.cmake b/Tests/RunCMake/try_compile/CudaStandard.cmake index 96da422..a230424 100644 --- a/Tests/RunCMake/try_compile/CudaStandard.cmake +++ b/Tests/RunCMake/try_compile/CudaStandard.cmake @@ -1,7 +1,7 @@ enable_language(CUDA) try_compile(result ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cu - CUDA_STANDARD 3 + CUDA_STANDARD 4 OUTPUT_VARIABLE out ) message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt new file mode 100644 index 0000000..7dcb1de --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt @@ -0,0 +1 @@ +.*Error: Can't compile to multiple variants of avx512skx target!.* diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake new file mode 100644 index 0000000..6d29069 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake @@ -0,0 +1,8 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 + avx512skx-i32x16) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt new file mode 100644 index 0000000..99248bf --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt @@ -0,0 +1 @@ +.*ninja: error: .* multiple rules generate.*src.ispc_avx512skx.o.* diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake new file mode 100644 index 0000000..7f59c14 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake @@ -0,0 +1,11 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 + avx512skx-i32x16) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") +if(NOT result) + message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same") +endif() diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt new file mode 100644 index 0000000..44543ad --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt @@ -0,0 +1 @@ +.*Error: Incorrect targets: avxknl-i32x16.* diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake new file mode 100644 index 0000000..c1ab6f2 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake @@ -0,0 +1,7 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16") +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt new file mode 100644 index 0000000..72e0a01 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt @@ -0,0 +1 @@ +.*Linking ISPC static library* diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt new file mode 100644 index 0000000..a731d52 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt @@ -0,0 +1 @@ +.*Detecting ISPC compiler ABI info - done.* diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake new file mode 100644 index 0000000..0d3bd43 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake @@ -0,0 +1,7 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 82c55cc..5b849bf 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -51,6 +51,15 @@ endif() if(CMake_TEST_CUDA) run_cmake(CudaStandard) endif() +if(CMake_TEST_ISPC) + run_cmake(ISPCTargets) + run_cmake(ISPCInvalidTarget) + set(ninja "") + if(RunCMake_GENERATOR MATCHES "Ninja") + set(ninja "Ninja") + endif() + run_cmake(ISPCDuplicateTarget${ninja}) +endif() if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) run_cmake(CStandardGNU) endif() diff --git a/Tests/RunCMake/try_compile/proj/CMakeLists.txt b/Tests/RunCMake/try_compile/proj/CMakeLists.txt index 78a87c0..652f5b6 100644 --- a/Tests/RunCMake/try_compile/proj/CMakeLists.txt +++ b/Tests/RunCMake/try_compile/proj/CMakeLists.txt @@ -1,2 +1,2 @@ -cmake_minimum_required(VERSION 2.8.10) +cmake_minimum_required(VERSION 3.3) project(TestProject NONE) diff --git a/Tests/RunCMake/try_compile/src.ispc b/Tests/RunCMake/try_compile/src.ispc new file mode 100644 index 0000000..b061f40 --- /dev/null +++ b/Tests/RunCMake/try_compile/src.ispc @@ -0,0 +1,4 @@ + +float func(float a, float b) { + return a + b / 2.; +} diff --git a/Tests/RunCMake/try_run/CMakeLists.txt b/Tests/RunCMake/try_run/CMakeLists.txt index e034780..e93f0b6 100644 --- a/Tests/RunCMake/try_run/CMakeLists.txt +++ b/Tests/RunCMake/try_run/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.0) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/variable_watch/CMakeLists.txt b/Tests/RunCMake/variable_watch/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/variable_watch/CMakeLists.txt +++ b/Tests/RunCMake/variable_watch/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/while/CMakeLists.txt b/Tests/RunCMake/while/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/while/CMakeLists.txt +++ b/Tests/RunCMake/while/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) |