diff options
Diffstat (limited to 'Tests/RunCMake')
537 files changed, 3296 insertions, 274 deletions
diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake index 3fbb2cf..9137f2b 100644 --- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake +++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake @@ -5,7 +5,9 @@ add_library(car foo.cxx) add_library(bar bar.c) add_library(dog foo.cxx) target_link_libraries(foo PRIVATE car bar dog debug -lm) -export(TARGETS bar dog car foo ANDROID_MK +add_library(foo2 foo.cxx) +target_link_options(foo2 INTERFACE -lm) +export(TARGETS bar dog car foo foo2 ANDROID_MK ${build_BINARY_DIR}/Android.mk) -install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp) +install(TARGETS bar dog car foo foo2 DESTINATION lib EXPORT myexp) install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules) diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt index bbf67a5..a0e5044 100644 --- a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt +++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt @@ -24,3 +24,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog LOCAL_EXPORT_LDLIBS := -lm LOCAL_HAS_CPP := true include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo2 +LOCAL_SRC_FILES.*.*foo2.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_EXPORT_LDFLAGS := -lm +LOCAL_HAS_CPP := true +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt index 3515fb9..28b1c21 100644 --- a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt +++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt @@ -26,3 +26,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog LOCAL_EXPORT_LDLIBS := -lm LOCAL_HAS_CPP := true include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo2 +LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo2.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_EXPORT_LDFLAGS := -lm +LOCAL_HAS_CPP := true +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake new file mode 100644 index 0000000..063a7f3 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake @@ -0,0 +1,5 @@ +if(DEFINED CMP0080_VALUE) + cmake_policy(SET CMP0080 ${CMP0080_VALUE}) +endif() + +include(BundleUtilities) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt +++ b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-result.txt diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt new file mode 100644 index 0000000..1454b0c --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Modules/BundleUtilities\.cmake:[0-9]+ \(message\): + BundleUtilities cannot be included at configure time! diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake new file mode 100644 index 0000000..558c16d --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0080 NEW) +include(BundleUtilities) diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake new file mode 100644 index 0000000..a65d92f --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0080 OLD) +include(BundleUtilities) diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt new file mode 100644 index 0000000..c3d541e --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at .*/Modules/BundleUtilities\.cmake:[0-9]+ \(message\): + Policy CMP0080 is not set: BundleUtilities cannot be included at configure + time\. Run "cmake --help-policy CMP0080" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + .*/Modules/BundleUtilities\.cmake:[0-9]+ \(_warn_cmp0080\) + CMP0080-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/BundleUtilities/CMP0080-WARN.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-WARN.cmake new file mode 100644 index 0000000..45f6f92 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-WARN.cmake @@ -0,0 +1 @@ +include(BundleUtilities) diff --git a/Tests/RunCMake/BundleUtilities/CMakeLists.txt b/Tests/RunCMake/BundleUtilities/CMakeLists.txt new file mode 100644 index 0000000..6dd8cdf --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake b/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake new file mode 100644 index 0000000..14aaff1 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.4) +include(RunCMake) + +# TODO Migrate Tests/BundleUtilities here + +run_cmake(CMP0080-OLD) +run_cmake(CMP0080-NEW) +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) diff --git a/Tests/RunCMake/Byproducts/CMakeLists.txt b/Tests/RunCMake/Byproducts/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/Byproducts/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Byproducts/CleanByproducts.cmake b/Tests/RunCMake/Byproducts/CleanByproducts.cmake new file mode 100644 index 0000000..85d9582 --- /dev/null +++ b/Tests/RunCMake/Byproducts/CleanByproducts.cmake @@ -0,0 +1,93 @@ +cmake_minimum_required(VERSION 3.10) +project(CleanByproducts) + +# Configurable parameters +set(TEST_CLEAN_NO_CUSTOM FALSE CACHE BOOL "Value for the CLEAN_NO_CUSTOM PROPERTY") +set(TEST_BUILD_EVENTS TRUE CACHE BOOL "Create byproducts with build events") +set(TEST_CUSTOM_TARGET TRUE CACHE BOOL "Create a byproduct with a custom target") +set(TEST_CUSTOM_COMMAND TRUE CACHE BOOL "Create a byproduct with a custom command") + +set_property(DIRECTORY PROPERTY CLEAN_NO_CUSTOM ${TEST_CLEAN_NO_CUSTOM}) + +macro(add_build_event) + set(oneValueArgs EVENT) + + cmake_parse_Arguments(ABE "" "${oneValueArgs}" "" ${ARGN}) + + # Create two byproducts and only declare one + add_custom_command(TARGET foo + ${ABE_EVENT} + COMMAND ${CMAKE_COMMAND} -E touch foo.${ABE_EVENT} + COMMAND ${CMAKE_COMMAND} -E touch foo.${ABE_EVENT}.notdeclared + COMMENT "Creating byproducts with ${ABE_EVENT}" + BYPRODUCTS foo.${ABE_EVENT} + ) + + # The nondeclared byproduct should always be present + list(APPEND EXPECTED_PRESENT foo.${ABE_EVENT}.notdeclared) + + # If CLEAN_NO_CUSTOM is set, the declared byproduct should be present + if(TEST_CLEAN_NO_CUSTOM) + list(APPEND EXPECTED_PRESENT foo.${ABE_EVENT}) + else() + list(APPEND EXPECTED_DELETED foo.${ABE_EVENT}) + endif() +endmacro() + +add_executable(foo foo.cpp) + +# Test build events +if(TEST_BUILD_EVENTS) + add_build_event(EVENT "PRE_BUILD" ENABLE ${TEST_PRE_BUILD}) + add_build_event(EVENT "PRE_LINK" ENABLE ${TEST_PRE_LINK}) + add_build_event(EVENT "POST_BUILD" ENABLE ${TEST_POST_BUILD}) +endif() + +# Custom command that generates byproducts +if(TEST_CUSTOM_COMMAND) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp.in "void bar() {}\n") + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp + COMMAND ${CMAKE_COMMAND} -E touch foo.customcommand + COMMAND ${CMAKE_COMMAND} -E touch foo.customcommand.notdeclared + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp + BYPRODUCTS foo.customcommand + COMMENT "Creating byproducts with a custom command" + ) + + # The nondeclared byproduct should always be present + list(APPEND EXPECTED_PRESENT "foo.customcommand.notdeclared") + + # If CLEAN_NO_CUSTOM is set, both the output and byproduct should be present + if(TEST_CLEAN_NO_CUSTOM) + list(APPEND EXPECTED_PRESENT "bar.cpp") + list(APPEND EXPECTED_PRESENT "foo.customcommand") + else() + list(APPEND EXPECTED_DELETED "bar.cpp") + list(APPEND EXPECTED_DELETED "foo.customcommand") + endif() + + target_sources(foo PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/bar.cpp") +endif() + +# Custom target that generates byproducts +if(TEST_CUSTOM_TARGET) + add_custom_target(foo_file ALL + DEPENDS foo + COMMAND ${CMAKE_COMMAND} -E touch foo.customtarget + COMMAND ${CMAKE_COMMAND} -E touch foo.customtarget.notdeclared + BYPRODUCTS foo.customtarget + COMMENT "Creating byproducts with a custom target" + ) + + # The nondeclared byproduct should always be present + list(APPEND EXPECTED_PRESENT "foo.customtarget.notdeclared") + + # If CLEAN_NO_CUSTOM is set, the declared byproduct should be present + if(TEST_CLEAN_NO_CUSTOM) + list(APPEND EXPECTED_PRESENT "foo.customtarget") + else() + list(APPEND EXPECTED_DELETED "foo.customtarget") + endif() +endif() + +configure_file(files.cmake.in files.cmake) diff --git a/Tests/RunCMake/Byproducts/RunCMakeTest.cmake b/Tests/RunCMake/Byproducts/RunCMakeTest.cmake new file mode 100644 index 0000000..a7584ee --- /dev/null +++ b/Tests/RunCMake/Byproducts/RunCMakeTest.cmake @@ -0,0 +1,58 @@ +include(RunCMake) + +function(run_CleanByproducts case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CleanByproducts-${case}-build) + set(RunCMake_TEST_OPTIONS "${ARGN}") + + run_cmake(CleanByproducts) + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(CleanByProducts-build ${CMAKE_COMMAND} --build .) + include("${RunCMake_TEST_BINARY_DIR}/files.cmake") + + message("Checking that all expected files are present") + check_files(EXPECTED_PRESENT "${RunCMake_TEST_BINARY_DIR}" TRUE) + check_files(EXPECTED_DELETED "${RunCMake_TEST_BINARY_DIR}" TRUE) + + run_cmake_command(CleanByProducts-clean ${CMAKE_COMMAND} --build . --target clean) + + message("Checking that only the expected files are present after cleaning") + check_files(EXPECTED_PRESENT "${RunCMake_TEST_BINARY_DIR}" TRUE) + check_files(EXPECTED_DELETED "${RunCMake_TEST_BINARY_DIR}" FALSE) +endfunction() + +function(check_files list path has_to_exist) + foreach(file IN LISTS ${list}) + message("Checking ${file}") + set(file_exists FALSE) + if(EXISTS "${path}/${file}") + set(file_exists TRUE) + endif() + + if(file_exists AND NOT has_to_exist) + message(FATAL_ERROR "${file} should have been deleted") + elseif(NOT file_exists AND has_to_exist) + message(FATAL_ERROR "${file} does not exist") + elseif(file_exists AND has_to_exist) + message("${file} found as expected") + elseif(NOT file_exists AND NOT has_to_exist) + message("${file} deleted as expected") + endif() + + endforeach() +endfunction() + + +# Iterate through all possible test values +set(counter 0) +foreach(test_clean_no_custom TRUE FALSE) + foreach(test_build_events TRUE FALSE) + foreach(test_custom_command TRUE FALSE) + foreach(test_custom_target TRUE FALSE) + math(EXPR counter "${counter} + 1") + message("Test ${counter} - CLEAN_NO_CUSTOM: ${test_clean_no_custom}, Build events: ${test_build_events}, Custom command: ${test_custom_command}, Custom target: ${test_custom_target}") + run_CleanByproducts("buildevents${counter}" -DCLEAN_NO_CUSTOM=${test_clean_no_custom} -DTEST_BUILD_EVENTS=${test_build_events} -DTEST_CUSTOM_COMMAND=${test_custom_command} -DTEST_CUSTOM_TARGET=${test_custom_target}) + endforeach() + endforeach() + endforeach() +endforeach() diff --git a/Tests/RunCMake/Byproducts/files.cmake.in b/Tests/RunCMake/Byproducts/files.cmake.in new file mode 100644 index 0000000..a7d4831 --- /dev/null +++ b/Tests/RunCMake/Byproducts/files.cmake.in @@ -0,0 +1,2 @@ +set(EXPECTED_PRESENT "@EXPECTED_PRESENT@") +set(EXPECTED_DELETED "@EXPECTED_DELETED@") diff --git a/Tests/RunCMake/Byproducts/foo.cpp b/Tests/RunCMake/Byproducts/foo.cpp new file mode 100644 index 0000000..d47cb91 --- /dev/null +++ b/Tests/RunCMake/Byproducts/foo.cpp @@ -0,0 +1,14 @@ +int bar(int y) +{ + return y * 6; +} + +int foo(int x) +{ + return x * bar(x); +} + +int main() +{ + return foo(4); +} diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt index 05b0217..6a1f1bd 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt @@ -4,4 +4,4 @@ CMake Error at CMP0026-CONFIG-LOCATION-NEW.cmake:7 \(get_target_property\): expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt index edeb337..84dec32 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt @@ -7,4 +7,4 @@ 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\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt index d44dcb4..d2209fd 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt @@ -8,5 +8,5 @@ CMake Warning \(dev\) at CMP0026-CONFIG-LOCATION-WARN.cmake:5 \(get_target_prope expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt index fec9dfb..1490103 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt @@ -4,4 +4,4 @@ CMake Error at CMP0026-LOCATION-CONFIG-NEW.cmake:7 \(get_target_property\): expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt index 32ff698..1fb4ef6 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt @@ -7,4 +7,4 @@ 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\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt index cd6f3d0..8b4faf0 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt @@ -8,5 +8,5 @@ CMake Warning \(dev\) at CMP0026-LOCATION-CONFIG-WARN.cmake:5 \(get_target_prope expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt index fa02512..8c47c2a 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt @@ -4,4 +4,4 @@ CMake Error at CMP0026-NEW.cmake:7 \(get_target_property\): expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt index b3f79fc..b4282f5 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt @@ -7,4 +7,4 @@ 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\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt index d122c4a..0d39596 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt @@ -8,7 +8,7 @@ CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. + CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\): @@ -21,5 +21,5 @@ CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\): expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt index 0996cb6..6377921 100644 --- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt +++ b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt @@ -8,5 +8,5 @@ CMake Warning \(dev\) at LOCATION-and-TARGET_OBJECTS.cmake:[0-9]+ \(get_target_p \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:[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/CMP0026/ObjlibNotDefined-stderr.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt index 87d198d..360d987 100644 --- a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt +++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt @@ -8,5 +8,5 @@ CMake Warning \(dev\) at ObjlibNotDefined.cmake:[0-9]+ \(get_target_property\): expression \$<TARGET_FILE>, as appropriate. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt index 157a046..3525704 100644 --- a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt +++ b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt @@ -7,4 +7,4 @@ 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\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt index 697265e..e1c44e5 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt @@ -7,6 +7,6 @@ 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\) + CMakeLists\.txt:[0-9]+ \(include\) + Sources: "empty.cpp"$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt index ae2e468..78c6b6d 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt @@ -9,7 +9,7 @@ CMake Warning \(dev\) at CMP0051-WARN.cmake:6 \(get_target_property\): needs to be adapted to ignore the generator expression using the string\(GENEX_STRIP\) command. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. Sources: "empty.cpp" @@ -25,7 +25,7 @@ CMake Warning \(dev\) at CMP0051-WARN.cmake:12 \(get_target_property\): needs to be adapted to ignore the generator expression using the string\(GENEX_STRIP\) command. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. Sources: "../empty.cpp"$ diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt new file mode 100644 index 0000000..d0a156c --- /dev/null +++ b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0055-OLD-Out-of-Scope.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0055 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/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt new file mode 100644 index 0000000..937b352 --- /dev/null +++ b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0055-OLD-Reject-Arguments.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0055 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/CMP0060/CMP0060-OLD-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt new file mode 100644 index 0000000..4658747 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0060-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0060 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/CMP0069/RunCMakeTest.cmake b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake index f44f840..456e6a6 100644 --- a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake @@ -5,6 +5,6 @@ run_cmake(CMP0069-NEW-cmake) run_cmake(CMP0069-NEW-compiler) run_cmake(CMP0069-WARN) -if(RunCMake_GENERATOR MATCHES "^Visual Studio ") +if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ") run_cmake(CMP0069-NEW-generator) endif() diff --git a/Tests/RunCMake/CMP0081/CMP0081-Common.cmake b/Tests/RunCMake/CMP0081/CMP0081-Common.cmake new file mode 100644 index 0000000..3ea5277 --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-Common.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_library(foo SHARED empty.cpp) +set_target_properties(foo PROPERTIES LINK_DIRECTORIES "../lib") diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/CMP0081/CMP0081-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt +++ b/Tests/RunCMake/CMP0081/CMP0081-NEW-result.txt diff --git a/Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt b/Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt new file mode 100644 index 0000000..d31c149 --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Found relative path while evaluating link directories of "foo": + + "../lib" diff --git a/Tests/RunCMake/CMP0081/CMP0081-NEW.cmake b/Tests/RunCMake/CMP0081/CMP0081-NEW.cmake new file mode 100644 index 0000000..9b927a2 --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0081 NEW) + +include (CMP0081-Common.cmake) diff --git a/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt b/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0081/CMP0081-OLD.cmake b/Tests/RunCMake/CMP0081/CMP0081-OLD.cmake new file mode 100644 index 0000000..2e91bf6 --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0081 OLD) + +include (CMP0081-Common.cmake) diff --git a/Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt b/Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt b/Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt new file mode 100644 index 0000000..eac0648 --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0081 is not set: Relative paths not allowed in LINK_DIRECTORIES + target property. Run "cmake --help-policy CMP0081" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + Found relative path while evaluating link directories of "foo": + + "../lib" + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0081/CMP0081-WARN.cmake b/Tests/RunCMake/CMP0081/CMP0081-WARN.cmake new file mode 100644 index 0000000..33bb21d --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-WARN.cmake @@ -0,0 +1,2 @@ + +include (CMP0081-Common.cmake) diff --git a/Tests/RunCMake/CMP0081/CMakeLists.txt b/Tests/RunCMake/CMP0081/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0081/RunCMakeTest.cmake b/Tests/RunCMake/CMP0081/RunCMakeTest.cmake new file mode 100644 index 0000000..335d8c5 --- /dev/null +++ b/Tests/RunCMake/CMP0081/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0081-OLD) +run_cmake(CMP0081-NEW) +run_cmake(CMP0081-WARN) diff --git a/Tests/RunCMake/CMP0081/empty.cpp b/Tests/RunCMake/CMP0081/empty.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/CMP0081/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6122350..394dd6d 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -106,6 +106,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) add_RunCMake_test(CMP0068) endif() add_RunCMake_test(CMP0069) +add_RunCMake_test(CMP0081) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -143,6 +144,9 @@ endif() add_RunCMake_test(AndroidTestUtilities) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") + add_RunCMake_test(Byproducts) +endif() +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() add_RunCMake_test(CompilerNotFound) @@ -154,6 +158,9 @@ add_RunCMake_test(FPHSA) add_RunCMake_test(FindBoost) add_RunCMake_test(FindLua) add_RunCMake_test(FindOpenGL) +if(CMake_TEST_UseSWIG) + add_RunCMake_test(UseSWIG) +endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) endif() @@ -239,7 +246,9 @@ add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) +add_RunCMake_test(math) add_RunCMake_test(message) +add_RunCMake_test(option) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(project_injected) add_RunCMake_test(return) @@ -247,6 +256,7 @@ add_RunCMake_test(separate_arguments) add_RunCMake_test(set_property) add_RunCMake_test(string) add_RunCMake_test(test_include_dirs) +add_RunCMake_test(BundleUtilities) function(add_RunCMake_test_try_compile) if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") @@ -334,6 +344,8 @@ endif() add_RunCMake_test(File_Generate) add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_libraries) +add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) +add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test(target_compile_features) add_RunCMake_test(CheckModules) @@ -422,7 +434,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ctest_labels_for_subprojects) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ") +add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 447b08b..d00ef3b 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -1,10 +1,14 @@ cmake_policy(SET CMP0057 NEW) -function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE) +function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - set(full_test_name_ "${TEST_NAME}") + if(package_target) + set(full_test_name_ "${TEST_NAME}-package-target") + else() + set(full_test_name_ "${TEST_NAME}") + endif() + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build") if(SUBTEST_SUFFIX) set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest") @@ -67,9 +71,19 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK unset(pack_params_) endif() + if(package_target) + set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package) + else() + set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_}) + endif() + # execute cpack + set(SETENV) + if(ENVIRONMENT) + set(SETENV ${CMAKE_COMMAND} -E env "${ENVIRONMENT}") + endif() execute_process( - COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_} + COMMAND ${SETENV} ${cpack_command_} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" RESULT_VARIABLE "result_" OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" @@ -113,18 +127,24 @@ endfunction() function(run_cpack_test TEST_NAME types build PACKAGING_TYPES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false) + endforeach() +endfunction() + +function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true) endforeach() endfunction() function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES) foreach(suffix_ IN LISTS SUBTEST_SUFFIXES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false) endforeach() endforeach() endfunction() function(run_cpack_source_test TEST_NAME types) - run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "") + run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false) endfunction() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index f7c5c84..9b98ed4 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -1,7 +1,7 @@ -set(ALL_FILES_GLOB "*.deb") +set(ALL_FILES_GLOB "*.deb" "*.ddeb") function(getPackageContent FILE RESULT_VAR) - execute_process(COMMAND ${DPKG_EXECUTABLE} -c "${FILE}" + execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${DPKG_EXECUTABLE} -c "${FILE}" OUTPUT_VARIABLE package_content_ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/Tests/RunCMake/CPack/Ext/Helpers.cmake b/Tests/RunCMake/CPack/Ext/Helpers.cmake new file mode 100644 index 0000000..2c67e06 --- /dev/null +++ b/Tests/RunCMake/CPack/Ext/Helpers.cmake @@ -0,0 +1,31 @@ +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + set(${RESULT_VAR} "${NAME}-${VERSION}-*.json" PARENT_SCOPE) +endfunction() + +function(getPackageContentList FILE RESULT_VAR) + set("${RESULT_VAR}" "" PARENT_SCOPE) +endfunction() + +function(toExpectedContentList FILE_NO CONTENT_VAR) + set("${CONTENT_VAR}" "" PARENT_SCOPE) +endfunction() + +set(ALL_FILES_GLOB "*.json") + +function(check_ext_json EXPECTED_FILE ACTUAL_FILE) + file(READ "${EXPECTED_FILE}" _expected_regex) + file(READ "${ACTUAL_FILE}" _actual_contents) + + string(REGEX REPLACE "\n+$" "" _expected_regex "${_expected_regex}") + string(REGEX REPLACE "\n+$" "" _actual_contents "${_actual_contents}") + + if(NOT "${_actual_contents}" MATCHES "${_expected_regex}") + message(FATAL_ERROR + "Output JSON does not match expected regex.\n" + "Expected regex:\n" + "${_expected_regex}\n" + "Actual output:\n" + "${_actual_contents}\n" + ) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/Ext/Prerequirements.cmake b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index 4a0e4e6..f02f9d6 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 4b7f146..91d3cb7 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -6,7 +6,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES" run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT") run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") -run_cpack_test(DEBUGINFO "RPM" true "COMPONENT") +run_cpack_test(DEBUGINFO "RPM;DEB" true "COMPONENT") run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") run_cpack_test(DIST "RPM" false "MONOLITHIC") @@ -18,7 +18,8 @@ run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") -run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT") +run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") @@ -27,7 +28,11 @@ run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT") run_cpack_source_test(SOURCE_PACKAGE "RPM") run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT") +set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789") +run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT") +unset(ENVIRONMENT) run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "Ext" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 1f5ab87..345b37f 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -56,8 +56,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) set(EXPECTED_FILE_CONTENT_${file_no_} "${EXPECTED_FILE_CONTENT_${file_no_}_LIST}") toExpectedContentList("${file_no_}" "EXPECTED_FILE_CONTENT_${file_no_}") - list(SORT PACKAGE_CONTENT) - list(SORT EXPECTED_FILE_CONTENT_${file_no_}) + if(NOT PACKAGE_CONTENT STREQUAL "") + list(SORT PACKAGE_CONTENT) + endif() + if(NOT EXPECTED_FILE_CONTENT_${file_no_} STREQUAL "") + list(SORT EXPECTED_FILE_CONTENT_${file_no_}) + endif() if(PACKAGE_CONTENT STREQUAL EXPECTED_FILE_CONTENT_${file_no_}) set(expected_content_list TRUE) @@ -88,7 +92,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) # check that there were no extra files generated foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB) file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}") - list(APPEND allFoundFiles_ "${foundAll_}") + list(APPEND allFoundFiles_ ${foundAll_}) endforeach() list(LENGTH foundFiles_ foundFilesCount_) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index c745828..cf2e8ac 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -3,16 +3,39 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_1_NAME "Debuginfo") +if(GENERATOR_TYPE STREQUAL "RPM") + set(NAME "Debuginfo") + set(DEBUG_SUFFIX "debuginfo") + set(PKG "rpm") + set(DEBUG_PKG "rpm") +elseif(GENERATOR_TYPE STREQUAL "DEB") + set(NAME "debuginfo") + set(DEBUG_SUFFIX "dbgsym") + set(PKG "deb") + set(DEBUG_PKG "ddeb") +endif() + +set(EXPECTED_FILE_1_NAME "${NAME}") set(EXPECTED_FILE_1_COMPONENT "applications") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") -set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.rpm") + +set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.${PKG}") set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") -set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.rpm") + +set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.${PKG}") set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") -set(EXPECTED_FILE_4_NAME "Debuginfo") -set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") -set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") -set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm") -set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") +set(EXPECTED_FILE_4 "${NAME}-applications-${DEBUG_SUFFIX}*.${DEBUG_PKG}") +if(GENERATOR_TYPE STREQUAL "RPM") + set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") +elseif(GENERATOR_TYPE STREQUAL "DEB") + set(EXPECTED_FILE_CONTENT_4 ".*/usr/lib/debug/.build-id/.*\.debug.*") +endif() + +if(GENERATOR_TYPE STREQUAL "RPM") + set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm") + set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") +elseif(GENERATOR_TYPE STREQUAL "DEB") + set(EXPECTED_FILE_5 "TestDinfo-pkg-libs-dbgsym.ddeb") + set(EXPECTED_FILE_CONTENT_5 ".*/usr/lib/debug/.build-id/.*\.debug.*") +endif() diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index 71457d4..161a36a 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -29,12 +29,16 @@ install(TARGETS test_lib DESTINATION bas COMPONENT libs) set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) +set(CPACK_DEBIAN_APPLICATIONS_FILE_NAME "DEB-DEFAULT") +set(CPACK_DEBIAN_APPLICATIONS_DEBUGINFO_PACKAGE ON) # test that components with debuginfo enabled still honor # CPACK_PACKAGE_FILE_NAME setting set(CPACK_RPM_PACKAGE_NAME "Debuginfo") set(CPACK_PACKAGE_FILE_NAME "TestDinfo-pkg") set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) +set(CPACK_DEBIAN_PACKAGE_NAME "Debuginfo") +set(CPACK_DEBIAN_LIBS_DEBUGINFO_PACKAGE ON) # test debuginfo package rename set(CPACK_RPM_DEBUGINFO_FILE_NAME diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake new file mode 100644 index 0000000..91608c9 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake @@ -0,0 +1,7 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt") +else() + set(EXPECTED_FILES_COUNT "0") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake new file mode 100644 index 0000000..97b74f7 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake @@ -0,0 +1,3 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)") + check_ext_json("${src_dir}/tests/EXT/expected-json-1.0.txt" "${FOUND_FILE_1}") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/create_package.cmake b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake new file mode 100644 index 0000000..e308ccb --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake @@ -0,0 +1,24 @@ +message("This script could run an external packaging tool") + +function(expect_variable VAR) + if(NOT ${VAR}) + message(FATAL_ERROR "${VAR} is unexpectedly not set") + endif() +endfunction() + +function(expect_file FILE) + if(NOT EXISTS "${FILE}") + message(FATAL_ERROR "${FILE} is unexpectedly missing") + endif() +endfunction() + +expect_variable(CPACK_COMPONENTS_ALL) +expect_variable(CPACK_TOPLEVEL_DIRECTORY) +expect_variable(CPACK_TEMPORARY_DIRECTORY) +expect_variable(CPACK_PACKAGE_DIRECTORY) +expect_variable(CPACK_PACKAGE_FILE_NAME) + +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt) diff --git a/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt new file mode 100644 index 0000000..b96cf0b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt @@ -0,0 +1,176 @@ +^\{ + "componentGroups" :[ ] + \{ + "f12" :[ ] + \{ + "components" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component group for files 1 and 2", + "displayName" : "Files 1 and 2", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f12", + "parentGroup" : "f1234", + "subgroups" : \[\] + \}, + "f1234" :[ ] + \{ + "components" : \[\], + "description" : "Component group for all files", + "displayName" : "Files 1-4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f1234", + "subgroups" :[ ] + \[ + "f12", + "f34" + \] + \}, + "f34" :[ ] + \{ + "components" :[ ] + \[ + "f3", + "f4" + \], + "description" : "Component group for files 3 and 4", + "displayName" : "Files 3 and 4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f34", + "parentGroup" : "f1234", + "subgroups" : \[\] + \} + \}, + "components" :[ ] + \{ + "f1" :[ ] + \{ + "archiveFile" : "", + "dependencies" : \[\], + "description" : "Component for file 1", + "displayName" : "File 1", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f1" + \}, + "f2" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1" + \], + "description" : "Component for file 2", + "displayName" : "File 2", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f2" + \}, + "f3" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component for file 3", + "displayName" : "File 3", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f3" + \}, + "f4" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f2", + "f3", + "f1" + \], + "description" : "Component for file 4", + "displayName" : "File 4", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f4" + \} + \}, + "errorOnAbsoluteInstallDestination" : false, + "formatVersionMajor" : 1, + "formatVersionMinor" : 0, + "installationTypes" :[ ] + \{ + "f12" :[ ] + \{ + "displayName" : "Only files 1 and 2", + "index" : 2, + "name" : "f12" + \}, + "full" :[ ] + \{ + "displayName" : "Full installation", + "index" : 1, + "name" : "full" + \} + \}, + "packageDescriptionFile" : ".*/Templates/CPack\.GenericDescription\.txt", + "packageDescriptionSummary" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type built using CMake", + "packageName" : "ext", + "packageVersion" : "0\.1\.1", + "projects" :[ ] + \[ + \{ + "component" : "ALL", + "components" :[ ] + \[ + "f1", + "f2", + "f3", + "f4" + \], + "directory" : ".*/Tests/RunCMake/Ext/CPack/EXT-build-(none|good(_multi)?|invalid_good)-subtest", + "installationTypes" : \[\], + "projectName" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type", + "subDirectory" : "/" + \} + \], + "setDestdir" : false, + "stripFiles" : false, + "warnOnAbsoluteInstallDestination" : false +\}$ diff --git a/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt new file mode 100644 index 0000000..40f2743 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt @@ -0,0 +1 @@ +^This script could run an external packaging tool$ diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake new file mode 100644 index 0000000..976cb6a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake @@ -0,0 +1,86 @@ +include(CPackComponent) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "none") + unset(CPACK_EXT_REQUESTED_VERSIONS) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0;2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major") + set(CPACK_EXT_REQUESTED_VERSIONS "2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor") + set(CPACK_EXT_REQUESTED_VERSIONS "1.1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good") + set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") + set(CPACK_EXT_REQUESTED_VERSIONS "1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") + set(CPACK_EXT_ENABLE_STAGING 1) + set(CPACK_EXT_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake") +endif() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4) + +cpack_add_component(f1 + DISPLAY_NAME "File 1" + DESCRIPTION "Component for file 1" + GROUP f12 + INSTALL_TYPES full f12 +) + +cpack_add_component(f2 + DISPLAY_NAME "File 2" + DESCRIPTION "Component for file 2" + GROUP f12 + DEPENDS f1 + INSTALL_TYPES full f12 +) + +cpack_add_component(f3 + DISPLAY_NAME "File 3" + DESCRIPTION "Component for file 3" + GROUP f34 + DEPENDS f1 f2 + INSTALL_TYPES full +) + +cpack_add_component(f4 + DISPLAY_NAME "File 4" + DESCRIPTION "Component for file 4" + GROUP f34 + DEPENDS f2 f3 f1 + INSTALL_TYPES full +) + +cpack_add_component_group(f12 + DISPLAY_NAME "Files 1 and 2" + DESCRIPTION "Component group for files 1 and 2" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f34 + DISPLAY_NAME "Files 3 and 4" + DESCRIPTION "Component group for files 3 and 4" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f1234 + DISPLAY_NAME "Files 1-4" + DESCRIPTION "Component group for all files" +) + +cpack_add_install_type(full + DISPLAY_NAME "Full installation" +) + +cpack_add_install_type(f12 + DISPLAY_NAME "Only files 1 and 2" +) diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake index 18ef63c..b4bdb61 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake @@ -1,7 +1,7 @@ function(checkPackageInfo_ TYPE FILE REGEX) getPackageInfo("${FILE}" "FILE_INFO_") if(NOT FILE_INFO_ MATCHES "${REGEX}") - message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'; does not match '${REGEX}'") endif() endfunction() @@ -24,3 +24,15 @@ checkPackageInfo_("name" "${FOUND_FILE_3}" ".*${name_}${whitespaces_}:${whitespa checkPackageInfo_("group" "${FOUND_FILE_1}" ".*${group_}${whitespaces_}:${whitespaces_}default") checkPackageInfo_("group" "${FOUND_FILE_2}" ".*${group_}${whitespaces_}:${whitespaces_}second_group") checkPackageInfo_("group" "${FOUND_FILE_3}" ".*${group_}${whitespaces_}:${whitespaces_}default") + +# check package summaries (not available in DEB) +if(GENERATOR_TYPE STREQUAL "RPM") + checkPackageInfo_("summary" "${FOUND_FILE_1}" ".*Summary${whitespaces_}:${whitespaces_}Global summary") + checkPackageInfo_("summary" "${FOUND_FILE_2}" ".*Summary${whitespaces_}:${whitespaces_}Summary for pkg_2") + checkPackageInfo_("summary" "${FOUND_FILE_3}" ".*Summary${whitespaces_}:${whitespaces_}Global summary") +endif() + +# check package description +checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1") +checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2") +checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake index 8719c0b..dc61d0a 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake @@ -11,6 +11,13 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_${group_} "default") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_${group_} "second_group") + + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_SUMMARY "Global summary") # not used for DEB + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_SUMMARY "Summary for pkg_2") # not used for DEB + + set(CPACK_COMPONENT_PKG_1_DESCRIPTION "Description for pkg_1") + set(CPACK_COMPONENT_PKG_2_DESCRIPTION "Description for pkg_2") + set(CPACK_COMPONENT_PKG_3_DESCRIPTION "Description for pkg_3") endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake new file mode 100644 index 0000000..d1a3a5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/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/TIMESTAMPS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake new file mode 100644 index 0000000..e7e2645 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake @@ -0,0 +1,58 @@ +macro(getFileMetadata_ FILE RESULT_VAR) + if(GENERATOR_TYPE STREQUAL "TGZ") + # getPackageContent defined for archives omit the metadata (non-verbose) + execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${CMAKE_COMMAND} -E tar -xtvf ${FILE} + OUTPUT_VARIABLE ${RESULT_VAR} + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + getPackageContent("${FILE}" ${RESULT_VAR}) + endif() +endmacro() + +function(checkContentTimestamp FILE REGEX) + getFileMetadata_("${FILE}" METADATA_) + + if(NOT METADATA_ MATCHES "${REGEX}") + string(REPLACE "\n" "\n " metadata_indented "${METADATA_}") + message(FATAL_ERROR + "Wrong timestamps in file:\n" + " ${FILE}\n" + "Expected timestamps to match:\n" + " ${REGEX}\n" + "Actual timestamps:\n" + " ${metadata_indented}") + endif() +endfunction() + +function(checkTimestamp FILE_NAME) + file(READ ${FILE_NAME} ACTUAL_TIMESTAMP OFFSET 4 LIMIT 4 HEX) + + if(NOT ACTUAL_TIMESTAMP STREQUAL "00000000") + message(FATAL_ERROR "${FILE_NAME} contains a timestamp [0x${ACTUAL_TIMESTAMP}]") + endif() +endfunction() + +# Expected timestamp is UNIX time 123456789 +if(GENERATOR_TYPE STREQUAL "TGZ") + set(EXPECTED_TIMESTAMP "29 Nov +1973") + set(EXPECTED_FILES foo/ foo/CMakeLists.txt) +else() + set(EXPECTED_TIMESTAMP "1973-11-29 21:33") + set(EXPECTED_FILES ./usr/ ./usr/foo/ ./usr/foo/CMakeLists.txt) +endif() + +set(EXPECTED_METADATA) +foreach(FILE ${EXPECTED_FILES}) + list(APPEND EXPECTED_METADATA ".* ${EXPECTED_TIMESTAMP} ${FILE}") +endforeach() +list(JOIN EXPECTED_METADATA ".*" EXPECTED_REGEX) +checkContentTimestamp("${FOUND_FILE_1}" "${EXPECTED_REGEX}") + +if(GENERATOR_TYPE STREQUAL "TGZ") + checkTimestamp("${FOUND_FILE_1}") +else() + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${FOUND_FILE_1}") + checkTimestamp("data.tar.gz") + checkTimestamp("control.tar.gz") +endif() diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake new file mode 100644 index 0000000..a193852 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_COMPONENTS_ALL test) diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake index e145569..b7d524c 100644 --- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake @@ -8,6 +8,6 @@ run_cmake(not-supported-by-compiler) run_cmake(save-to-result) run_cmake(cmp0069-is-old) -if(RunCMake_GENERATOR MATCHES "^Visual Studio ") +if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ") run_cmake(not-supported-by-generator) endif() diff --git a/Tests/RunCMake/list/SORT-NotList-result.txt b/Tests/RunCMake/CommandLine/B-no-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/SORT-NotList-result.txt +++ b/Tests/RunCMake/CommandLine/B-no-arg-result.txt diff --git a/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt new file mode 100644 index 0000000..2309c5e --- /dev/null +++ b/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt @@ -0,0 +1 @@ +CMake Error: No build directory specified for -B diff --git a/Tests/RunCMake/list/REVERSE-NotList-result.txt b/Tests/RunCMake/CommandLine/B-no-arg2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/REVERSE-NotList-result.txt +++ b/Tests/RunCMake/CommandLine/B-no-arg2-result.txt diff --git a/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt b/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt new file mode 100644 index 0000000..2309c5e --- /dev/null +++ b/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt @@ -0,0 +1 @@ +CMake Error: No build directory specified for -B diff --git a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt index 5315f59..2a4ee64 100644 --- a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt +++ b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: Error processing file: nosuchcachefile.txt -CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build/nosuchcachefile.txt" does not exist. +CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt b/Tests/RunCMake/CommandLine/Cno-file-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt +++ b/Tests/RunCMake/CommandLine/Cno-file-result.txt diff --git a/Tests/RunCMake/CommandLine/Cno-file-stderr.txt b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt new file mode 100644 index 0000000..67a2032 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Error processing file: nosuchcachefile.txt +CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Cno-file-build" does not appear to contain CMakeLists.txt. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt b/Tests/RunCMake/CommandLine/D-no-src-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt +++ b/Tests/RunCMake/CommandLine/D-no-src-result.txt diff --git a/Tests/RunCMake/CommandLine/D-no-src-stderr.txt b/Tests/RunCMake/CommandLine/D-no-src-stderr.txt new file mode 100644 index 0000000..b5ac69c --- /dev/null +++ b/Tests/RunCMake/CommandLine/D-no-src-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/D-no-src-build" does not appear to contain CMakeLists.txt. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/list/FILTER-NotList-result.txt b/Tests/RunCMake/CommandLine/Dno-src-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/FILTER-NotList-result.txt +++ b/Tests/RunCMake/CommandLine/Dno-src-result.txt diff --git a/Tests/RunCMake/CommandLine/Dno-src-stderr.txt b/Tests/RunCMake/CommandLine/Dno-src-stderr.txt new file mode 100644 index 0000000..402c714 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Dno-src-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Dno-src-build" does not appear to contain CMakeLists.txt. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake index d7e652d..5df5f2f 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake @@ -1,6 +1,10 @@ -if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L) - set(RunCMake_TEST_FAILED "Symlink 'L' incorrectly not created!") -endif() -if(EXISTS ${RunCMake_TEST_BINARY_DIR}/L) - set(RunCMake_TEST_FAILED "Symlink 'L' not broken!") +if(${actual_stderr_var} MATCHES "operation not permitted") + unset(msg) +else() + if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L) + set(RunCMake_TEST_FAILED "Symlink 'L' incorrectly not created!") + endif() + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/L) + set(RunCMake_TEST_FAILED "Symlink 'L' not broken!") + endif() endif() diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake index c078ae8..d37df01 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake @@ -1,3 +1,7 @@ -if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L) - set(RunCMake_TEST_FAILED "Symlink 'L' not replaced correctly!") +if(${actual_stderr_var} MATCHES "operation not permitted") + unset(msg) +else() + if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L) + set(RunCMake_TEST_FAILED "Symlink 'L' not replaced correctly!") + endif() endif() diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt new file mode 100644 index 0000000..0ca5a0a --- /dev/null +++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) +add_custom_command( + OUTPUT output.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.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) diff --git a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt index 1cd3469..f1dafc8 100644 --- a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt +++ b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt @@ -2,6 +2,7 @@ cmake \[options\] <path-to-source> cmake \[options\] <path-to-existing-build> + cmake \[options\] -S <path-to-source> -B <path-to-build> 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 3bb2a89..b47abfb 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -3,12 +3,18 @@ cmake_minimum_required(VERSION 3.1) include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(Wizard ${CMAKE_COMMAND} -i) run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C) run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt) +run_cmake_command(Cno-file ${CMAKE_COMMAND} -Cnosuchcachefile.txt) run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt) run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt) run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D) +run_cmake_command(D-no-src ${CMAKE_COMMAND} -D VAR=VALUE) +run_cmake_command(Dno-src ${CMAKE_COMMAND} -DVAR=VALUE) run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U) +run_cmake_command(U-no-src ${CMAKE_COMMAND} -U VAR) +run_cmake_command(Uno-src ${CMAKE_COMMAND} -UVAR) run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities) run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg) @@ -47,6 +53,31 @@ run_cmake_command(cache-bad-entry run_cmake_command(cache-empty-entry ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/) +function(run_ExplicitDirs) + set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs) + set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build) + + file(REMOVE_RECURSE "${binary_dir}") + file(MAKE_DIRECTORY "${binary_dir}") + run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) + run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) + run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) + run_cmake_command(S-no-arg2 ${CMAKE_COMMAND} -S -T) + run_cmake_command(S-B ${CMAKE_COMMAND} -S ${source_dir} -B ${binary_dir}) + + # make sure that -B can explicitly construct build directories + file(REMOVE_RECURSE "${binary_dir}") + run_cmake_command(B-arg ${CMAKE_COMMAND} -B ${binary_dir} ${source_dir}) + file(REMOVE_RECURSE "${binary_dir}") + run_cmake_command(B-arg-reverse-order ${CMAKE_COMMAND} ${source_dir} -B${binary_dir}) + run_cmake_command(B-no-arg ${CMAKE_COMMAND} -B ) + run_cmake_command(B-no-arg2 ${CMAKE_COMMAND} -B -T) + file(REMOVE_RECURSE "${binary_dir}") + run_cmake_command(B-S ${CMAKE_COMMAND} -B${binary_dir} -S${source_dir}) + +endfunction() +run_ExplicitDirs() + function(run_BuildDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) @@ -101,32 +132,35 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") unset(RunCMake_TEST_NO_CLEAN) endif() -if(UNIX) - run_cmake_command(E_create_symlink-no-arg - ${CMAKE_COMMAND} -E create_symlink - ) - run_cmake_command(E_create_symlink-missing-dir - ${CMAKE_COMMAND} -E create_symlink T missing-dir/L - ) +run_cmake_command(E_create_symlink-no-arg + ${CMAKE_COMMAND} -E create_symlink + ) +run_cmake_command(E_create_symlink-missing-dir + ${CMAKE_COMMAND} -E create_symlink T missing-dir/L + ) - # Use a single build tree for a few tests without cleaning. - set(RunCMake_TEST_BINARY_DIR - ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build) - set(RunCMake_TEST_NO_CLEAN 1) - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - run_cmake_command(E_create_symlink-broken-create - ${CMAKE_COMMAND} -E create_symlink T L - ) - run_cmake_command(E_create_symlink-broken-replace - ${CMAKE_COMMAND} -E create_symlink . L - ) - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) +# Use a single build tree for a few tests without cleaning. +# These tests are special on Windows since it will only fail if the user +# running the test does not have the priveldge to create symlinks. If this +# happens we clear the msg in the -check.cmake and say that the test passes +set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +set(RunCMake_TEST_BINARY_DIR + ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build) +set(RunCMake_TEST_NO_CLEAN 1) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +run_cmake_command(E_create_symlink-broken-create + ${CMAKE_COMMAND} -E create_symlink T L + ) +run_cmake_command(E_create_symlink-broken-replace + ${CMAKE_COMMAND} -E create_symlink . L + ) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_DEFAULT_stderr) - run_cmake_command(E_create_symlink-no-replace-dir - ${CMAKE_COMMAND} -E create_symlink T . - ) -endif() +run_cmake_command(E_create_symlink-no-replace-dir + ${CMAKE_COMMAND} -E create_symlink T . + ) set(in ${RunCMake_SOURCE_DIR}/copy_input) set(out ${RunCMake_BINARY_DIR}/copy_output) diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt b/Tests/RunCMake/CommandLine/S-no-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt +++ b/Tests/RunCMake/CommandLine/S-no-arg-result.txt diff --git a/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt new file mode 100644 index 0000000..d1a2ce3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt @@ -0,0 +1 @@ +CMake Error: No source directory specified for -S diff --git a/Tests/RunCMake/CommandLine/S-no-arg2-result.txt b/Tests/RunCMake/CommandLine/S-no-arg2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/S-no-arg2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt b/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt new file mode 100644 index 0000000..d1a2ce3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt @@ -0,0 +1 @@ +CMake Error: No source directory specified for -S diff --git a/Tests/RunCMake/CommandLine/U-no-src-result.txt b/Tests/RunCMake/CommandLine/U-no-src-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/U-no-src-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/U-no-src-stderr.txt b/Tests/RunCMake/CommandLine/U-no-src-stderr.txt new file mode 100644 index 0000000..a3b4b12 --- /dev/null +++ b/Tests/RunCMake/CommandLine/U-no-src-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/U-no-src-build" does not appear to contain CMakeLists.txt. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/Uno-src-result.txt b/Tests/RunCMake/CommandLine/Uno-src-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/Uno-src-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/Uno-src-stderr.txt b/Tests/RunCMake/CommandLine/Uno-src-stderr.txt new file mode 100644 index 0000000..baa8d63 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Uno-src-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Uno-src-build" does not appear to contain CMakeLists.txt. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt index e9be1dc..30385f8 100644 --- a/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt @@ -1,4 +1,4 @@ ^CMake Deprecation Warning at Wdeprecated.cmake:1 \(message\): Some deprecated warning Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CommandLine/Wdev-stderr.txt b/Tests/RunCMake/CommandLine/Wdev-stderr.txt index 88cfb3a..172fb81 100644 --- a/Tests/RunCMake/CommandLine/Wdev-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wdev-stderr.txt @@ -1,11 +1,11 @@ ^CMake Warning \(dev\) at Wdev.cmake:1 \(message\): Some author warning Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning \(dev\) at Wdev.cmake:6 \(include\): include\(\) given empty file name \(ignored\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt index 6acdc73..d681836 100644 --- a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt +++ b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt @@ -1,4 +1,4 @@ ^CMake Deprecation Error at Werror_deprecated.cmake:1 \(message\): Some deprecated warning Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt index 590ec96..35890fc 100644 --- a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt +++ b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt @@ -1,11 +1,11 @@ ^CMake Error \(dev\) at Werror_dev.cmake:4 \(include\): include\(\) given empty file name \(ignored\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This error is for project developers. Use -Wno-error=dev to suppress it. CMake Error \(dev\) at Werror_dev.cmake:7 \(message\): Some author warning Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This error is for project developers. Use -Wno-error=dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Wizard-result.txt b/Tests/RunCMake/CommandLine/Wizard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wizard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/Wizard-stderr.txt b/Tests/RunCMake/CommandLine/Wizard-stderr.txt new file mode 100644 index 0000000..f757aff --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wizard-stderr.txt @@ -0,0 +1 @@ +^The "cmake -i" wizard mode is no longer supported\. diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt index 0ed1698..4589706 100644 --- a/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt @@ -1,4 +1,4 @@ ^CMake Deprecation Warning at Wno-error_deprecated.cmake:2 \(message\): Some deprecated warning Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt index dd22d55..ee28d7f 100644 --- a/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt @@ -1,11 +1,11 @@ ^CMake Warning \(dev\) at Wno-error_dev.cmake:2 \(message\): Some author warning Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning \(dev\) at Wno-error_dev.cmake:6 \(include\): include\(\) given empty file name \(ignored\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt index 573541a..d197c91 100644 --- a/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt +++ b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt @@ -1 +1 @@ -0 +[^0] diff --git a/Tests/RunCMake/Cppcheck/C-error-Build-result.txt b/Tests/RunCMake/Cppcheck/C-error-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-error-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Cppcheck/C-error-Build-stdout.txt b/Tests/RunCMake/Cppcheck/C-error-Build-stdout.txt new file mode 100644 index 0000000..4a24c0c --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-error-Build-stdout.txt @@ -0,0 +1 @@ +.*Error: cppcheck reported failure.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/Cppcheck/C-error.cmake b/Tests/RunCMake/Cppcheck/C-error.cmake new file mode 100644 index 0000000..2254d75 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-error.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -error) +add_executable(main main.c) diff --git a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake index 5fd4ead..e395f36 100644 --- a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake @@ -15,6 +15,7 @@ endfunction() run_cppcheck(C) run_cppcheck(CXX) +run_cppcheck(C-error) run_cppcheck(C-bad) if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt b/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt index c3708a9..5388c46 100644 --- a/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt @@ -5,5 +5,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): The transform name must be a valid C identifier. Call Stack \(most recent call first\): - BadAlgoMap1.cmake:[0-9]+ \(ExternalData_Add_Target\) - CMakeLists.txt:3 \(include\) + BadAlgoMap1\.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt b/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt index 1f10644..a48e414 100644 --- a/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt @@ -5,5 +5,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): The transform name must be a valid C identifier. Call Stack \(most recent call first\): - BadAlgoMap2.cmake:[0-9]+ \(ExternalData_Add_Target\) - CMakeLists.txt:3 \(include\) + BadAlgoMap2\.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt index f68f0be..1f9f6b5 100644 --- a/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt @@ -4,5 +4,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): BAD Call Stack \(most recent call first\): .* - BadHashAlgo1.cmake:3 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadHashAlgo1\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadOption1-stderr.txt b/Tests/RunCMake/ExternalData/BadOption1-stderr.txt index b63d098..fece877 100644 --- a/Tests/RunCMake/ExternalData/BadOption1-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadOption1-stderr.txt @@ -5,5 +5,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Call Stack \(most recent call first\): .* - BadOption1.cmake:2 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + BadOption1\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadOption2-stderr.txt b/Tests/RunCMake/ExternalData/BadOption2-stderr.txt index d114c8a..865552a 100644 --- a/Tests/RunCMake/ExternalData/BadOption2-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadOption2-stderr.txt @@ -5,5 +5,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Call Stack \(most recent call first\): .* - BadOption2.cmake:2 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + BadOption2\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt index aedc330..9d04693 100644 --- a/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt @@ -2,5 +2,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Recurse option "RECURSE:" allowed only with directories. Call Stack \(most recent call first\): .* - BadRecurse1.cmake:2 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadRecurse1\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt index 3f809ca..135b424 100644 --- a/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt @@ -2,5 +2,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Recurse option "RECURSE:" allowed only with directories. Call Stack \(most recent call first\): .* - BadRecurse2.cmake:2 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadRecurse2\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt index 37740e0..df9bb0e 100644 --- a/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt @@ -5,5 +5,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Call Stack \(most recent call first\): .* - BadRecurse3.cmake:2 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadRecurse3\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt index 3099be5..5b34959 100644 --- a/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt @@ -15,5 +15,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Call Stack \(most recent call first\): .* - BadSeries1.cmake:3 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadSeries1\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt index 3a02c25..82b2311 100644 --- a/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt @@ -12,5 +12,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): \(x\)\(y\)\$ Call Stack \(most recent call first\): .* - BadSeries2.cmake:3 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadSeries2\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt index 594cb6f6..13e75c5 100644 --- a/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt +++ b/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt @@ -2,5 +2,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Series option ":" not allowed with associated files. Call Stack \(most recent call first\): .* - BadSeries3.cmake:2 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + BadSeries3\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory1-stderr.txt b/Tests/RunCMake/ExternalData/Directory1-stderr.txt index 2bc3c60..8336832 100644 --- a/Tests/RunCMake/ExternalData/Directory1-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory1-stderr.txt @@ -10,5 +10,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): that is directory instead of a file! Call Stack \(most recent call first\): .* - Directory1.cmake:3 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + Directory1\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory2-stderr.txt b/Tests/RunCMake/ExternalData/Directory2-stderr.txt index 92c9a2f..ad6d814 100644 --- a/Tests/RunCMake/ExternalData/Directory2-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory2-stderr.txt @@ -6,5 +6,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): must list associated files. Call Stack \(most recent call first\): .* - Directory2.cmake:3 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + Directory2\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory3-stderr.txt b/Tests/RunCMake/ExternalData/Directory3-stderr.txt index ceed2a0..5538c38 100644 --- a/Tests/RunCMake/ExternalData/Directory3-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory3-stderr.txt @@ -10,6 +10,6 @@ CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): that does not exist as a file \(with or without an extension\)! Call Stack \(most recent call first\): .* - Directory3.cmake:3 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + Directory3\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/Directory4-stderr.txt b/Tests/RunCMake/ExternalData/Directory4-stderr.txt index dcb8522..ef88476 100644 --- a/Tests/RunCMake/ExternalData/Directory4-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory4-stderr.txt @@ -2,5 +2,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Series option ":" not allowed with directories. Call Stack \(most recent call first\): .* - Directory4.cmake:3 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + Directory4\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory5-stderr.txt b/Tests/RunCMake/ExternalData/Directory5-stderr.txt index 8e54aec..3fcde41 100644 --- a/Tests/RunCMake/ExternalData/Directory5-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory5-stderr.txt @@ -10,5 +10,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): that does not exist as a directory! Call Stack \(most recent call first\): .* - Directory5.cmake:3 \(ExternalData_Add_Test\) - CMakeLists.txt:3 \(include\) + Directory5\.cmake:[0-9]+ \(ExternalData_Add_Test\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/MissingData-stderr.txt b/Tests/RunCMake/ExternalData/MissingData-stderr.txt index 39ed2f1..b109976 100644 --- a/Tests/RunCMake/ExternalData/MissingData-stderr.txt +++ b/Tests/RunCMake/ExternalData/MissingData-stderr.txt @@ -10,6 +10,6 @@ CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): that does not exist as a file \(with or without an extension\)! Call Stack \(most recent call first\): .* - MissingData.cmake:4 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + MissingData\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt index 315af5e..426d86c 100644 --- a/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt +++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt @@ -10,6 +10,6 @@ CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): that does not exist as a file \(with or without an extension\)! Call Stack \(most recent call first\): .* - MissingDataWithAssociated.cmake:4 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + MissingDataWithAssociated\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt b/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt index 496ad8a..33cef07 100644 --- a/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt +++ b/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt @@ -2,5 +2,5 @@ CMake Warning at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): ExternalData_LINK_CONTENT cannot be used in-source Call Stack \(most recent call first\): .* - NoLinkInSource.cmake:8 \(ExternalData_Expand_Arguments\) - CMakeLists.txt:3 \(include\) + NoLinkInSource\.cmake:[0-9]+ \(ExternalData_Expand_Arguments\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt index ccbaf5a..45dfb94 100644 --- a/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt +++ b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt @@ -1,5 +1,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set! Call Stack \(most recent call first\): - NoURLTemplates.cmake:2 \(ExternalData_Add_Target\) - CMakeLists.txt:3 \(include\) + NoURLTemplates\.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt new file mode 100644 index 0000000..ff3e5c1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + error: ExternalProject module must be explicitly included before using + ExternalProject_Add function +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_parse_arguments\) + IncludeScope-Add.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake b/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake new file mode 100644 index 0000000..1061ffd --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake @@ -0,0 +1,12 @@ +function(IncludeScope_IncludeOnly) + include(ExternalProject) +endfunction() + +IncludeScope_IncludeOnly() + +ExternalProject_Add(MyProj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt new file mode 100644 index 0000000..cbad4be --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + error: ExternalProject module must be explicitly included before using + ExternalProject_Add_Step function +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_parse_arguments\) + IncludeScope-Add_Step.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake new file mode 100644 index 0000000..2a820f8 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake @@ -0,0 +1,13 @@ +function(IncludeScope_DefineProj) + include(ExternalProject) + ExternalProject_Add(MyProj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +endfunction() + +IncludeScope_DefineProj() + +ExternalProject_Add_Step(MyProj extraStep COMMENT "Foo") diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 09607f6..bf11381 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(IncludeScope-Add) +run_cmake(IncludeScope-Add_Step) run_cmake(NoOptions) run_cmake(SourceEmpty) run_cmake(SourceMissing) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index 1150568..24e7202 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -1,10 +1,12 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.12) project(FindPkgConfig_IMPORTED_TARGET C) find_package(PkgConfig REQUIRED) pkg_check_modules(NCURSES IMPORTED_TARGET QUIET ncurses) +message(STATUS "source: ${CMAKE_CURRENT_SOURCE_DIR} bin ${CMAKE_CURRENT_BINARY_DIR}") + if (NCURSES_FOUND) set(tgt PkgConfig::NCURSES) if (NOT TARGET ${tgt}) @@ -66,6 +68,16 @@ if (NOT TARGET PkgConfig::FakePackage1) message(FATAL_ERROR "No import target for fake package 1 with prefix path") endif() +# find targets in subdir and check their visibility +add_subdirectory(target_subdir) +if (TARGET PkgConfig::FakePackage1_dir) + message(FATAL_ERROR "imported target PkgConfig::FakePackage1_dir is visible outside it's directory") +endif() + +if (NOT TARGET PkgConfig::FakePackage1_global) + message(FATAL_ERROR "imported target PkgConfig::FakePackage1_global is not visible outside it's directory") +endif() + # And now do the same for the NO_CMAKE_ENVIRONMENT_PATH - ENV{CMAKE_PREFIX_PATH} # combination unset(CMAKE_PREFIX_PATH) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake new file mode 100644 index 0000000..2a505c6 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake @@ -0,0 +1,83 @@ +cmake_minimum_required(VERSION 3.12) + +project(FindPkgConfig_IMPORTED_TARGET C) + +find_package(PkgConfig REQUIRED) + +message(STATUS "source: ${CMAKE_CURRENT_SOURCE_DIR} bin ${CMAKE_CURRENT_BINARY_DIR}") + +# Setup for the remaining package tests below +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH) +set(fakePkgDir ${CMAKE_CURRENT_BINARY_DIR}/pc-fakepackage) +file(WRITE ${fakePkgDir}/lib/libcmakeinternalfakepackage.a "") +file(WRITE ${fakePkgDir}/lib/cmakeinternalfakepackage.lib "") +file(WRITE ${fakePkgDir}/lib/pkgconfig/cmakeinternalfakepackage.pc +"Name: CMakeInternalFakePackage +Description: Dummy package for FindPkgConfig VERSION_OPERATORS test +Version: 8.9 +Libs: -lcmakeinternalfakepackage +") + +# Always find the .pc file in the calls further below so that we can test that +# the import target find_library() calls handle the NO...PATH options correctly +set(ENV{PKG_CONFIG_PATH} ${fakePkgDir}/lib/pkgconfig) + +pkg_check_modules(FakePackageGE REQUIRED QUIET "cmakeinternalfakepackage >= 8") +if (NOT FakePackageGE_FOUND) + message(FATAL_ERROR "fake package >= 8 not found") +endif() + +pkg_check_modules(FakePackageGE_FAIL QUIET "cmakeinternalfakepackage >= 8.10") +if (FakePackageGE_FAIL_FOUND) + message(FATAL_ERROR "fake package >= 8.10 found") +endif() + +pkg_check_modules(FakePackageLE REQUIRED QUIET "cmakeinternalfakepackage<=9") +if (NOT FakePackageLE_FOUND) + message(FATAL_ERROR "fake package <= 9 not found") +endif() + +pkg_check_modules(FakePackageLE_FAIL QUIET "cmakeinternalfakepackage <= 8.1") +if (FakePackageLE_FAIL_FOUND) + message(FATAL_ERROR "fake package <= 8.1 found") +endif() + +pkg_check_modules(FakePackageGT REQUIRED QUIET "cmakeinternalfakepackage > 8") +if (NOT FakePackageGT_FOUND) + message(FATAL_ERROR "fake package > 8 not found") +endif() + +pkg_check_modules(FakePackageGT_FAIL QUIET "cmakeinternalfakepackage > 8.9") +if (FakePackageGT_FAIL_FOUND) + message(FATAL_ERROR "fake package > 8.9 found") +endif() + +pkg_check_modules(FakePackageLT REQUIRED QUIET "cmakeinternalfakepackage<9") +if (NOT FakePackageLT_FOUND) + message(FATAL_ERROR "fake package < 9 not found") +endif() + +pkg_check_modules(FakePackageLT_FAIL QUIET "cmakeinternalfakepackage < 8.9") +if (FakePackageLT_FAIL_FOUND) + message(FATAL_ERROR "fake package < 8.9 found") +endif() + +pkg_check_modules(FakePackageEQ REQUIRED QUIET "cmakeinternalfakepackage=8.9") +if (NOT FakePackageEQ_FOUND) + message(FATAL_ERROR "fake package = 8.9 not found") +endif() + +pkg_check_modules(FakePackageEQ_FAIL QUIET "cmakeinternalfakepackage = 8.8") +if (FakePackageEQ_FAIL_FOUND) + message(FATAL_ERROR "fake package = 8.8 found") +endif() + +pkg_check_modules(FakePackageEQ_INV QUIET "cmakeinternalfakepackage == 8.9") +if (FakePackageEQ_FAIL_FOUND) + message(FATAL_ERROR "fake package == 8.9 found") +endif() + +pkg_check_modules(FakePackageLLT_INV QUIET "cmakeinternalfakepackage <<= 9") +if (FakePackageLLT_FAIL_FOUND) + message(FATAL_ERROR "fake package <<= 9 found") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index e12b52f..671ff51 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -16,4 +16,5 @@ if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_GET_VARIABLE) run_cmake(FindPkgConfig_cache_variables) run_cmake(FindPkgConfig_IMPORTED_TARGET) + run_cmake(FindPkgConfig_VERSION_OPERATORS) endif () diff --git a/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt new file mode 100644 index 0000000..2171ef6 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt @@ -0,0 +1,5 @@ +# a target with visibility only in this directory +pkg_check_modules(FakePackage1_dir REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakepackage1) + +# the same with global visibility +pkg_check_modules(FakePackage1_global REQUIRED QUIET IMPORTED_TARGET GLOBAL cmakeinternalfakepackage1) diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake index b544ba6..e00af58 100644 --- a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if(SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$") +if(SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$") set(EXPECT_BSD 1) endif() diff --git a/Tests/RunCMake/LinkStatic/LinkOptionsLib.c b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake index 0d29492..d3a8afb 100644 --- a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake +++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake @@ -1,3 +1,30 @@ include(RunCMake) run_cmake(LINK_SEARCH_STATIC) + + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + # Intel compiler does not reject bad flags or objects! + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(STATIC_LIBRARY_OPTIONS) + + run_cmake_target(STATIC_LIBRARY_OPTIONS basic StaticLinkOptions) + run_cmake_target(STATIC_LIBRARY_OPTIONS genex StaticLinkOptions_genex --config Release) + run_cmake_target(STATIC_LIBRARY_OPTIONS shared SharedLinkOptions) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake new file mode 100644 index 0000000..858ce06 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG'.") +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake new file mode 100644 index 0000000..8c1e96e --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake @@ -0,0 +1,4 @@ + +if (actual_stdout MATCHES "BADFLAG") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected flag 'BADFLAG'.") +endif() diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake new file mode 100644 index 0000000..587af1d --- /dev/null +++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake @@ -0,0 +1,21 @@ + +enable_language(C) + +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_library(StaticLinkOptions STATIC LinkOptionsLib.c) +set_property(TARGET StaticLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj}) + +# static library with generator expression +add_library(StaticLinkOptions_genex STATIC LinkOptionsLib.c) +set_property(TARGET StaticLinkOptions_genex PROPERTY STATIC_LIBRARY_OPTIONS + $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> + "SHELL:" # produces no options + ) + +# shared library do not use property STATIC_LIBRARY_OPTIONS +add_library(SharedLinkOptions SHARED LinkOptionsLib.c) +set_property(TARGET SharedLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj}) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt new file mode 100644 index 0000000..9a606ee --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0058-OLD-by.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0058 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/Ninja/CMP0058-OLD-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt new file mode 100644 index 0000000..ba6e5da --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0058-OLD-no.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0058 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/Ninja/PreventTargetAliasesDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake new file mode 100644 index 0000000..da6f86a --- /dev/null +++ b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.12) +project(Test LANGUAGES C) + +# fake launcher executable +set(input_launcher_executable ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable "") + +# application and executable name +set(application_target "HelloApp") +set(application_name "Hello") +set(executable_name "Hello") + +# target built in "<root>/bin" +add_executable(${application_target} hello.c) +set_target_properties(${application_target} PROPERTIES + OUTPUT_NAME ${executable_name} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin + ) + +# configured launcher in "<root>" +set(configured_launcher_executable "${CMAKE_CURRENT_BINARY_DIR}/${application_name}") + +# create command to copy the launcher +add_custom_command( + DEPENDS + ${input_launcher_executable} + OUTPUT + ${configured_launcher_executable} + COMMAND + ${CMAKE_COMMAND} -E copy ${input_launcher_executable} ${configured_launcher_executable} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT + "Configuring application launcher: ${application_name}" + ) + +add_custom_target(Configure${application_name}Launcher ALL + DEPENDS + ${application_target} + ${input_launcher_executable} + ${configured_launcher_executable} + ) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index b6e6cd4..4b366a8 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -205,15 +205,16 @@ function(run_sub_cmake test ninja_output_path_prefix) set(cmd_prefix "") set(cmd_suffix "") endif() + set(fs_delay 3) # We assume the system as 1 sec timestamp resolution. file(WRITE "${top_build_ninja}" "\ subninja ${escaped_ninja_output_path_prefix}/build.ninja default ${escaped_ninja_output_path_prefix}/all -# Sleep for 1 second before to regenerate to make sure the timestamp of +# Sleep for long enough before regenerating to make sure the timestamp of # the top build.ninja will be strictly greater than the timestamp of the -# sub/build.ninja file. We assume the system as 1 sec timestamp resolution. +# sub/build.ninja file. rule RERUN - command = ${cmd_prefix}\"${escaped_CMAKE_COMMAND}\" -E sleep 1 && \"${escaped_CMAKE_COMMAND}\" -E touch \"${escaped_top_build_ninja}\"${cmd_suffix} + command = ${cmd_prefix}\"${escaped_CMAKE_COMMAND}\" -E sleep ${fs_delay} && \"${escaped_CMAKE_COMMAND}\" -E touch \"${escaped_top_build_ninja}\"${cmd_suffix} description = Testing regeneration generator = 1 @@ -239,7 +240,7 @@ build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_pa # Test regeneration rules run in order. set(main_cmakelists "${RunCMake_SOURCE_DIR}/CMakeLists.txt") - sleep(1) # Assume the system as 1 sec timestamp resolution. + sleep(${fs_delay}) touch("${main_cmakelists}") touch("${build_ninja_dep}") run_ninja("${top_build_dir}") @@ -278,3 +279,10 @@ foreach(ninja_output_path_prefix "sub space" "sub") run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}") run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}") endforeach(ninja_output_path_prefix) + +function (run_PreventTargetAliasesDupBuildRule) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventTargetAliasesDupBuildRule-build) + run_cmake(PreventTargetAliasesDupBuildRule) + run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) +endfunction () +run_PreventTargetAliasesDupBuildRule() diff --git a/Tests/RunCMake/RuntimePath/Relative.cmake b/Tests/RunCMake/RuntimePath/Relative.cmake new file mode 100644 index 0000000..203241f --- /dev/null +++ b/Tests/RunCMake/RuntimePath/Relative.cmake @@ -0,0 +1,69 @@ +enable_language(C) + +if(NOT CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN) + if(CMAKE_C_PLATFORM_ID STREQUAL "Linux") + # Sanity check for platform that is definitely known to support $ORIGIN. + message(FATAL_ERROR "Platform fails to report relative RPATH support") + else() + message(STATUS "Platform does not support relative RPATHs, skipping") + endif() + return() +endif() +set(CMAKE_BUILD_RPATH_USE_ORIGIN ON) + +function(CheckRpath target rpath) + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -Dfile=$<TARGET_FILE:${target}> -Drpath=${rpath} + -P "${CMAKE_CURRENT_SOURCE_DIR}/RelativeCheck.cmake" + VERBATIM + ) +endfunction() + +if(CMAKE_C_COMPILER_ID STREQUAL "XL" AND CMAKE_BINARY_DIR MATCHES " ") + # XL 16.1.0.0 fails building the library if the output path contains a space. + set(externDir) + message(STATUS "Skipping external library test because of a toolchain bug") +else() + get_filename_component(externDir "${CMAKE_BINARY_DIR}" DIRECTORY) + set(externDir "${externDir}/Relative-extern") +endif() + +add_library(utils SHARED A.c) +add_library(utils-sub SHARED A.c) +set_property(TARGET utils-sub PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libs) +if(externDir) + add_library(utils-extern SHARED A.c) + set_property(TARGET utils-extern PROPERTY LIBRARY_OUTPUT_DIRECTORY ${externDir}) +endif() + +add_executable(main main.c) +target_link_libraries(main utils) +CheckRpath(main "\$ORIGIN") + +add_executable(main-norel main.c) +target_link_libraries(main-norel utils) +set_property(TARGET main-norel PROPERTY BUILD_RPATH_USE_ORIGIN OFF) +CheckRpath(main-norel "${CMAKE_CURRENT_BINARY_DIR}") + +add_executable(mainsub main.c) +target_link_libraries(mainsub utils) +set_property(TARGET mainsub PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +CheckRpath(mainsub "\$ORIGIN/../") + +add_executable(main-sub main.c) +target_link_libraries(main-sub utils-sub) +CheckRpath(main-sub "\$ORIGIN/libs") + +add_executable(mainsub-sub main.c) +target_link_libraries(mainsub-sub utils-sub) +set_property(TARGET mainsub-sub PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +CheckRpath(mainsub-sub "\$ORIGIN/../libs") + +if(externDir) + # Binaries linking to libraries outside the build tree should have an absolute RPATH. + add_executable(main-extern main.c) + target_link_libraries(main-extern utils-extern) + CheckRpath(main-extern "${externDir}") +endif() diff --git a/Tests/RunCMake/RuntimePath/RelativeCheck.cmake b/Tests/RunCMake/RuntimePath/RelativeCheck.cmake new file mode 100644 index 0000000..9ee403f --- /dev/null +++ b/Tests/RunCMake/RuntimePath/RelativeCheck.cmake @@ -0,0 +1,4 @@ +file(RPATH_CHECK FILE "${file}" RPATH "${rpath}") +if(NOT EXISTS "${file}") + message(FATAL_ERROR "RPATH for ${file} did not contain the expected value") +endif() diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake index 3f238f2..6f1baa1 100644 --- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake +++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake @@ -16,3 +16,17 @@ function(run_SymlinkImplicit) ${CMAKE_COMMAND} -Ddir=${RunCMake_TEST_BINARY_DIR} -P ${RunCMake_SOURCE_DIR}/SymlinkImplicitCheck.cmake) endfunction() run_SymlinkImplicit() + +function(run_Relative) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Relative-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(Relative) + run_cmake_command(Relative-build ${CMAKE_COMMAND} --build . --config Debug) +endfunction() +run_Relative() diff --git a/Tests/RunCMake/RuntimePath/main.c b/Tests/RunCMake/RuntimePath/main.c index 8488f4e..181cd09 100644 --- a/Tests/RunCMake/RuntimePath/main.c +++ b/Tests/RunCMake/RuntimePath/main.c @@ -1,4 +1,6 @@ +extern int libA(void); + int main(void) { - return 0; + return libA(); } diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt new file mode 100644 index 0000000..7f248ae --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt @@ -0,0 +1,2 @@ +^-->value<-- +-->value<--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake new file mode 100644 index 0000000..b81fd56 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0053 NEW) + +set($ value) +set(dollar $) +message("-->${${dollar}}<--") +message("-->${$}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt new file mode 100644 index 0000000..aecd4d3 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt @@ -0,0 +1,24 @@ +^CMake Deprecation Warning at CMP0053-Dollar-OLD.cmake:1 \(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. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +-->value<-- +CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\): + Syntax error in cmake code at + + .*CMP0053-Dollar-OLD.cmake:6 + + when parsing string + + -->\${\$}<-- + + syntax error, unexpected \$, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake new file mode 100644 index 0000000..647f464 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0053 OLD) + +set($ value) +set(dollar $) +message("-->${${dollar}}<--") +message("-->${$}<--") diff --git a/Tests/RunCMake/Syntax/QueryCache-stderr.txt b/Tests/RunCMake/Syntax/QueryCache-stderr.txt new file mode 100644 index 0000000..db6b2b7 --- /dev/null +++ b/Tests/RunCMake/Syntax/QueryCache-stderr.txt @@ -0,0 +1,2 @@ +-->cache value<-- +-->local value<-- diff --git a/Tests/RunCMake/Syntax/QueryCache.cmake b/Tests/RunCMake/Syntax/QueryCache.cmake new file mode 100644 index 0000000..20c648e --- /dev/null +++ b/Tests/RunCMake/Syntax/QueryCache.cmake @@ -0,0 +1,6 @@ + +set(query_var "cache value" CACHE STRING "") +set(query_var "local value") + +message("-->$CACHE{query_var}<--") +message("-->${query_var}<--") diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index b8f5fd0..8d74dc1 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -111,6 +111,11 @@ run_cmake(CMP0053-NameWithNewlineQuoted) run_cmake(CMP0053-NameWithCarriageReturnQuoted) run_cmake(CMP0053-NameWithEscapedSpacesQuoted) run_cmake(CMP0053-NameWithEscapedTabsQuoted) +run_cmake(CMP0053-Dollar-OLD) +run_cmake(CMP0053-Dollar-NEW) + +# Variable special types +run_cmake(QueryCache) # Function and macro tests. run_cmake(FunctionUnmatched) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 5af6fcd..2441a9c 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -24,6 +24,8 @@ \* CMP0068 \* CMP0069 \* CMP0073 + \* CMP0076 + \* CMP0081 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt index 6e89104..fec12ae 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt @@ -1,47 +1,47 @@ -^(CMake Error at BadInvalidName1/CMakeLists.txt:2 \(include_directories\): +^(CMake Error at BadInvalidName1/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:Invali/dTarget,INCLUDE_DIRECTORIES> Target name not supported. -+)+(CMake Error at BadInvalidName2/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName2/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:Invali/dTarget,Invali/dProperty> Target name and property name not supported. -+)+(CMake Error at BadInvalidName3/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName3/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:Invali/dProperty> Property name not supported. -+)+(CMake Error at BadInvalidName4/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName4/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:BadInvalidName4,Invali/dProperty> Property name not supported. -+)+(CMake Error at BadInvalidName5/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName5/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:,> \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name and property name. -+)+(CMake Error at BadInvalidName6/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName6/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:,ValidProperty> \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name. -+)+(CMake Error at BadInvalidName7/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName7/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:BadInvalidName7,> \$<TARGET_PROPERTY:...> expression requires a non-empty property name. -+)+(CMake Error at BadInvalidName8/CMakeLists.txt:2 \(include_directories\): ++)+(CMake Error at BadInvalidName8/CMakeLists\.txt:[0-9]+ \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:> diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt index 3adf73e..75865ad 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt @@ -5,4 +5,4 @@ CMake Error at BadNonTarget.cmake:7 \(include_directories\): Target "NonExistent" not found. Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt index 7e002f5..8bff68e 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt @@ -7,4 +7,4 @@ CMake Error at LinkImplementationCycle1.cmake:5 \(target_link_libraries\): target property which is transitive over the link libraries, creating a recursion. Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt index 2f72de6..044b77c 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt @@ -7,4 +7,4 @@ CMake Error at LinkImplementationCycle2.cmake:5 \(target_link_libraries\): target property which is transitive over the link libraries, creating a recursion. Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt index d47dd4d..d47dd4d 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt +++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake new file mode 100644 index 0000000..4d8c268 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake @@ -0,0 +1,10 @@ +cmake_policy(SET CMP0076 OLD) + +add_library(iface INTERFACE) +target_sources(iface INTERFACE empty_1.cpp) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt new file mode 100644 index 0000000..bd888ee --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt @@ -0,0 +1,21 @@ +CMake Warning \(dev\) at CMP0076-WARN/CMakeLists\.txt:[0-9]+ \(target_sources\): + Policy CMP0076 is not set: target_sources\(\) command converts relative paths + to absolute. Run "cmake --help-policy CMP0076" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + An interface source of target "publiclib" has a relative path. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMP0076-WARN/CMakeLists\.txt:[0-9]+ \(target_sources\): + Policy CMP0076 is not set: target_sources\(\) command converts relative paths + to absolute. Run "cmake --help-policy CMP0076" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + A private source from a directory other than that of target "publiclib" has + a relative path. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error in CMakeLists.txt: + Target "publiclib" contains relative path in its INTERFACE_SOURCES: + + "CMP0076-WARN/subdir_empty_1.cpp" diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake new file mode 100644 index 0000000..2e07331 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) + +add_library(publiclib) + +add_subdirectory(CMP0076-WARN) + +add_executable(main main.cpp) +target_link_libraries(main publiclib) diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt new file mode 100644 index 0000000..f9c7d6d --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(publiclib INTERFACE CMP0076-WARN/subdir_empty_1.cpp + PRIVATE empty_1.cpp) diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt index 11bc96c..a40f463 100644 --- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt +++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt @@ -4,7 +4,7 @@ CMake Debug Log at OriginDebug.cmake:13 \(add_library\): \* .*Tests/RunCMake/TargetSources/empty_2.cpp Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) .* CMake Debug Log at OriginDebug.cmake:16 \(set_property\): Used sources for target OriginDebug: @@ -12,7 +12,7 @@ CMake Debug Log at OriginDebug.cmake:16 \(set_property\): \* .*Tests/RunCMake/TargetSources/empty_3.cpp Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) .* CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): Used sources for target OriginDebug: @@ -20,7 +20,7 @@ CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): \* .*Tests/RunCMake/TargetSources/empty_4.cpp Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) .* CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): Used sources for target OriginDebug: @@ -28,4 +28,4 @@ CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): \* .*Tests/RunCMake/TargetSources/empty_1.cpp Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt new file mode 100644 index 0000000..4581d8a --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/TargetSources/empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake index 8bb6149..0d3e9a4 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake +++ b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake @@ -1,6 +1,10 @@ +cmake_policy(SET CMP0076 NEW) add_library(iface INTERFACE) target_sources(iface INTERFACE empty_1.cpp) +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + add_executable(main main.cpp) target_link_libraries(main iface) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt new file mode 100644 index 0000000..7f48082 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt @@ -0,0 +1 @@ +-- genexlib: \$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp> diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake new file mode 100644 index 0000000..1cdc2a7 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake @@ -0,0 +1,10 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(genexlib) +add_subdirectory(RelativePathInSubdirGenEx) + +get_property(genexlib_sources TARGET genexlib PROPERTY SOURCES) +message(STATUS "genexlib: ${genexlib_sources}") + +add_executable(genexmain main.cpp) +target_link_libraries(genexmain genexlib) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt new file mode 100644 index 0000000..3bcf454 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt @@ -0,0 +1,4 @@ + +target_sources(genexlib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp> + $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp> + PRIVATE $<1:empty_2.cpp>) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt new file mode 100644 index 0000000..aa4851f --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake new file mode 100644 index 0000000..4acbeca --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(privatelib) + +include("RelativePathInSubdirInclude/CMakeLists.txt") + +get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES) +message(STATUS "privatelib: ${privatelib_sources}") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt new file mode 100644 index 0000000..3dcb135 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(privatelib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp" + empty_1.cpp) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt new file mode 100644 index 0000000..5990a05 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake new file mode 100644 index 0000000..3652b4f --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(iface INTERFACE) + +add_subdirectory(RelativePathInSubdirInterface) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt new file mode 100644 index 0000000..02e6966 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(iface INTERFACE subdir_empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp" + ../empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt new file mode 100644 index 0000000..fa5bcbf --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake new file mode 100644 index 0000000..d0d3dc4 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(privatelib) + +add_subdirectory(RelativePathInSubdirPrivate) + +get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES) +message(STATUS "privatelib: ${privatelib_sources}") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt new file mode 100644 index 0000000..56ee853 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(privatelib PRIVATE subdir_empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp" + ../empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 36d01de..bee8c4e 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -6,5 +6,11 @@ endif() run_cmake(OriginDebug) run_cmake(CMP0026-LOCATION) +run_cmake(CMP0076-OLD) +run_cmake(CMP0076-WARN) run_cmake(RelativePathInInterface) +run_cmake(RelativePathInSubdirGenEx) +run_cmake(RelativePathInSubdirInterface) +run_cmake(RelativePathInSubdirPrivate) +run_cmake(RelativePathInSubdirInclude) run_cmake(ExportBuild) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt new file mode 100644 index 0000000..d4fa6e4 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt @@ -0,0 +1,2 @@ +-- PREFIX='_' +-- TARGET NAME='example' diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake new file mode 100644 index 0000000..ce77218 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0078 NEW) +include(CMP0078-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt new file mode 100644 index 0000000..62f5371 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt @@ -0,0 +1,2 @@ +-- PREFIX='' +-- TARGET NAME='_example' diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake new file mode 100644 index 0000000..2c4d142 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0078 OLD) +include(CMP0078-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt new file mode 100644 index 0000000..f0ed577 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(message\): + Policy CMP0078 is not set: UseSWIG generates standard target names\. Run + "cmake --help-policy CMP0078" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMP0078-common\.cmake:6 \(swig_add_library\) + CMP0078-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/UseSWIG/CMP0078-WARN-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt new file mode 100644 index 0000000..62f5371 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt @@ -0,0 +1,2 @@ +-- PREFIX='' +-- TARGET NAME='_example' diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake new file mode 100644 index 0000000..86b21a5 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake @@ -0,0 +1 @@ +include(CMP0078-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-common.cmake b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake new file mode 100644 index 0000000..6cf39dc --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake @@ -0,0 +1,10 @@ + +set(SWIG_EXECUTABLE "swig") +set(SWIG_DIR "/swig") +include(UseSWIG) + +swig_add_library(example LANGUAGE python TYPE MODULE SOURCES example.i) + +get_property(prefix TARGET ${SWIG_MODULE_example_REAL_NAME} PROPERTY PREFIX) +message(STATUS "PREFIX='${prefix}'") +message(STATUS "TARGET NAME='${SWIG_MODULE_example_REAL_NAME}'") diff --git a/Tests/RunCMake/UseSWIG/CMakeLists.txt b/Tests/RunCMake/UseSWIG/CMakeLists.txt new file mode 100644 index 0000000..d1b0d2c --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake new file mode 100644 index 0000000..b96622a --- /dev/null +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0078-WARN) +run_cmake(CMP0078-OLD) +run_cmake(CMP0078-NEW) diff --git a/Tests/RunCMake/UseSWIG/example.i b/Tests/RunCMake/UseSWIG/example.i new file mode 100644 index 0000000..86625aa --- /dev/null +++ b/Tests/RunCMake/UseSWIG/example.i @@ -0,0 +1,2 @@ +/* File : example.i */ +%module example diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 0d178ce..4bfb2f2 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -7,7 +7,10 @@ run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) run_cmake(VsDebuggerCommand) +run_cmake(VsDebuggerCommandArguments) +run_cmake(VsDebuggerEnvironment) run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) run_cmake(VsSdkDirectories) +run_cmake(VsGlobals) diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake index 0ded780..440f9f2 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -9,7 +9,7 @@ set(debuggerCommandSet FALSE) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo") message(STATUS "foo.vcxproj has debugger command set") set(debuggerCommandSet TRUE) endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake index e29adc4..5dcb6d1 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(foo foo.cpp) set_target_properties(foo PROPERTIES - VS_DEBUGGER_COMMAND "my-debugger-command") + VS_DEBUGGER_COMMAND "my-debugger-command $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake new file mode 100644 index 0000000..b2e0a43 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake @@ -0,0 +1,22 @@ +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(debuggerCommandArgumentsSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerCommandArguments[^>]*>([^<>]+)</LocalDebuggerCommandArguments>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo") + message(STATUS "foo.vcxproj has debugger command arguments set") + set(debuggerCommandArgumentsSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerCommandArgumentsSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake new file mode 100644 index 0000000..aa87cdc --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_COMMAND_ARGUMENTS "my-debugger-command-arguments $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake new file mode 100644 index 0000000..2427ad4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake @@ -0,0 +1,22 @@ +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(debuggerEnvironmentSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerEnvironment[^>]*>([^<>]+)</LocalDebuggerEnvironment>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo") + message(STATUS "foo.vcxproj has debugger environment set") + set(debuggerEnvironmentSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerEnvironmentSet) + set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake new file mode 100644 index 0000000..d5bec4c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_ENVIRONMENT "my-debugger-environment $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake index 637c68c..6a142f8 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake @@ -9,7 +9,7 @@ set(debuggerWorkDirSet FALSE) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "^ *<LocalDebuggerWorkingDirectory[^>]*>([^<>]+)</LocalDebuggerWorkingDirectory>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo") message(STATUS "foo.vcxproj has debugger working dir set") set(debuggerWorkDirSet TRUE) endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake index a277c65..36daed0 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(foo foo.cpp) set_target_properties(foo PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory") + VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake new file mode 100644 index 0000000..0e7fd45 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake @@ -0,0 +1,44 @@ +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(InsideGlobals FALSE) +set(DefaultLanguageSet FALSE) +set(MinimumVisualStudioVersionSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$") + set(InsideGlobals TRUE) + elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$") + if("${CMAKE_MATCH_1}" STREQUAL "en-US") + if(InsideGlobals) + message(STATUS "foo.vcxproj has correct DefaultLanguage global property") + set(DefaultLanguageSet TRUE) + else() + message(STATUS "DefaultLanguage is set but not within \"Globals\" property group") + endif() + endif() + elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$") + if("${CMAKE_MATCH_1}" STREQUAL "14.0") + if(InsideGlobals) + message(STATUS "foo.vcxproj has correct MinimumVisualStudioVersion global property") + set(MinimumVisualStudioVersionSet TRUE) + else() + message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group") + endif() + endif() + endif() +endforeach() + +if(NOT DefaultLanguageSet) + set(RunCMake_TEST_FAILED "DefaultLanguageSet not found or not set correctly.") + return() +endif() + +if(NOT MinimumVisualStudioVersionSet) + set(RunCMake_TEST_FAILED "MinimumVisualStudioVersionSet not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsGlobals.cmake b/Tests/RunCMake/VS10Project/VsGlobals.cmake new file mode 100644 index 0000000..a3ed5af --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsGlobals.cmake @@ -0,0 +1,8 @@ +enable_language(CXX) + +set(CMAKE_VS_GLOBALS + "DefaultLanguage=en-US" + "MinimumVisualStudioVersion=14.0" +) + +add_library(foo foo.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt new file mode 100644 index 0000000..34ac57d --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0063-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0063 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/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 1150666..fb04005 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -219,6 +219,7 @@ endfunction() if(NOT XCODE_VERSION VERSION_LESS 7) XcodeSchemaGeneration() + run_cmake(XcodeSchemaProperty) endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake new file mode 100644 index 0000000..f675d81 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -0,0 +1,33 @@ +function(check_property property matcher) + set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme") + file(STRINGS ${schema} actual-${property} + REGEX "${matcher}" LIMIT_COUNT 1) + if(NOT actual-${property}) + message(SEND_ERROR "Xcode schema property ${property}: Could not find ${matcher} in schema ${schema}") + endif() +endfunction() + +check_property("ADDRESS_SANITIZER" "enableAddressSanitizer") +check_property("ADDRESS_SANITIZER_USE_AFTER_RETURN" "enableASanStackUseAfterReturn") +check_property("THREAD_SANITIZER" "enableThreadSanitizer") +check_property("THREAD_SANITIZER_STOP" "stopOnEveryThreadSanitizerIssue") +check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer") +check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue") +check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker") +check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue") + +check_property("MALLOC_SCRIBBLE" "MallocScribble") +check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges") +check_property("GUARD_MALLOC" "DYLD_INSERT_LIBRARIES") +check_property("ZOMBIE_OBJECTS" "NSZombieEnabled") +check_property("MALLOC_STACK" "MallocStackLogging") +check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS") +check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES") + +check_property("EXECUTABLE" "myExecutable") +check_property("ARGUMENTS" [=["--foo"]=]) +check_property("ARGUMENTS" [=["--bar=baz"]=]) +check_property("ENVIRONMENT" [=[key="FOO"]=]) +check_property("ENVIRONMENT" [=[value="foo"]=]) +check_property("ENVIRONMENT" [=[key="BAR"]=]) +check_property("ENVIRONMENT" [=[value="bar"]=]) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake new file mode 100644 index 0000000..2b72a64 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.7) + +set(CMAKE_XCODE_GENERATE_SCHEME ON) + +project(XcodeSchemaProperty CXX) + +function(create_scheme_for_variable variable) + set(CMAKE_XCODE_SCHEME_${variable} ON) + add_executable(${variable} main.cpp) +endfunction() + +create_scheme_for_variable(ADDRESS_SANITIZER) +create_scheme_for_variable(ADDRESS_SANITIZER_USE_AFTER_RETURN) +create_scheme_for_variable(THREAD_SANITIZER) +create_scheme_for_variable(THREAD_SANITIZER_STOP) +create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER) +create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER_STOP) +create_scheme_for_variable(DISABLE_MAIN_THREAD_CHECKER) +create_scheme_for_variable(MAIN_THREAD_CHECKER_STOP) + +create_scheme_for_variable(MALLOC_SCRIBBLE) +create_scheme_for_variable(MALLOC_GUARD_EDGES) +create_scheme_for_variable(GUARD_MALLOC) +create_scheme_for_variable(ZOMBIE_OBJECTS) +create_scheme_for_variable(MALLOC_STACK) +create_scheme_for_variable(DYNAMIC_LINKER_API_USAGE) +create_scheme_for_variable(DYNAMIC_LIBRARY_LOADS) + +function(create_scheme_for_property property value) + set(XCODE_SCHEME_${property} ON) + add_executable(${property} main.cpp) + set_target_properties(${property} PROPERTIES XCODE_SCHEME_${property} "${value}") +endfunction() + +create_scheme_for_property(EXECUTABLE myExecutable) +create_scheme_for_property(ARGUMENTS "--foo;--bar=baz") +create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar") diff --git a/Tests/RunCMake/add_link_options/CMakeLists.txt b/Tests/RunCMake/add_link_options/CMakeLists.txt new file mode 100644 index 0000000..14ef56e --- /dev/null +++ b/Tests/RunCMake/add_link_options/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.11) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake new file mode 100644 index 0000000..7316ef5 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake @@ -0,0 +1,4 @@ + +set (LINKER_OPTION "LINKER:SHELL:-foo bar") + +include ("LINKER_expansion-list.cmake") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake new file mode 100644 index 0000000..34dcc67 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake @@ -0,0 +1,36 @@ + +enable_language(C) + +add_executable(dump dump.c) + +add_link_options("${LINKER_OPTION}") + +# ensure no temp file will be used +string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") +string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") + +add_library(example SHARED LinkOptionsLib.c) +# use LAUNCH facility to dump linker command +set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") + +add_dependencies (example dump) + +# generate reference for LINKER flag +if (CMAKE_C_LINKER_WRAPPER_FLAG) + set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG}) + list(GET linker_flag -1 linker_space) + if (linker_space STREQUAL " ") + list(REMOVE_AT linker_flag -1) + else() + set(linker_space) + endif() + list (JOIN linker_flag " " linker_flag) + if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP) + string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar") + else() + set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar") + endif() +else() + set(linker_flag "-foo bar") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake new file mode 100644 index 0000000..bebd6c7 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake @@ -0,0 +1,15 @@ + +if (actual_stdout MATCHES "(LINKER|SHELL):") + set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.") + return() +endif() + +if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt") + set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.") + return() +endif() +file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag) + +if (NOT actual_stdout MATCHES "${linker_flag}") + set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake new file mode 100644 index 0000000..42b286d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake @@ -0,0 +1,4 @@ + +set (LINKER_OPTION "LINKER:-foo,bar") + +include ("LINKER_expansion-list.cmake") diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake new file mode 100644 index 0000000..4a22d7e --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_EXECUTABLE_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_EXECUTABLE_RELEASE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_(SHARED|MODULE)_RELEASE") + set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|MODULE)_RELEASE'.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake new file mode 100644 index 0000000..d695761 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_MODULE_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_MODULE_RELEASE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_(SHARED|EXECUTABLE)_RELEASE") + set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|EXECUTABLE)_RELEASE'.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake new file mode 100644 index 0000000..eaac8e3 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_SHARED_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_SHARED_RELEASE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_(MODULE|EXECUTABLE)_RELEASE") + set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(MODULE|EXECUTABLE)_RELEASE'.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake new file mode 100644 index 0000000..802ff4f --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake @@ -0,0 +1,17 @@ + +enable_language(C) + +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_SHARED_RELEASE${obj}>) +add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_MODULE_RELEASE${obj}>) +add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>,$<CONFIG:Release>>:${pre}BADFLAG_EXECUTABLE_RELEASE${obj}>) + +add_library(LinkOptions_shared SHARED LinkOptionsLib.c) + +add_library(LinkOptions_mod MODULE LinkOptionsLib.c) + +add_executable(LinkOptions_exe LinkOptionsExe.c) diff --git a/Tests/RunCMake/add_link_options/LinkOptionsExe.c b/Tests/RunCMake/add_link_options/LinkOptionsExe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/add_link_options/LinkOptionsExe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/add_link_options/LinkOptionsLib.c b/Tests/RunCMake/add_link_options/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/RunCMake/add_link_options/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/RunCMake/add_link_options/RunCMakeTest.cmake b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake new file mode 100644 index 0000000..4f5df72 --- /dev/null +++ b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake @@ -0,0 +1,38 @@ + +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + # Intel compiler does not reject bad flags or objects! + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(LINK_OPTIONS) + + run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) + run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) + run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) +endif() + +run_cmake(bad_SHELL_usage) + +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(LINKER_expansion) + run_cmake_target(LINKER_expansion build all) + + run_cmake(LINKER_SHELL_expansion) + run_cmake_target(LINKER_SHELL_expansion build all) +endif() diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt new file mode 100644 index 0000000..02d09f3 --- /dev/null +++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at bad_SHELL_usage.cmake:6 \(add_library\): + 'SHELL:' prefix is not supported as part of 'LINKER:' arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:5 \(include\) diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake new file mode 100644 index 0000000..324893d --- /dev/null +++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake @@ -0,0 +1,6 @@ + +enable_language(C) + +add_link_options("LINKER:-foo,SHELL:-bar") + +add_library(example SHARED LinkOptionsLib.c) diff --git a/Tests/RunCMake/add_link_options/dump.c b/Tests/RunCMake/add_link_options/dump.c new file mode 100644 index 0000000..8baa313 --- /dev/null +++ b/Tests/RunCMake/add_link_options/dump.c @@ -0,0 +1,13 @@ + +#include "stdio.h" + +int main(int argc, char* argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + printf("%s ", argv[i]); + printf("\n"); + + return 0; +} diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt new file mode 100644 index 0000000..1bd7f49 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt @@ -0,0 +1 @@ +install(CODE "message(STATUS \"exclude\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt new file mode 100644 index 0000000..7d76ed9 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt @@ -0,0 +1,4 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- sub +-- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt new file mode 100644 index 0000000..35b0bb5 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- sub +-- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake new file mode 100644 index 0000000..56c1b81 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake @@ -0,0 +1,3 @@ +add_subdirectory(CMP0082) +add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL) +install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-Nested/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-Nested/CMakeLists.txt new file mode 100644 index 0000000..8f26c24 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-Nested/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(sub) diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-Nested/sub/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-Nested/sub/CMakeLists.txt new file mode 100644 index 0000000..91a8936 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-Nested/sub/CMakeLists.txt @@ -0,0 +1 @@ +install(CODE "message(STATUS \"sub\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NestedSub/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NestedSub/CMakeLists.txt new file mode 100644 index 0000000..52a0665 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NestedSub/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(sub) +install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NestedSub/sub/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NestedSub/sub/CMakeLists.txt new file mode 100644 index 0000000..91a8936 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NestedSub/sub/CMakeLists.txt @@ -0,0 +1 @@ +install(CODE "message(STATUS \"sub\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-None/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-None/CMakeLists.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-None/CMakeLists.txt diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt new file mode 100644 index 0000000..4b39789 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt @@ -0,0 +1,4 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt new file mode 100644 index 0000000..8f3a5f7 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake new file mode 100644 index 0000000..56c1b81 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake @@ -0,0 +1,3 @@ +add_subdirectory(CMP0082) +add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL) +install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt new file mode 100644 index 0000000..4b39789 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt @@ -0,0 +1,4 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt new file mode 100644 index 0000000..8f3a5f7 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-stderr.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-stderr.txt new file mode 100644 index 0000000..3624c43 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0082 is not set: Install rules from add_subdirectory\(\) are + interleaved with those in caller\. Run "cmake --help-policy CMP0082" for + policy details\. Use the cmake_policy command to set the policy and + suppress this warning\. + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested.cmake new file mode 100644 index 0000000..df5688a --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested.cmake @@ -0,0 +1,2 @@ +add_subdirectory(CMP0082-Nested) +install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt new file mode 100644 index 0000000..4b39789 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt @@ -0,0 +1,4 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt new file mode 100644 index 0000000..8f3a5f7 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-stderr.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-stderr.txt new file mode 100644 index 0000000..9362905 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) in CMP0082-NestedSub/CMakeLists\.txt: + Policy CMP0082 is not set: Install rules from add_subdirectory\(\) are + interleaved with those in caller\. Run "cmake --help-policy CMP0082" for + policy details\. Use the cmake_policy command to set the policy and + suppress this warning\. + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub.cmake new file mode 100644 index 0000000..88a0856 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub.cmake @@ -0,0 +1 @@ +add_subdirectory(CMP0082-NestedSub) diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt new file mode 100644 index 0000000..f7a331d --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt new file mode 100644 index 0000000..6f22ae2 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt @@ -0,0 +1,2 @@ +^-- Install configuration: "[^\n]*" +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall.cmake new file mode 100644 index 0000000..70bc9ed --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall.cmake @@ -0,0 +1 @@ +add_subdirectory(CMP0082) diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt new file mode 100644 index 0000000..157ab37 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt new file mode 100644 index 0000000..9e15872 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt @@ -0,0 +1,2 @@ +^-- Install configuration: "[^\n]*" +-- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None.cmake new file mode 100644 index 0000000..670f89b --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None.cmake @@ -0,0 +1,2 @@ +add_subdirectory(CMP0082-None) +install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt new file mode 100644 index 0000000..4b39789 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt @@ -0,0 +1,4 @@ +^-- Install configuration: "[^\n]*" +-- Install component: "Unspecified" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt new file mode 100644 index 0000000..8f3a5f7 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt @@ -0,0 +1,3 @@ +^-- Install configuration: "[^\n]*" +-- top +-- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-stderr.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-stderr.txt new file mode 100644 index 0000000..3624c43 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0082 is not set: Install rules from add_subdirectory\(\) are + interleaved with those in caller\. Run "cmake --help-policy CMP0082" for + policy details\. Use the cmake_policy command to set the policy and + suppress this warning\. + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake new file mode 100644 index 0000000..56c1b81 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake @@ -0,0 +1,3 @@ +add_subdirectory(CMP0082) +add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL) +install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082/CMakeLists.txt new file mode 100644 index 0000000..91a8936 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082/CMakeLists.txt @@ -0,0 +1 @@ +install(CODE "message(STATUS \"sub\")") diff --git a/Tests/RunCMake/add_subdirectory/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMakeLists.txt index 18dfd26..47d249c 100644 --- a/Tests/RunCMake/add_subdirectory/CMakeLists.txt +++ b/Tests/RunCMake/add_subdirectory/CMakeLists.txt @@ -1,3 +1,10 @@ cmake_minimum_required(VERSION 3.2) + +# Have to set policy here due to policy scope +if(DEFINED CMP0082_VALUE) + cmake_policy(SET CMP0082 "${CMP0082_VALUE}") +endif() +set(CMAKE_POLICY_WARNING_CMP0082 ON) + project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt b/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt index 369a956..0130581 100644 --- a/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt +++ b/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt @@ -2,4 +2,4 @@ add_subdirectory given source "DoesNotExist" which is not an existing directory. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_subdirectory/Missing-stderr.txt b/Tests/RunCMake/add_subdirectory/Missing-stderr.txt index aba0675..dd83140 100644 --- a/Tests/RunCMake/add_subdirectory/Missing-stderr.txt +++ b/Tests/RunCMake/add_subdirectory/Missing-stderr.txt @@ -5,4 +5,4 @@ does not contain a CMakeLists.txt file. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake index 88b9283..343e65b 100644 --- a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake @@ -4,6 +4,28 @@ run_cmake(DoesNotExist) run_cmake(Missing) run_cmake(Function) +macro(run_cmake_install case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS ${ARGN}) + + run_cmake(${case}) + run_cmake_command(${case}-install ${CMAKE_COMMAND} -P cmake_install.cmake) + run_cmake_command(${case}-install-component ${CMAKE_COMMAND} -DCOMPONENT=Unspecified -P cmake_install.cmake) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endmacro() + +run_cmake_install(CMP0082-WARN) +run_cmake_install(CMP0082-WARN-Nested) +run_cmake_install(CMP0082-WARN-NestedSub) +run_cmake_install(CMP0082-WARN-None) +run_cmake_install(CMP0082-WARN-NoTopInstall) +run_cmake_install(CMP0082-OLD -DCMP0082_VALUE=OLD) +run_cmake_install(CMP0082-NEW -DCMP0082_VALUE=NEW) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt index 28e0e72..1938da3 100644 --- a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt +++ b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt @@ -1,4 +1,15 @@ -^[^ +^CMake Deprecation Warning at CMP0061-OLD-make.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0061 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\) ++ +[^ ]+ --build \. --config "Release" -- -i [^ ]+ --build \. --config "Release" --target "MyTarget" -- -i diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt index 1dde843..85bbdf1 100644 --- a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt +++ b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt @@ -1,4 +1,15 @@ -^[^ +^CMake Deprecation Warning at CMP0061-OLD-other.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0061 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\) ++ +[^ ]+ --build \. --config "Release" [^ ]+ --build \. --config "Release" --target "MyTarget" diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt index b57e2de..b57e2de 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt +++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt new file mode 100644 index 0000000..a8f10b5 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt @@ -0,0 +1 @@ + *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt new file mode 100644 index 0000000..11a4edf --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt @@ -0,0 +1 @@ +Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___Configure.xml&build=test-build-name&site=test-site&stamp=.*-Experimental&subproject=mysubproj&MD5=.* Size: .* diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt index b57e2de..b57e2de 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt +++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt new file mode 100644 index 0000000..a8f10b5 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt @@ -0,0 +1 @@ + *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt new file mode 100644 index 0000000..929b254 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt @@ -0,0 +1 @@ +Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___RunCMakeTest.cmake&MD5=.* Size: .* diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_submit/PARTSDone-result.txt index b57e2de..b57e2de 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt +++ b/Tests/RunCMake/ctest_submit/PARTSDone-result.txt diff --git a/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt b/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt new file mode 100644 index 0000000..0020a0f --- /dev/null +++ b/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt @@ -0,0 +1,3 @@ + *Error when uploading file: .*/Done.xml + *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) + *Problems when submitting via HTTP diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake index ed0e666..178f0cb 100644 --- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake @@ -24,12 +24,15 @@ run_ctest_submit(BadFILES FILES bad-file) run_ctest_submit(RepeatRETURN_VALUE RETURN_VALUE res RETURN_VALUE res) run_ctest_submit(PARTSCDashUpload PARTS Configure CDASH_UPLOAD) run_ctest_submit(PARTSCDashUploadType PARTS Configure CDASH_UPLOAD_TYPE) +run_ctest_submit(PARTSDone PARTS Done) run_ctest_submit(CDashUploadPARTS CDASH_UPLOAD bad-upload PARTS) run_ctest_submit(CDashUploadFILES CDASH_UPLOAD bad-upload FILES) run_ctest_submit(CDashUploadNone CDASH_UPLOAD) run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload) run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM) run_ctest_submit(CDashSubmitQuiet QUIET) +run_ctest_submit_debug(CDashSubmitVerbose) +run_ctest_submit_debug(FILESNoBuildId FILES ${CMAKE_CURRENT_LIST_FILE}) run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf") run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf") diff --git a/Tests/RunCMake/ctest_submit/test.cmake.in b/Tests/RunCMake/ctest_submit/test.cmake.in index ba826f1..35cd16a 100644 --- a/Tests/RunCMake/ctest_submit/test.cmake.in +++ b/Tests/RunCMake/ctest_submit/test.cmake.in @@ -9,6 +9,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}") +set_property(GLOBAL PROPERTY SubProject "mysubproj") ctest_start(Experimental) ctest_configure() diff --git a/Tests/RunCMake/file/FileOpenFailRead-stderr.txt b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt index 23d4337..9f8cee2 100644 --- a/Tests/RunCMake/file/FileOpenFailRead-stderr.txt +++ b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt @@ -3,4 +3,4 @@ CMake Error at FileOpenFailRead.cmake:[0-9]+ \(file\): .*/Tests/RunCMake/file/does_not_exist/file.txt Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt index 557b817..bb7e4d2 100644 --- a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt @@ -2,31 +2,31 @@ CMake Error at INSTALL-MESSAGE-bad.cmake:1 \(file\): file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are mutually exclusive. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + CMake Error at INSTALL-MESSAGE-bad.cmake:2 \(file\): file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are mutually exclusive. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + CMake Error at INSTALL-MESSAGE-bad.cmake:3 \(file\): file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are mutually exclusive. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + CMake Error at INSTALL-MESSAGE-bad.cmake:4 \(file\): file option MESSAGE_ALWAYS may not appear after PATTERN or REGEX. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + CMake Error at INSTALL-MESSAGE-bad.cmake:5 \(file\): file option MESSAGE_LAZY may not appear after PATTERN or REGEX. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + CMake Error at INSTALL-MESSAGE-bad.cmake:6 \(file\): file option MESSAGE_NEVER may not appear after PATTERN or REGEX. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt new file mode 100644 index 0000000..cb3c99f --- /dev/null +++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt @@ -0,0 +1,6 @@ +-- PROG_ABS='PROG_ABS-NOTFOUND' +-- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND' +-- PROG_CWD='PROG_CWD-NOTFOUND' +-- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND' +-- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD' +-- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD' diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake new file mode 100644 index 0000000..9a42c5e --- /dev/null +++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake @@ -0,0 +1,63 @@ +# testNoSuchFile should only be found if the file absolute path is +# incorrectly prepended with the search path. + +function(strip_windows_path_prefix p outvar) + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + string(REGEX REPLACE "^.:" "" p "${p}") + endif() + set(${outvar} "${p}" PARENT_SCOPE) +endfunction() + +strip_windows_path_prefix("${CMAKE_CURRENT_SOURCE_DIR}" srcdir) + +file(MAKE_DIRECTORY "tmp${srcdir}") +configure_file(testCWD "tmp${srcdir}/testNoSuchFile" COPYONLY) + +find_program(PROG_ABS + NAMES "${srcdir}/testNoSuchFile" + PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp" + NO_DEFAULT_PATH + ) +message(STATUS "PROG_ABS='${PROG_ABS}'") + +find_program(PROG_ABS_NPD + NAMES "${srcdir}/testNoSuchFile" + PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp" + NAMES_PER_DIR + NO_DEFAULT_PATH + ) +message(STATUS "PROG_ABS_NPD='${PROG_ABS_NPD}'") + +# ./testCWD should not be found without '.' being in the path list. + +configure_file(testCWD testCWD COPYONLY) + +find_program(PROG_CWD + NAMES testCWD + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD='${PROG_CWD}'") + +find_program(PROG_CWD_NPD + NAMES testCWD + NAMES_PER_DIR + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD_NPD='${PROG_CWD_NPD}'") + +# Confirm that adding '.' to path does locate ./testCWD. + +find_program(PROG_CWD_DOT + NAMES testCWD + PATHS . + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD_DOT='${PROG_CWD_DOT}'") + +find_program(PROG_CWD_DOT_NPD + NAMES testCWD + PATHS . + NAMES_PER_DIR + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD_DOT_NPD='${PROG_CWD_DOT_NPD}'") diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 89307c1..6903f05 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(EnvAndHints) run_cmake(DirsPerName) run_cmake(NamesPerDir) +run_cmake(RelAndAbsPath) if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$") run_cmake(WindowsCom) diff --git a/Tests/RunCMake/find_program/testCWD b/Tests/RunCMake/find_program/testCWD new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/Tests/RunCMake/find_program/testCWD @@ -0,0 +1 @@ +#!/bin/sh diff --git a/Tests/RunCMake/get_property/BadArgument-stderr.txt b/Tests/RunCMake/get_property/BadArgument-stderr.txt index 37c4477..ce5a209 100644 --- a/Tests/RunCMake/get_property/BadArgument-stderr.txt +++ b/Tests/RunCMake/get_property/BadArgument-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at BadArgument.cmake:1 \(get_property\): get_property given invalid argument "FOO". Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/BadDirectory-stderr.txt b/Tests/RunCMake/get_property/BadDirectory-stderr.txt index 98464f8..6afec03 100644 --- a/Tests/RunCMake/get_property/BadDirectory-stderr.txt +++ b/Tests/RunCMake/get_property/BadDirectory-stderr.txt @@ -3,4 +3,4 @@ found. This could be because the directory argument was invalid or, it is valid but has not been processed yet. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/BadScope-stderr.txt b/Tests/RunCMake/get_property/BadScope-stderr.txt index 4cc32c8..3084bb7 100644 --- a/Tests/RunCMake/get_property/BadScope-stderr.txt +++ b/Tests/RunCMake/get_property/BadScope-stderr.txt @@ -2,4 +2,4 @@ get_property given invalid scope FOO. Valid scopes are GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/BadTarget-stderr.txt b/Tests/RunCMake/get_property/BadTarget-stderr.txt index 45a0df6..e857117 100644 --- a/Tests/RunCMake/get_property/BadTarget-stderr.txt +++ b/Tests/RunCMake/get_property/BadTarget-stderr.txt @@ -2,4 +2,4 @@ get_property could not find TARGET FOO. Perhaps it has not yet been created. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/BadTest-stderr.txt b/Tests/RunCMake/get_property/BadTest-stderr.txt index 819c070..aec9e9e 100644 --- a/Tests/RunCMake/get_property/BadTest-stderr.txt +++ b/Tests/RunCMake/get_property/BadTest-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at BadTest.cmake:1 \(get_property\): get_property given TEST name that does not exist: FOO Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/GlobalName-stderr.txt b/Tests/RunCMake/get_property/GlobalName-stderr.txt index a7d4971..4ddceb2 100644 --- a/Tests/RunCMake/get_property/GlobalName-stderr.txt +++ b/Tests/RunCMake/get_property/GlobalName-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at GlobalName.cmake:1 \(get_property\): get_property given name for GLOBAL scope. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/MissingArgument-stderr.txt b/Tests/RunCMake/get_property/MissingArgument-stderr.txt index 8722712..00d3311 100644 --- a/Tests/RunCMake/get_property/MissingArgument-stderr.txt +++ b/Tests/RunCMake/get_property/MissingArgument-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at MissingArgument.cmake:1 \(get_property\): get_property called with incorrect number of arguments Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/NoCache-stderr.txt b/Tests/RunCMake/get_property/NoCache-stderr.txt index defafb6..7348cff 100644 --- a/Tests/RunCMake/get_property/NoCache-stderr.txt +++ b/Tests/RunCMake/get_property/NoCache-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoCache.cmake:1 \(get_property\): get_property not given name for CACHE scope. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/NoProperty-stderr.txt b/Tests/RunCMake/get_property/NoProperty-stderr.txt index 0ef147f..79b8c87 100644 --- a/Tests/RunCMake/get_property/NoProperty-stderr.txt +++ b/Tests/RunCMake/get_property/NoProperty-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoProperty.cmake:1 \(get_property\): get_property not given a PROPERTY <name> argument. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/NoSource-stderr.txt b/Tests/RunCMake/get_property/NoSource-stderr.txt index 59fd0ad..cefff41 100644 --- a/Tests/RunCMake/get_property/NoSource-stderr.txt +++ b/Tests/RunCMake/get_property/NoSource-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoSource.cmake:1 \(get_property\): get_property not given name for SOURCE scope. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/NoTarget-stderr.txt b/Tests/RunCMake/get_property/NoTarget-stderr.txt index a0e1a94..fb1c8f4 100644 --- a/Tests/RunCMake/get_property/NoTarget-stderr.txt +++ b/Tests/RunCMake/get_property/NoTarget-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoTarget.cmake:1 \(get_property\): get_property not given name for TARGET scope. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/NoTest-stderr.txt b/Tests/RunCMake/get_property/NoTest-stderr.txt index c90a0ffc..93c3e98 100644 --- a/Tests/RunCMake/get_property/NoTest-stderr.txt +++ b/Tests/RunCMake/get_property/NoTest-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoTest.cmake:1 \(get_property\): get_property not given name for TEST scope. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/VariableName-stderr.txt b/Tests/RunCMake/get_property/VariableName-stderr.txt index e9f3827..250d920 100644 --- a/Tests/RunCMake/get_property/VariableName-stderr.txt +++ b/Tests/RunCMake/get_property/VariableName-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at VariableName.cmake:1 \(get_property\): get_property given name for VARIABLE scope. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/include_guard/InvalidArgumentsNumber-stderr.txt b/Tests/RunCMake/include_guard/InvalidArgumentsNumber-stderr.txt index cdd33ac..698e89a 100644 --- a/Tests/RunCMake/include_guard/InvalidArgumentsNumber-stderr.txt +++ b/Tests/RunCMake/include_guard/InvalidArgumentsNumber-stderr.txt @@ -2,4 +2,4 @@ CMake Error at InvalidArgumentsNumber.cmake:1 \(include_guard\): include_guard given an invalid number of arguments. The command takes at most 1 argument. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include_guard/InvalidScope-stderr.txt b/Tests/RunCMake/include_guard/InvalidScope-stderr.txt index 456709d..58f62a3 100644 --- a/Tests/RunCMake/include_guard/InvalidScope-stderr.txt +++ b/Tests/RunCMake/include_guard/InvalidScope-stderr.txt @@ -1,4 +1,4 @@ CMake Error at InvalidScope.cmake:1 \(include_guard\): include_guard given an invalid scope: INVALID Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/install/CMP0062-OLD-stderr.txt b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt new file mode 100644 index 0000000..de0b70f --- /dev/null +++ b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0062-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0062 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/install/DIRECTORY-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..c14998e --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^dir;dir/empty.txt$]]) diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake new file mode 100644 index 0000000..e57aab0 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake @@ -0,0 +1 @@ +install(DIRECTORY dir/ noexist/ DESTINATION dir OPTIONAL) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt index 166ba6f..c8074e9 100644 --- a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt @@ -1,4 +1,4 @@ CMake Error at DIRECTORY-PATTERN-MESSAGE_NEVER.cmake:[0-9]+ \(install\): install DIRECTORY does not allow "MESSAGE_NEVER" after PATTERN or REGEX. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake new file mode 100644 index 0000000..7a20edc --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^dir1;dir1/empty\.c;dir1/empty\.h;dir2;dir2/pattern;dir2/pattern/empty\.txt;dir3;dir3/empty\.c;dir3/empty\.h;dir3/empty\.txt;dir4;dir4/empty\.c;dir4/empty\.h;dir4/empty\.txt;empty$]]) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake new file mode 100644 index 0000000..74d8043 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake @@ -0,0 +1,36 @@ +install( + DIRECTORY pattern/ + DESTINATION dir1 + FILES_MATCHING + PATTERN "*.h" + REGEX "\\.c$" + ) + +# FIXME: If/when CMake gains a good way to read file permissions, we should +# check that these permissions were set correctly. +install( + DIRECTORY pattern + DESTINATION dir2 + FILE_PERMISSIONS OWNER_READ OWNER_WRITE + DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + PATTERN "*.h" EXCLUDE + REGEX "\\.c$" EXCLUDE + ) + +install( + DIRECTORY pattern/ + DESTINATION dir3 + PATTERN "*.h" + PERMISSIONS OWNER_READ OWNER_WRITE + ) + +install( + DIRECTORY pattern/ + DESTINATION dir4 + USE_SOURCE_PERMISSIONS + ) + +install( + DIRECTORY + DESTINATION empty + ) diff --git a/Tests/RunCMake/install/Deprecated-all-check.cmake b/Tests/RunCMake/install/Deprecated-all-check.cmake new file mode 100644 index 0000000..9ea33a6 --- /dev/null +++ b/Tests/RunCMake/install/Deprecated-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;scripts1;scripts1/script;scripts1/script\.bat;scripts2;scripts2/script;scripts2/script\.bat;scripts3;scripts3/script;scripts3/script\.bat;src;src/empty\.c;src/obj1\.c;src/obj\2.c$]]) diff --git a/Tests/RunCMake/install/Deprecated.cmake b/Tests/RunCMake/install/Deprecated.cmake new file mode 100644 index 0000000..c435cb5 --- /dev/null +++ b/Tests/RunCMake/install/Deprecated.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_executable(myexe main.c) + +install_files(/src FILES empty.c) +install_files(/src .c obj1) +install_files(/src "^obj2.c$") + +install_targets(/bin myexe) + +install_programs(/scripts1 FILES script script.bat) +install_programs(/scripts2 script script.bat) +install_programs(/scripts3 "^script(\.bat)?$") diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..2997a8d --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main.c$]]) diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake new file mode 100644 index 0000000..812bf4f --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake @@ -0,0 +1 @@ +install(FILES main.c noexist.c DESTINATION src OPTIONAL) diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake new file mode 100644 index 0000000..b8ba6d0 --- /dev/null +++ b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/empty.c]]) diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake new file mode 100644 index 0000000..999c271 --- /dev/null +++ b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake @@ -0,0 +1,5 @@ +install( + FILES empty.c + DESTINATION src + PERMISSIONS OWNER_READ OWNER_WRITE + ) diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake new file mode 100644 index 0000000..27ff683 --- /dev/null +++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake @@ -0,0 +1,10 @@ +enable_language(C) +set(CMAKE_INSTALL_MFC_LIBRARIES 1) +set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +set(CMAKE_INSTALL_UCRT_LIBRARIES 1) +set(CMAKE_INSTALL_OPENMP_LIBRARIES 1) +include(InstallRequiredSystemLibraries) + +# FIXME: This test emits warnings because InstallRequiredSystemLibraries +# doesn't currently work properly. The warnings have been suppressed in +# InstallRequiredSystemLibraries-stderr.txt. This needs to be fixed. diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake new file mode 100644 index 0000000..16ff1e1 --- /dev/null +++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;postinstall;preinstall]]) diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake new file mode 100644 index 0000000..357c688 --- /dev/null +++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_executable(myexe main.c) +set_property(TARGET myexe PROPERTY PRE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/preinstall.cmake") +set_property(TARGET myexe PROPERTY POST_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/postinstall.cmake") + +install(TARGETS myexe DESTINATION bin) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index f004ce9..ec022ca 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -70,7 +70,27 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES} run_install_test(FILES-TARGET_OBJECTS) endif() +run_install_test(TARGETS-InstallFromSubDir) +run_install_test(TARGETS-OPTIONAL) +run_install_test(FILES-OPTIONAL) +run_install_test(DIRECTORY-OPTIONAL) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") +run_install_test(TARGETS-OUTPUT_NAME) +unset(RunCMake_TEST_OPTIONS) + +run_install_test(Deprecated) +run_install_test(PRE_POST_INSTALL_SCRIPT) +run_install_test(SCRIPT) +run_install_test(TARGETS-CONFIGURATIONS) +run_install_test(DIRECTORY-PATTERN) +run_install_test(TARGETS-Parts) +run_install_test(FILES-PERMISSIONS) +run_install_test(TARGETS-RPATH) +run_install_test(InstallRequiredSystemLibraries) + set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) run_install_test(TARGETS-NAMELINK_COMPONENT) +run_install_test(SCRIPT-COMPONENT) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake new file mode 100644 index 0000000..e09a102 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake new file mode 100644 index 0000000..aaa9bd4 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake @@ -0,0 +1,5 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + COMPONENT dev + ) diff --git a/Tests/RunCMake/install/SCRIPT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT.cmake b/Tests/RunCMake/install/SCRIPT.cmake new file mode 100644 index 0000000..f857b54 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT.cmake @@ -0,0 +1,4 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + ) diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake new file mode 100644 index 0000000..2866e7f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main-d.c$]]) diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake new file mode 100644 index 0000000..5531cd2 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake @@ -0,0 +1,2 @@ +install(FILES main.c DESTINATION src CONFIGURATIONS Debug RENAME main-d.c) +install(FILES main.c DESTINATION src CONFIGURATIONS Release RENAME main-r.c) diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake new file mode 100644 index 0000000..1d747c3 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;bin/subexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake new file mode 100644 index 0000000..8615d6e --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(myexe main.c) +add_subdirectory(TARGETS-InstallFromSubDir) +install(TARGETS myexe subexe DESTINATION bin) diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt new file mode 100644 index 0000000..477d938 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(subexe ../main.c) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt index 187a826..fe65fd3 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt @@ -2,4 +2,4 @@ install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The NAMELINK_COMPONENT option may be specified only following LIBRARY\. Call Stack \(most recent call first\): - CMakeLists\.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt index d1002ba..60f52c4 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt @@ -2,4 +2,4 @@ install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The NAMELINK_COMPONENT option may be specified only following LIBRARY\. Call Stack \(most recent call first\): - CMakeLists\.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..bcf71dd --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt new file mode 100644 index 0000000..86e3ec0 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt @@ -0,0 +1 @@ +^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$ diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake new file mode 100644 index 0000000..d3c5cda --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(myexe main.c) +add_executable(notall EXCLUDE_FROM_ALL main.c) +install(TARGETS myexe notall DESTINATION bin OPTIONAL) diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake new file mode 100644 index 0000000..5daecc8 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake @@ -0,0 +1,13 @@ +if(WIN32) + set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]]) + set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]]) + set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]]) + + check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$") +elseif(CYGWIN) + check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) +elseif(APPLE) + check_installed([[^bin;bin/libtest4lib\.dylib;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]]) +else() + check_installed([[^bin;bin/libtest4lib\.so;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]]) +endif() diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake new file mode 100644 index 0000000..67e7069 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake @@ -0,0 +1,27 @@ +enable_language(C) + +add_executable(test1 main.c) +set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out) +set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel) + +add_executable(test2 main.c) +set_property(TARGET test2 PROPERTY OUTPUT_NAME test2out) +set_property(TARGET test2 PROPERTY DEBUG_OUTPUT_NAME test2deb) + +add_executable(test3 main.c) +set_property(TARGET test3 PROPERTY RUNTIME_OUTPUT_NAME test3exc) + +add_library(test4 SHARED obj1.c) +set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4lib) + +add_library(test5 STATIC obj1.c) +set_property(TARGET test5 PROPERTY ARCHIVE_OUTPUT_NAME test5ar) + +install(TARGETS + test1 + test2 + test3 + test4 + test5 + DESTINATION bin + ) diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake new file mode 100644 index 0000000..6245839 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]]) diff --git a/Tests/RunCMake/install/TARGETS-Parts.cmake b/Tests/RunCMake/install/TARGETS-Parts.cmake new file mode 100644 index 0000000..2a46ab9 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Parts.cmake @@ -0,0 +1,7 @@ +enable_language(C) +add_library(mylib STATIC obj1.c) +set_property(TARGET mylib PROPERTY PUBLIC_HEADER obj1.h) +install(TARGETS mylib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include + ) diff --git a/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake new file mode 100644 index 0000000..fa52d65 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake @@ -0,0 +1,14 @@ +execute_process( + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/myexe" + RESULT_VARIABLE MYEXE_RESULT + OUTPUT_VARIABLE MYEXE_OUTPUT + ERROR_VARIABLE MYEXE_ERROR + ) + +if(NOT MYEXE_RESULT EQUAL "0") + set(RunCMake_TEST_FAILED "myexe returned [${MYEXE_RESULT}], was expecting [0]") +elseif(NOT MYEXE_OUTPUT STREQUAL "") + set(RunCMake_TEST_FAILED "myexe printed nonempty output:\n${MYEXE_OUTPUT}") +elseif(NOT MYEXE_ERROR STREQUAL "") + set(RunCMake_TEST_FAILED "myexe printed nonempty error:\n${MYEXE_ERROR}") +endif() diff --git a/Tests/RunCMake/install/TARGETS-RPATH.cmake b/Tests/RunCMake/install/TARGETS-RPATH.cmake new file mode 100644 index 0000000..b75deff --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-RPATH.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.9) + +enable_language(C) + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) +add_library(mylib SHARED obj1.c) +add_executable(myexe testobj1.c) +target_link_libraries(myexe mylib) +set_property(TARGET myexe PROPERTY INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/root-all/bin") +set_target_properties(mylib PROPERTIES VERSION 1.0 SOVERSION 1) + +install(TARGETS mylib myexe + DESTINATION bin + ) diff --git a/Tests/RunCMake/install/install_script.cmake b/Tests/RunCMake/install/install_script.cmake new file mode 100644 index 0000000..1f8522c --- /dev/null +++ b/Tests/RunCMake/install/install_script.cmake @@ -0,0 +1,5 @@ +function(write_empty_file FILENAME) + file(WRITE "${CMAKE_INSTALL_PREFIX}/${FILENAME}" "") +endfunction() + +write_empty_file(empty1.txt) diff --git a/Tests/RunCMake/install/obj1.c b/Tests/RunCMake/install/obj1.c index 2411aab..70007df 100644 --- a/Tests/RunCMake/install/obj1.c +++ b/Tests/RunCMake/install/obj1.c @@ -1,4 +1,7 @@ -int obj1(void) +#ifdef _WIN32 +__declspec(dllexport) +#endif + int obj1(void) { return 0; } diff --git a/Tests/RunCMake/install/obj1.h b/Tests/RunCMake/install/obj1.h new file mode 100644 index 0000000..d88d5d2 --- /dev/null +++ b/Tests/RunCMake/install/obj1.h @@ -0,0 +1,6 @@ +#ifndef OBJ1_H +#define OBJ1_H + +int obj1(void); + +#endif /* OBJ1_H */ diff --git a/Tests/RunCMake/install/pattern/empty.c b/Tests/RunCMake/install/pattern/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/pattern/empty.c diff --git a/Tests/RunCMake/install/pattern/empty.h b/Tests/RunCMake/install/pattern/empty.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/pattern/empty.h diff --git a/Tests/RunCMake/install/pattern/empty.txt b/Tests/RunCMake/install/pattern/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/pattern/empty.txt diff --git a/Tests/RunCMake/install/postinstall.cmake b/Tests/RunCMake/install/postinstall.cmake new file mode 100644 index 0000000..7607f40 --- /dev/null +++ b/Tests/RunCMake/install/postinstall.cmake @@ -0,0 +1 @@ +file(WRITE "${CMAKE_INSTALL_PREFIX}/postinstall" "postinstall") diff --git a/Tests/RunCMake/install/preinstall.cmake b/Tests/RunCMake/install/preinstall.cmake new file mode 100644 index 0000000..4b28d16 --- /dev/null +++ b/Tests/RunCMake/install/preinstall.cmake @@ -0,0 +1 @@ +file(WRITE "${CMAKE_INSTALL_PREFIX}/preinstall" "preinstall") diff --git a/Tests/RunCMake/install/script b/Tests/RunCMake/install/script new file mode 100755 index 0000000..81f9f53 --- /dev/null +++ b/Tests/RunCMake/install/script @@ -0,0 +1,2 @@ +#!/bin/sh +echo "Sample Script Output" diff --git a/Tests/RunCMake/install/script.bat b/Tests/RunCMake/install/script.bat new file mode 100755 index 0000000..a9af38c --- /dev/null +++ b/Tests/RunCMake/install/script.bat @@ -0,0 +1 @@ +@echo Sample Script Output diff --git a/Tests/RunCMake/install/testobj1.c b/Tests/RunCMake/install/testobj1.c new file mode 100644 index 0000000..081ef20 --- /dev/null +++ b/Tests/RunCMake/install/testobj1.c @@ -0,0 +1,9 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + int obj1(void); + +int main(void) +{ + return obj1(); +} diff --git a/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt b/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt index b24a0ed..9368e88 100644 --- a/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt +++ b/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt @@ -1,4 +1,4 @@ CMake Error at EmptyRemoveAt0.cmake:2 \(list\): - list REMOVE_AT given empty list + list index: mylist, 0 out of range \(0, 0\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-NotList-stderr.txt b/Tests/RunCMake/list/FILTER-NotList-stderr.txt deleted file mode 100644 index 159c28d..0000000 --- a/Tests/RunCMake/list/FILTER-NotList-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at FILTER-NotList.cmake:2 \(list\): - list sub-command FILTER requires list to be present. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-NotList.cmake b/Tests/RunCMake/list/FILTER-NotList.cmake index 1e15635..bf09ec7 100644 --- a/Tests/RunCMake/list/FILTER-NotList.cmake +++ b/Tests/RunCMake/list/FILTER-NotList.cmake @@ -1,2 +1,6 @@ unset(nosuchlist) list(FILTER nosuchlist EXCLUDE REGEX "^FILTER_THIS_.+") +if (DEFINED nosuchlist) + message(FATAL_ERROR + "list(FILTER) created our list") +endif () diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt index 6e15c0b..9b9c5e0 100644 --- a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\): - list index: 3 out of range \(-3, 2\) + list index: 4 out of range \(-3, 3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake index 4103d97..12ac114 100644 --- a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake +++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake @@ -1,2 +1,2 @@ set(mylist alpha bravo charlie) -list(INSERT mylist 3 delta) +list(INSERT mylist 4 delta) diff --git a/Tests/RunCMake/list/REMOVE_AT-EmptyList-result.txt b/Tests/RunCMake/list/REMOVE_AT-EmptyList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-EmptyList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-EmptyList-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-EmptyList-stderr.txt new file mode 100644 index 0000000..582b74b --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-EmptyList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-EmptyList.cmake:2 \(list\): + list index: nosuchlist, 0 out of range \(0, 0\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_AT-EmptyList.cmake b/Tests/RunCMake/list/REMOVE_AT-EmptyList.cmake new file mode 100644 index 0000000..ff0dde8 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-EmptyList.cmake @@ -0,0 +1,6 @@ +set(nosuchlist "") +list(REMOVE_AT nosuchlist 0) +if (NOT DEFINED nosuchlist OR NOT nosuchlist STREQUAL "") + message(FATAL_ERROR + "list(REMOVE_AT) modified our list") +endif () diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt index d6e8d85..563d865 100644 --- a/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at REMOVE_AT-NotList.cmake:2 \(list\): - list sub-command REMOVE_AT requires list to be present. + list index: nosuchlist, 0 out of range \(0, 0\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList.cmake b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake index 5266c7f..090df49 100644 --- a/Tests/RunCMake/list/REMOVE_AT-NotList.cmake +++ b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake @@ -1,2 +1,6 @@ unset(nosuchlist) list(REMOVE_AT nosuchlist 0) +if (DEFINED nosuchlist) + message(FATAL_ERROR + "list(REMOVE_AT) created our list") +endif () diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt deleted file mode 100644 index 96f3446..0000000 --- a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at REMOVE_DUPLICATES-NotList.cmake:2 \(list\): - list sub-command REMOVE_DUPLICATES requires list to be present. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake index 218f227..b9f3999 100644 --- a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake @@ -1,2 +1,6 @@ unset(nosuchlist) list(REMOVE_DUPLICATES nosuchlist) +if (DEFINED nosuchlist) + message(FATAL_ERROR + "list(REMOVE_DUPLICATES) created our list") +endif () diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt deleted file mode 100644 index c32a4c0..0000000 --- a/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at REMOVE_ITEM-NotList.cmake:2 \(list\): - list sub-command REMOVE_ITEM requires list to be present. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake index 079e7fb..0c66837 100644 --- a/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake @@ -1,2 +1,6 @@ unset(nosuchlist) list(REMOVE_ITEM nosuchlist alpha) +if (DEFINED nosuchlist) + message(FATAL_ERROR + "list(REMOVE_ITEM) created our list") +endif () diff --git a/Tests/RunCMake/list/REVERSE-NotList-stderr.txt b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt deleted file mode 100644 index e9dcc06..0000000 --- a/Tests/RunCMake/list/REVERSE-NotList-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at REVERSE-NotList.cmake:2 \(list\): - list sub-command REVERSE requires list to be present. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REVERSE-NotList.cmake b/Tests/RunCMake/list/REVERSE-NotList.cmake index 977e2cc..7138329 100644 --- a/Tests/RunCMake/list/REVERSE-NotList.cmake +++ b/Tests/RunCMake/list/REVERSE-NotList.cmake @@ -1,2 +1,6 @@ unset(nosuchlist) list(REVERSE nosuchlist) +if (DEFINED nosuchlist) + message(FATAL_ERROR + "list(REVERSE) created our list") +endif () diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index bdc23a4..bf3d22d 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -20,9 +20,10 @@ run_cmake(JOIN-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) -run_cmake(SORT-TooManyArguments) run_cmake(SUBLIST-TooManyArguments) +run_cmake(REMOVE_AT-EmptyList) + run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) run_cmake(REMOVE_DUPLICATES-NotList) @@ -84,3 +85,16 @@ run_cmake(TRANSFORM-GENEX_STRIP) run_cmake(TRANSFORM-APPEND) run_cmake(TRANSFORM-PREPEND) run_cmake(TRANSFORM-REPLACE) + +# argument tests +run_cmake(SORT-WrongOption) +run_cmake(SORT-BadCaseOption) +run_cmake(SORT-BadCompareOption) +run_cmake(SORT-BadOrderOption) +run_cmake(SORT-DuplicateOrderOption) +run_cmake(SORT-DuplicateCompareOption) +run_cmake(SORT-DuplicateCaseOption) +run_cmake(SORT-NoCaseOption) + +# Successful tests +run_cmake(SORT) diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-result.txt b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt new file mode 100644 index 0000000..87dd502 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-BadCaseOption.cmake:1 \(list\): + list sub-command SORT value "BAD_CASE_OPTION" for option "CASE" is invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-BadCaseOption.cmake b/Tests/RunCMake/list/SORT-BadCaseOption.cmake new file mode 100644 index 0000000..ac5c102 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCaseOption.cmake @@ -0,0 +1 @@ +list(SORT mylist CASE BAD_CASE_OPTION) diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-result.txt b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt new file mode 100644 index 0000000..51b4de2 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SORT-BadCompareOption.cmake:1 \(list\): + list sub-command SORT value "BAD_COMPARE_OPTION" for option "COMPARE" is + invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-BadCompareOption.cmake b/Tests/RunCMake/list/SORT-BadCompareOption.cmake new file mode 100644 index 0000000..d5c632e --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCompareOption.cmake @@ -0,0 +1 @@ +list(SORT mylist COMPARE BAD_COMPARE_OPTION) diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-result.txt b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt new file mode 100644 index 0000000..7984e5c --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SORT-BadOrderOption.cmake:1 \(list\): + list sub-command SORT value "BAD_ODER_OPTION" for option "ORDER" is + invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-BadOrderOption.cmake b/Tests/RunCMake/list/SORT-BadOrderOption.cmake new file mode 100644 index 0000000..e232197 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadOrderOption.cmake @@ -0,0 +1 @@ +list(SORT mylist ORDER BAD_ODER_OPTION) diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt new file mode 100644 index 0000000..b893f50 --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-DuplicateCaseOption.cmake:2 \(list\): + list sub-command SORT option "CASE" has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake new file mode 100644 index 0000000..ba52b24 --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake @@ -0,0 +1,2 @@ +set (mylist a b c) +list(SORT mylist CASE INSENSITIVE CASE INSENSITIVE ) diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt new file mode 100644 index 0000000..83624be --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-DuplicateCompareOption.cmake:2 \(list\): + list sub-command SORT option "COMPARE" has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake new file mode 100644 index 0000000..fd2e31d --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake @@ -0,0 +1,2 @@ +set (mylist a b c) +list(SORT mylist COMPARE STRING COMPARE STRING) diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt new file mode 100644 index 0000000..9e95178 --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-DuplicateOrderOption.cmake:2 \(list\): + list sub-command SORT option "ORDER" has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake new file mode 100644 index 0000000..26d9c7d --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake @@ -0,0 +1,2 @@ +set (mylist a b c) +list(SORT mylist ORDER ASCENDING ORDER ASCENDING) diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-result.txt b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt new file mode 100644 index 0000000..5c63e77 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-NoCaseOption.cmake:1 \(list\): + list sub-command SORT missing argument for option "CASE". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-NoCaseOption.cmake b/Tests/RunCMake/list/SORT-NoCaseOption.cmake new file mode 100644 index 0000000..57cc429 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NoCaseOption.cmake @@ -0,0 +1 @@ +list(SORT mylist CASE) diff --git a/Tests/RunCMake/list/SORT-NotList-stderr.txt b/Tests/RunCMake/list/SORT-NotList-stderr.txt deleted file mode 100644 index 396c5b5..0000000 --- a/Tests/RunCMake/list/SORT-NotList-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at SORT-NotList.cmake:2 \(list\): - list sub-command SORT requires list to be present. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-NotList.cmake b/Tests/RunCMake/list/SORT-NotList.cmake index 8f48e10..6314f14 100644 --- a/Tests/RunCMake/list/SORT-NotList.cmake +++ b/Tests/RunCMake/list/SORT-NotList.cmake @@ -1,2 +1,6 @@ unset(nosuchlist) list(SORT nosuchlist) +if (DEFINED nosuchlist) + message(FATAL_ERROR + "list(SORT) created our list") +endif () diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt deleted file mode 100644 index d3fad60..0000000 --- a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at SORT-TooManyArguments.cmake:1 \(list\): - list sub-command SORT only takes one argument. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-WrongOption-result.txt b/Tests/RunCMake/list/SORT-WrongOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-WrongOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-WrongOption-stderr.txt b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt new file mode 100644 index 0000000..597cb29 --- /dev/null +++ b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-WrongOption.cmake:1 \(list\): + list sub-command SORT option "one_too_many" is unknown. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-TooManyArguments.cmake b/Tests/RunCMake/list/SORT-WrongOption.cmake index 81b195d..81b195d 100644 --- a/Tests/RunCMake/list/SORT-TooManyArguments.cmake +++ b/Tests/RunCMake/list/SORT-WrongOption.cmake diff --git a/Tests/RunCMake/list/SORT.cmake b/Tests/RunCMake/list/SORT.cmake new file mode 100644 index 0000000..4a9e064 --- /dev/null +++ b/Tests/RunCMake/list/SORT.cmake @@ -0,0 +1,114 @@ +set(source_unsorted + c/B.h + a/c.h + B/a.h + ) + +## Test with default options +set(expected + B/a.h + a/c.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)") +endif () + + +## Test CASE INSENSITIVE ORDER ASCENDING COMPARE STRING +set(expected + a/c.h + B/a.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)") +endif () + +## Test CASE INSENSITIVE ORDER DESCENDING COMPARE STRING +set(expected + c/B.h + B/a.h + a/c.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)") +endif () + +## Test CASE SENSITIVE ORDER ASCENDING COMPARE STRING +set(expected + B/a.h + a/c.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)") +endif () + +## Test CASE SENSITIVE ORDER DESCENDING COMPARE STRING +set(expected + c/B.h + a/c.h + B/a.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)") +endif () + +## Test CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME +set(expected + B/a.h + c/B.h + a/c.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)") +endif () + +## Test CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME +set(expected + a/c.h + c/B.h + B/a.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)") +endif () + +## Test CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME +set(expected + c/B.h + B/a.h + a/c.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)") +endif () + +## Test CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME +set(expected + a/c.h + B/a.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)") +endif () diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/math/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/math/MATH-DivideByZero-result.txt b/Tests/RunCMake/math/MATH-DivideByZero-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt new file mode 100644 index 0000000..66ad633 --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-DivideByZero.cmake:1 \(math\): + math cannot evaluate the expression: "100/0": divide by zero. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-DivideByZero.cmake b/Tests/RunCMake/math/MATH-DivideByZero.cmake new file mode 100644 index 0000000..3ac161e --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero.cmake @@ -0,0 +1 @@ +math(EXPR var "100/0") diff --git a/Tests/RunCMake/math/MATH-DoubleOption-result.txt b/Tests/RunCMake/math/MATH-DoubleOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt new file mode 100644 index 0000000..767a060 --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-DoubleOption.cmake:1 \(math\): + math EXPR called with incorrect arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-DoubleOption.cmake b/Tests/RunCMake/math/MATH-DoubleOption.cmake new file mode 100644 index 0000000..7bcb78e --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT HEXADECIMAL) diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-result.txt b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt new file mode 100644 index 0000000..9e73ed5 --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at MATH-InvalidExpression.cmake:1 \(math\): + math cannot parse the expression: "INVALID": syntax error, unexpected \$end, + expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-InvalidExpression.cmake b/Tests/RunCMake/math/MATH-InvalidExpression.cmake new file mode 100644 index 0000000..6e37128 --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression.cmake @@ -0,0 +1 @@ +math(EXPR var "INVALID") diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt new file mode 100644 index 0000000..732ce6f --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\): + Unexpected character in expression at position 1: ' + + Unexpected character in expression at position 7: ' + +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/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake new file mode 100644 index 0000000..d1be218 --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake @@ -0,0 +1,4 @@ +math(EXPR var "'2*1-1'") +if(NOT var EQUAL 1) + message(FATAL_ERROR "Expression did not evaluate to 1") +endif() diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-result.txt b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt new file mode 100644 index 0000000..fdcfecf --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-TooManyArguments.cmake:1 \(math\): + math EXPR called with incorrect arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-TooManyArguments.cmake b/Tests/RunCMake/math/MATH-TooManyArguments.cmake new file mode 100644 index 0000000..969dc80 --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT ) diff --git a/Tests/RunCMake/math/MATH-WrongArgument-result.txt b/Tests/RunCMake/math/MATH-WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt new file mode 100644 index 0000000..bbe54bf --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-WrongArgument.cmake:1 \(math\): + math sub-command EXPR option "OUT" is unknown. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-WrongArgument.cmake b/Tests/RunCMake/math/MATH-WrongArgument.cmake new file mode 100644 index 0000000..fb6d2e7 --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUT HEX ) diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake new file mode 100644 index 0000000..a5f50cd --- /dev/null +++ b/Tests/RunCMake/math/MATH.cmake @@ -0,0 +1,12 @@ +macro(math_test expression expected) + math(EXPR evaluated ${expression} ${ARGN}) + if (NOT evaluated STREQUAL ${expected}) + message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}") + endif () +endmacro() + + +math_test("100 * 10" 1000) +math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL) +math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL) +math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL) diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake new file mode 100644 index 0000000..a4d5c31 --- /dev/null +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(MATH) +run_cmake(MATH-WrongArgument) +run_cmake(MATH-DoubleOption) +run_cmake(MATH-TooManyArguments) +run_cmake(MATH-InvalidExpression) +run_cmake(MATH-ToleratedExpression) +run_cmake(MATH-DivideByZero) diff --git a/Tests/RunCMake/option/CMP0077-NEW.cmake b/Tests/RunCMake/option/CMP0077-NEW.cmake new file mode 100644 index 0000000..d4c518b --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-NEW.cmake @@ -0,0 +1,14 @@ + +#Verify that option DOESN'T overwrite existing normal variable when the policy +#is set to NEW +cmake_policy(SET CMP0077 NEW) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(OPT_LOCAL_VAR) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() + +get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET) +if(_exists_in_cache) + message(FATAL_ERROR "value should not exist in cache as it was already a local variable") +endif() diff --git a/Tests/RunCMake/option/CMP0077-OLD.cmake b/Tests/RunCMake/option/CMP0077-OLD.cmake new file mode 100644 index 0000000..4c52d4b --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-OLD.cmake @@ -0,0 +1,9 @@ + +#Verify that option overwrites existing normal variable when the policy +#is set to OLD +cmake_policy(SET CMP0077 OLD) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(NOT OPT_LOCAL_VAR) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() diff --git a/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake new file mode 100644 index 0000000..f62a853 --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake @@ -0,0 +1,14 @@ + +#Verify that when both a cache and local version of a value exist that CMake +#doesn't produce a CMP0077 warning and that we get the expected values. +option(OPT_LOCAL_VAR "TEST_VAR" ON) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(OPT_LOCAL_VAR) + message(FATAL_ERROR "option improperly set a cache variable that already exists") +endif() + +get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET) +if(NOT _exists_in_cache) + message(FATAL_ERROR "value should exist in cache") +endif() diff --git a/Tests/RunCMake/option/CMP0077-WARN-stderr.txt b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt new file mode 100644 index 0000000..0d02ffb --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0077-WARN.cmake:5 \(option\): + Policy CMP0077 is not set: option\(\) honors normal variables. Run "cmake + --help-policy CMP0077" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + For compatibility with older versions of CMake, option is clearing the + normal variable 'OPT_LOCAL_VAR'. diff --git a/Tests/RunCMake/option/CMP0077-WARN.cmake b/Tests/RunCMake/option/CMP0077-WARN.cmake new file mode 100644 index 0000000..7f99456 --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-WARN.cmake @@ -0,0 +1,5 @@ + +#Verify that option overwrites existing normal variable when the policy +#is set to OLD +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) diff --git a/Tests/RunCMake/option/CMakeLists.txt b/Tests/RunCMake/option/CMakeLists.txt new file mode 100644 index 0000000..11dc49a --- /dev/null +++ b/Tests/RunCMake/option/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake new file mode 100644 index 0000000..979afa1 --- /dev/null +++ b/Tests/RunCMake/option/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(CMP0077-OLD) +run_cmake(CMP0077-NEW) +run_cmake(CMP0077-WARN) +run_cmake(CMP0077-SECOND-PASS) diff --git a/Tests/RunCMake/project/ProjectTwice.cmake b/Tests/RunCMake/project/ProjectTwice.cmake new file mode 100644 index 0000000..d053834 --- /dev/null +++ b/Tests/RunCMake/project/ProjectTwice.cmake @@ -0,0 +1,26 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectTwiceTestFirst + VERSION 1.2.3.4 + DESCRIPTION "Test Project" + HOMEPAGE_URL "http://example.com" + LANGUAGES NONE +) + +project(ProjectTwiceTestSecond LANGUAGES NONE) + +foreach(var + PROJECT_VERSION + PROJECT_VERSION_MAJOR + PROJECT_VERSION_MINOR + PROJECT_VERSION_PATCH + PROJECT_VERSION_TWEAK + PROJECT_DESCRIPTION + PROJECT_HOMEPAGE_URL +) + if(${var}) + message(SEND_ERROR "${var} set but should be empty") + endif() + if(CMAKE_${var}) + message(SEND_ERROR "CMAKE_${var} set but should be empty") + endif() +endforeach() diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index e9fb929..3a8ad4b 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(ProjectDescriptionNoArg2) run_cmake(ProjectHomepage) run_cmake(ProjectHomepage2) run_cmake(ProjectHomepageNoArg) +run_cmake(ProjectTwice) run_cmake(VersionAndLanguagesEmpty) run_cmake(VersionEmpty) run_cmake(VersionInvalid) diff --git a/Tests/RunCMake/pseudo_cppcheck.c b/Tests/RunCMake/pseudo_cppcheck.c index 75f3cec..5b1531b 100644 --- a/Tests/RunCMake/pseudo_cppcheck.c +++ b/Tests/RunCMake/pseudo_cppcheck.c @@ -5,13 +5,16 @@ int main(int argc, char* argv[]) { int i; + int result = 0; for (i = 1; i < argc; ++i) { - if (strcmp(argv[i], "-bad") == 0) - if (strcmp(argv[i], "-bad") == 0) { - fprintf(stdout, "stdout from bad command line arg '-bad'\n"); - fprintf(stderr, "stderr from bad command line arg '-bad'\n"); - return 1; - } + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } else if (strcmp(argv[i], "-error") == 0) { + // The real cppcheck allows to set the exitcode with --error-exitcode + result = 5; + } } fprintf(stderr, "[/foo/bar.c:2]: (error) Array 'abc[10]' accessed at index 12," @@ -31,6 +34,6 @@ int main(int argc, char* argv[]) fprintf(stderr, "[/foo/bar.c:2]: (information) cannot find all the include " "files (use --check-config for details)\n"); - // we allow this to return 1 as we ignore it - return 1; + + return result; } diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt index f21b1de..e45fc64 100644 --- a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt @@ -3,7 +3,7 @@ \(\"ImportedGlobalTarget\"\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) CMake Error at IMPORTED_GLOBAL.cmake:16 \(set_property\): @@ -11,7 +11,7 @@ CMake Error at IMPORTED_GLOBAL.cmake:16 \(set_property\): \(\"ImportedGlobalTarget\"\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) CMake Error at IMPORTED_GLOBAL.cmake:26 \(set_property\): @@ -19,7 +19,7 @@ CMake Error at IMPORTED_GLOBAL.cmake:26 \(set_property\): \(\"ImportedLocalTarget\"\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) CMake Error at IMPORTED_GLOBAL.cmake:32 \(set_property\): @@ -27,10 +27,10 @@ CMake Error at IMPORTED_GLOBAL.cmake:32 \(set_property\): \(\"NonImportedTarget\"\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) -CMake Error at IMPORTED_GLOBAL/CMakeLists.txt:8 \(set_property\): +CMake Error at IMPORTED_GLOBAL/CMakeLists\.txt:[0-9]+ \(set_property\): Attempt to promote imported target \"ImportedLocalTarget2\" to global scope \(by setting IMPORTED_GLOBAL\) which is not built in this directory. @@ -45,7 +45,7 @@ CMake Error at IMPORTED_GLOBAL.cmake:50 \(set_property\): Attempt to promote imported target \"ImportedSubdirTarget1\" to global scope \(by setting IMPORTED_GLOBAL\) which is not built in this directory. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) CMake Error in IMPORTED_GLOBAL/CMakeLists.txt: @@ -58,4 +58,4 @@ CMake Error at IMPORTED_GLOBAL.cmake:52 \(set_property\): Attempt to promote imported target \"ImportedSubdirTarget2\" to global scope \(by setting IMPORTED_GLOBAL\) which is not built in this directory. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt b/Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt new file mode 100644 index 0000000..580c373 --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt @@ -0,0 +1,2 @@ +-- Target LINK_DIRECTORIES is 'a;b;c;d;;e' +-- Directory LINK_DIRECTORIES is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake b/Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake new file mode 100644 index 0000000..8529ef5 --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(LINK_DIRECTORIES) +test_directory_property(LINK_DIRECTORIES) diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt new file mode 100644 index 0000000..033792a --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt @@ -0,0 +1,2 @@ +-- Target LINK_OPTIONS is 'a;b;c;d;;e' +-- Directory LINK_OPTIONS is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS.cmake b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake new file mode 100644 index 0000000..6daf41b --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(LINK_OPTIONS) +test_directory_property(LINK_OPTIONS) diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index b966e89..8d4614c 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -5,6 +5,8 @@ run_cmake(COMPILE_FEATURES) run_cmake(COMPILE_OPTIONS) run_cmake(IMPORTED_GLOBAL) run_cmake(INCLUDE_DIRECTORIES) +run_cmake(LINK_OPTIONS) +run_cmake(LINK_DIRECTORIES) run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) run_cmake(TYPE) diff --git a/Tests/RunCMake/string/AppendNoArgs-stderr.txt b/Tests/RunCMake/string/AppendNoArgs-stderr.txt index 75ad427..9b7e9fa 100644 --- a/Tests/RunCMake/string/AppendNoArgs-stderr.txt +++ b/Tests/RunCMake/string/AppendNoArgs-stderr.txt @@ -1,4 +1,4 @@ CMake Error at AppendNoArgs.cmake:1 \(string\): string sub-command APPEND requires at least one argument. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/ConcatNoArgs-stderr.txt b/Tests/RunCMake/string/ConcatNoArgs-stderr.txt index efea5f1..22b608d 100644 --- a/Tests/RunCMake/string/ConcatNoArgs-stderr.txt +++ b/Tests/RunCMake/string/ConcatNoArgs-stderr.txt @@ -1,4 +1,4 @@ CMake Error at ConcatNoArgs.cmake:1 \(string\): string sub-command CONCAT requires at least one argument. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/JoinNoArgs-stderr.txt b/Tests/RunCMake/string/JoinNoArgs-stderr.txt index d9dcec3..7fcd352 100644 --- a/Tests/RunCMake/string/JoinNoArgs-stderr.txt +++ b/Tests/RunCMake/string/JoinNoArgs-stderr.txt @@ -1,4 +1,4 @@ CMake Error at JoinNoArgs.cmake:1 \(string\): string sub-command JOIN requires at least two arguments. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/JoinNoVar-stderr.txt b/Tests/RunCMake/string/JoinNoVar-stderr.txt index 90701a9..b4a09c3 100644 --- a/Tests/RunCMake/string/JoinNoVar-stderr.txt +++ b/Tests/RunCMake/string/JoinNoVar-stderr.txt @@ -1,4 +1,4 @@ CMake Error at JoinNoVar.cmake:1 \(string\): string sub-command JOIN requires at least two arguments. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/PrependNoArgs-stderr.txt b/Tests/RunCMake/string/PrependNoArgs-stderr.txt index 8d433f9..c8acba8 100644 --- a/Tests/RunCMake/string/PrependNoArgs-stderr.txt +++ b/Tests/RunCMake/string/PrependNoArgs-stderr.txt @@ -1,4 +1,4 @@ CMake Error at PrependNoArgs.cmake:1 \(string\): string sub-command PREPEND requires at least one argument. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/UuidBadNamespace-stderr.txt b/Tests/RunCMake/string/UuidBadNamespace-stderr.txt index cb12903..340189b 100644 --- a/Tests/RunCMake/string/UuidBadNamespace-stderr.txt +++ b/Tests/RunCMake/string/UuidBadNamespace-stderr.txt @@ -1,4 +1,4 @@ CMake Error at UuidBadNamespace.cmake:3 \(string\): string UUID sub-command, malformed NAMESPACE UUID. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/UuidBadType-stderr.txt b/Tests/RunCMake/string/UuidBadType-stderr.txt index 1993c04..2734d86 100644 --- a/Tests/RunCMake/string/UuidBadType-stderr.txt +++ b/Tests/RunCMake/string/UuidBadType-stderr.txt @@ -1,4 +1,4 @@ CMake Error at UuidBadType.cmake:3 \(string\): string UUID sub-command, unknown TYPE 'FOO'. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt b/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt index 0b7cde4..79819a9 100644 --- a/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt +++ b/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt @@ -1,4 +1,4 @@ CMake Error at UuidMissingNameValue.cmake:3 \(string\): string UUID sub-command, NAME requires a value. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt b/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt index dfcfe42..1ffc53f 100644 --- a/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt +++ b/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt @@ -1,4 +1,4 @@ CMake Error at UuidMissingNamespace.cmake:3 \(string\): string UUID sub-command, malformed NAMESPACE UUID. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt b/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt index 86585ad..2a73d3f 100644 --- a/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt +++ b/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt @@ -1,4 +1,4 @@ CMake Error at UuidMissingNamespaceValue.cmake:3 \(string\): string UUID sub-command, NAMESPACE requires a value. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt b/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt index 70252f8..44bd479 100644 --- a/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt +++ b/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt @@ -1,4 +1,4 @@ CMake Error at UuidMissingTypeValue.cmake:3 \(string\): string UUID sub-command, TYPE requires a value. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/alias_target-stderr.txt b/Tests/RunCMake/target_compile_features/alias_target-stderr.txt index 5ebe170..1658f58 100644 --- a/Tests/RunCMake/target_compile_features/alias_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/alias_target-stderr.txt @@ -1,4 +1,4 @@ CMake Error at alias_target.cmake:[0-9]+ \(target_compile_features\): target_compile_features can not be used on an ALIAS target. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt b/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt index 4f707c7..5b4761c 100644 --- a/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt +++ b/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at cxx_not_enabled.cmake:[0-9]+ \(target_compile_features\): target_compile_features cannot use features from non-enabled language CXX Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt index afad537..f2a1aba 100644 --- a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt @@ -2,4 +2,4 @@ target_compile_features may only set INTERFACE properties on INTERFACE targets Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt index 9917be7..ee57b54 100644 --- a/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt +++ b/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt @@ -1,4 +1,4 @@ CMake Error at invalid_args.cmake:[0-9]+ \(target_compile_features\): target_compile_features called with invalid arguments Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt index 23a8eeb..d6564f4 100644 --- a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt +++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt @@ -2,4 +2,4 @@ CMake Error at invalid_args_on_interface.cmake:[0-9]+ \(target_compile_features\ target_compile_features may only set INTERFACE properties on INTERFACE targets Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt b/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt index 1875d12..07ddd6a 100644 --- a/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt +++ b/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt @@ -5,4 +5,4 @@ CMake Error at no_matching_c_feature.cmake:[0-9]+ \((target_compile_features|mes version 4.8.1. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt index 90d41c9..9392f4b 100644 --- a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt +++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt @@ -5,4 +5,4 @@ CMake Error at no_matching_cxx_feature.cmake:[0-9]+ \((target_compile_features|m version *[.0-9]+\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/no_target-stderr.txt b/Tests/RunCMake/target_compile_features/no_target-stderr.txt index 65974b4..7b62c94 100644 --- a/Tests/RunCMake/target_compile_features/no_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/no_target-stderr.txt @@ -2,4 +2,4 @@ CMake Error at no_target.cmake:[0-9]+ \(target_compile_features\): Cannot specify compile features for target "main" which is not built by this project. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt b/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt index 493c582..8a4055d 100644 --- a/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt +++ b/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt @@ -2,4 +2,4 @@ CMake Error at not_a_c_feature.cmake:[0-9]+ \(target_compile_features\): target_compile_features specified unknown feature "c_not_a_feature" for target "main". Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt index 3dbf0e6..bd7f2c6 100644 --- a/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt +++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt @@ -2,4 +2,4 @@ CMake Error at not_a_cxx_feature.cmake:[0-9]+ \(target_compile_features\): target_compile_features specified unknown feature "cxx_not_a_feature" for target "main". Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt b/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt index c0c2efa..34f1ce2 100644 --- a/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt +++ b/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt @@ -1,4 +1,4 @@ CMake Error at not_enough_args.cmake:[0-9]+ \(target_compile_features\): target_compile_features called with incorrect number of arguments Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_compile_features/utility_target-stderr.txt b/Tests/RunCMake/target_compile_features/utility_target-stderr.txt index ff03310..0c01377 100644 --- a/Tests/RunCMake/target_compile_features/utility_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/utility_target-stderr.txt @@ -1,4 +1,4 @@ CMake Error at utility_target.cmake:[0-9]+ \(target_compile_features\): target_compile_features called with non-compilable target type Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt index 8e3f315..12c00fb 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt @@ -8,4 +8,4 @@ CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\): \* CMP0023-NEW-2.cmake:10 \(target_link_libraries\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt index 2ef2290..117c806 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt @@ -8,4 +8,4 @@ CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\): \* CMP0023-NEW.cmake:10 \(target_link_libraries\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt index 5147861..7e49d52 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt @@ -13,4 +13,4 @@ CMake Warning \(dev\) at CMP0023-WARN-2.cmake:9 \(target_link_libraries\): \* CMP0023-WARN-2.cmake:8 \(target_link_libraries\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt index a7474fa..df1288e 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt @@ -13,4 +13,4 @@ CMake Warning \(dev\) at CMP0023-WARN.cmake:9 \(target_link_libraries\): \* CMP0023-WARN.cmake:8 \(target_link_libraries\) Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt new file mode 100644 index 0000000..89cd806 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt @@ -0,0 +1 @@ +-- INTERFACE_LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake new file mode 100644 index 0000000..82486c4 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 NEW) +include(CMP0079-iface-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt new file mode 100644 index 0000000..e575e16 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt @@ -0,0 +1 @@ +-- INTERFACE_LINK_LIBRARIES='foo' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake new file mode 100644 index 0000000..e04a2bb --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 OLD) +include(CMP0079-iface-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt new file mode 100644 index 0000000..6dd7d30 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt @@ -0,0 +1,17 @@ +^CMake Warning \(dev\) at CMP0079-iface/CMakeLists.txt:[0-9]+ \(target_link_libraries\): + Policy CMP0079 is not set: target_link_libraries allows use with targets in + other directories. Run "cmake --help-policy CMP0079" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + Target + + top + + is not created in this directory. For compatibility with older versions of + CMake, link library + + foo + + will be looked up in the directory in which the target was created rather + than in this calling directory. +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt new file mode 100644 index 0000000..e575e16 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt @@ -0,0 +1 @@ +-- INTERFACE_LINK_LIBRARIES='foo' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake new file mode 100644 index 0000000..2041893 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake @@ -0,0 +1 @@ +include(CMP0079-iface-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake new file mode 100644 index 0000000..3982ff2 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_executable(top empty.c) +add_subdirectory(CMP0079-iface) +get_property(libs TARGET top PROPERTY INTERFACE_LINK_LIBRARIES) +message(STATUS "INTERFACE_LINK_LIBRARIES='${libs}'") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt new file mode 100644 index 0000000..4b15b32 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt @@ -0,0 +1 @@ +target_link_libraries(top INTERFACE foo) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt new file mode 100644 index 0000000..8ef35c1 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0079-link-NEW-bogus.cmake:[0-9]+ \(add_executable\): + Target "top" links to target "foo::@<0xdeadbeef>" but the target was not + found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or + an ALIAS target is missing\? +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake new file mode 100644 index 0000000..8622f14 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0028 NEW) +cmake_policy(SET CMP0079 NEW) +enable_language(C) + +add_executable(top empty.c) +set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "foo::@<0xdeadbeef>") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt new file mode 100644 index 0000000..84b30bd --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt @@ -0,0 +1 @@ +-- LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake new file mode 100644 index 0000000..72e4574 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 NEW) +include(CMP0079-link-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt new file mode 100644 index 0000000..0b4c4c6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\): + Attempt to add link library "foo" to target "top" which is not built in + this directory. + + This is allowed only when policy CMP0079 is set to NEW.$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake new file mode 100644 index 0000000..caa7231 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 OLD) +include(CMP0079-link-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt new file mode 100644 index 0000000..0b4c4c6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\): + Attempt to add link library "foo" to target "top" which is not built in + this directory. + + This is allowed only when policy CMP0079 is set to NEW.$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake new file mode 100644 index 0000000..e83818a --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake @@ -0,0 +1 @@ +include(CMP0079-link-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake new file mode 100644 index 0000000..4f9454f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_executable(top empty.c) +add_subdirectory(CMP0079-link) +get_property(libs TARGET top PROPERTY LINK_LIBRARIES) +message(STATUS "LINK_LIBRARIES='${libs}'") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt new file mode 100644 index 0000000..8b2b3c9 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt @@ -0,0 +1 @@ +target_link_libraries(top PUBLIC foo) diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt index 12cd3c7..8f85fbf 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) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt index c6237f4..5b0caf7 100644 --- a/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt @@ -2,4 +2,4 @@ CMake Error at MixedSignature.cmake:6 \(target_link_libraries\): The INTERFACE, PUBLIC or PRIVATE option must appear as the second argument, just after the target name. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 97b0888..a041d6d 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -4,11 +4,17 @@ run_cmake(CMP0023-WARN) run_cmake(CMP0023-NEW) run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) +run_cmake(CMP0079-iface-WARN) +run_cmake(CMP0079-iface-OLD) +run_cmake(CMP0079-iface-NEW) +run_cmake(CMP0079-link-WARN) +run_cmake(CMP0079-link-OLD) +run_cmake(CMP0079-link-NEW) +run_cmake(CMP0079-link-NEW-bogus) run_cmake(ImportedTarget) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) -run_cmake(SubDirTarget) run_cmake(SharedDepNotTarget) run_cmake(StaticPrivateDepNotExported) run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt deleted file mode 100644 index 5cd1f23..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\): - Attempt to add link library "m" to target "subexe" which is not built in - this directory. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake deleted file mode 100644 index 32431ce..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake +++ /dev/null @@ -1,3 +0,0 @@ -enable_language(C) -add_subdirectory(SubDirTarget) -target_link_libraries(subexe m) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt deleted file mode 100644 index b0b2380..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_executable(subexe ../empty.c) diff --git a/Tests/RunCMake/target_link_options/CMakeLists.txt b/Tests/RunCMake/target_link_options/CMakeLists.txt new file mode 100644 index 0000000..14ef56e --- /dev/null +++ b/Tests/RunCMake/target_link_options/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.11) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake new file mode 100644 index 0000000..1af8f13 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake @@ -0,0 +1,15 @@ + +if (actual_stdout MATCHES "LINKER:") + set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.") + return() +endif() + +if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt") + set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.") + return() +endif() +file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag) + +if (NOT actual_stdout MATCHES "${linker_flag}") + set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake new file mode 100644 index 0000000..b344867 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake @@ -0,0 +1,49 @@ + +enable_language(C) + +add_executable(dump dump.c) + +# ensure no temp file will be used +string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") +string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") + + +# Use LINKER alone +add_library(linker SHARED LinkOptionsLib.c) +target_link_options(linker PRIVATE "LINKER:-foo,bar") + +# use LAUNCH facility to dump linker command +set_property(TARGET linker PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") + +add_dependencies (linker dump) + + +# Use LINKER with SHELL +add_library(linker_shell SHARED LinkOptionsLib.c) +target_link_options(linker_shell PRIVATE "LINKER:SHELL:-foo bar") + +# use LAUNCH facility to dump linker command +set_property(TARGET linker_shell PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") + +add_dependencies (linker_shell dump) + + +# generate reference for LINKER flag +if (CMAKE_C_LINKER_WRAPPER_FLAG) + set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG}) + list(GET linker_flag -1 linker_space) + if (linker_space STREQUAL " ") + list(REMOVE_AT linker_flag -1) + else() + set(linker_space) + endif() + list (JOIN linker_flag " " linker_flag) + if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP) + string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar") + else() + set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar") + endif() +else() + set(linker_flag "-foo bar") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}") diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake new file mode 100644 index 0000000..7799506 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_PRIVATE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_PRIVATE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_INTERFACE") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected 'BADFLAG_INTERFACE'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake new file mode 100644 index 0000000..6c5ffdb --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake new file mode 100644 index 0000000..6c5ffdb --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake new file mode 100644 index 0000000..b68e451 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake @@ -0,0 +1,7 @@ + +if (actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Found 'BADFLAG_RELEASE' which was not expected.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake new file mode 100644 index 0000000..bb04841 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake @@ -0,0 +1,55 @@ + +enable_language(C) + +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +# basic configuration +add_library(LinkOptions SHARED LinkOptionsLib.c) +target_link_options(LinkOptions + PRIVATE ${pre}BADFLAG_PRIVATE${obj} + INTERFACE ${pre}BADFLAG_INTERFACE${obj}) + + +# INTERFACE_LINK_OPTIONS +add_library(LinkOptions_producer SHARED LinkOptionsLib.c) +target_link_options(LinkOptions_producer + INTERFACE ${pre}BADFLAG_INTERFACE${obj}) + +add_executable(LinkOptions_consumer LinkOptionsExe.c) +target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer) + + +# static library with INTERFACE_LINK_OPTIONS +add_library(LinkOptions_producer_static STATIC LinkOptionsLib.c) +target_link_options(LinkOptions_producer_static + INTERFACE ${pre}BADFLAG_INTERFACE${obj}) + +add_executable(LinkOptions_consumer_static LinkOptionsExe.c) +target_link_libraries(LinkOptions_consumer_static PRIVATE LinkOptions_producer_static) + + +# static library with generator expression +add_library(LinkOptions_static STATIC LinkOptionsLib.c) +target_link_options(LinkOptions_static PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> + "SHELL:" # produces no options + ) + + +# shared library with generator expression +add_library(LinkOptions_shared SHARED LinkOptionsLib.c) +target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> + "SHELL:" # produces no options + ) + + +# module library with generator expression +add_library(LinkOptions_mod MODULE LinkOptionsLib.c) +target_link_options(LinkOptions_mod PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>) + + +# executable with generator expression +add_executable(LinkOptions_exe LinkOptionsExe.c) +target_link_options(LinkOptions_exe PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>) diff --git a/Tests/RunCMake/target_link_options/LinkOptionsExe.c b/Tests/RunCMake/target_link_options/LinkOptionsExe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/target_link_options/LinkOptionsExe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/target_link_options/LinkOptionsLib.c b/Tests/RunCMake/target_link_options/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/RunCMake/target_link_options/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake new file mode 100644 index 0000000..1eaa5d2 --- /dev/null +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -0,0 +1,41 @@ + +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + # Intel compiler does not reject bad flags or objects! + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(LINK_OPTIONS) + + run_cmake_target(LINK_OPTIONS basic LinkOptions) + run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer) + run_cmake_target(LINK_OPTIONS interface-static LinkOptions_consumer_static) + run_cmake_target(LINK_OPTIONS static LinkOptions_static --config Release) + run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) + run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) + run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) +endif() + +run_cmake(bad_SHELL_usage) + +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(LINKER_expansion) + + run_cmake_target(LINKER_expansion LINKER linker) + run_cmake_target(LINKER_expansion LINKER_SHELL linker_shell) +endif() diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt new file mode 100644 index 0000000..bffd80a --- /dev/null +++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at bad_SHELL_usage.cmake:4 \(add_library\): + 'SHELL:' prefix is not supported as part of 'LINKER:' arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:5 \(include\) diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake new file mode 100644 index 0000000..b0adf19 --- /dev/null +++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(example SHARED LinkOptionsLib.c) +target_link_options(example PRIVATE "LINKER:-foo,SHELL:-bar") diff --git a/Tests/RunCMake/target_link_options/dump.c b/Tests/RunCMake/target_link_options/dump.c new file mode 100644 index 0000000..8baa313 --- /dev/null +++ b/Tests/RunCMake/target_link_options/dump.c @@ -0,0 +1,13 @@ + +#include "stdio.h" + +int main(int argc, char* argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + printf("%s ", argv[i]); + printf("\n"); + + return 0; +} diff --git a/Tests/RunCMake/try_compile/CMP0056-stderr.txt b/Tests/RunCMake/try_compile/CMP0056-stderr.txt index 5c1f0e4..de44205 100644 --- a/Tests/RunCMake/try_compile/CMP0056-stderr.txt +++ b/Tests/RunCMake/try_compile/CMP0056-stderr.txt @@ -10,4 +10,15 @@ CMake Warning \(dev\) at CMP0056.cmake:[0-9]+ \(try_compile\): caller link flags \(e.g. CMAKE_EXE_LINKER_FLAGS\) in the test project. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Deprecation Warning at CMP0056.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0056 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\)$ |