diff options
Diffstat (limited to 'Tests/RunCMake')
136 files changed, 1226 insertions, 171 deletions
diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake index ef33012..87b0de0 100644 --- a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake +++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake @@ -11,7 +11,7 @@ endif() ]]) endif() -file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " set(check_pairs \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/test.manifest\" ) diff --git a/Tests/RunCMake/BuildDepends/C-Exe.cmake b/Tests/RunCMake/BuildDepends/C-Exe.cmake index 5057ca9..ad5cd4d 100644 --- a/Tests/RunCMake/BuildDepends/C-Exe.cmake +++ b/Tests/RunCMake/BuildDepends/C-Exe.cmake @@ -2,7 +2,7 @@ enable_language(C) add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.c) -file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " set(check_pairs \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\" ) diff --git a/Tests/RunCMake/BuildDepends/Custom-Always.cmake b/Tests/RunCMake/BuildDepends/Custom-Always.cmake index d412708..c7e7fb0 100644 --- a/Tests/RunCMake/BuildDepends/Custom-Always.cmake +++ b/Tests/RunCMake/BuildDepends/Custom-Always.cmake @@ -16,7 +16,7 @@ add_custom_command( add_custom_target(drive ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/after-always) -file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " set(check_pairs \"${CMAKE_CURRENT_BINARY_DIR}/always-updated|${CMAKE_CURRENT_BINARY_DIR}/before-always\" \"${CMAKE_CURRENT_BINARY_DIR}/after-always|${CMAKE_CURRENT_BINARY_DIR}/always-updated\" diff --git a/Tests/RunCMake/BuildDepends/Custom-Symbolic-and-Byproduct.cmake b/Tests/RunCMake/BuildDepends/Custom-Symbolic-and-Byproduct.cmake index 687c827..1e1f22a 100644 --- a/Tests/RunCMake/BuildDepends/Custom-Symbolic-and-Byproduct.cmake +++ b/Tests/RunCMake/BuildDepends/Custom-Symbolic-and-Byproduct.cmake @@ -16,7 +16,7 @@ add_custom_command( add_custom_target(drive ALL DEPENDS use-byproduct) add_dependencies(drive produce) -file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " if (check_step EQUAL 1) set(check_pairs \"${CMAKE_CURRENT_BINARY_DIR}/use-byproduct|${CMAKE_CURRENT_BINARY_DIR}/gen-byproduct-stamp\" diff --git a/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake index 0f92e0e..8b2ae78 100644 --- a/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake +++ b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake @@ -6,7 +6,7 @@ add_custom_command( add_custom_target(generate ALL DEPENDS output.cxx) set_property(TARGET generate PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}) -file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " set(check_pairs \"${CMAKE_CURRENT_BINARY_DIR}/output.cxx|${CMAKE_CURRENT_BINARY_DIR}/MakeCustomIncludes.h\" ) diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake index add9aeb..af6ad86 100644 --- a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake @@ -3,7 +3,7 @@ get_filename_component(include_dir "${CMAKE_BINARY_DIR}" PATH) include_directories("${include_dir}") add_executable(MakeInProjectOnly MakeInProjectOnly.c) set(CMAKE_DEPENDS_IN_PROJECT_ONLY 1) -file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " if (check_step EQUAL 1) set(check_pairs \"$<TARGET_FILE:MakeInProjectOnly>|${include_dir}/MakeInProjectOnly.h\" diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt index f672285..5d39214 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt @@ -4,13 +4,13 @@ CMake Warning \(dev\) in CMakeLists.txt: cmake_policy command to set the policy and suppress this warning. Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from - its LINK_INTERFACE_LIBRARIES properties. + its LINK_INTERFACE_LIBRARIES(_DEBUG)? properties. INTERFACE_LINK_LIBRARIES: foo - LINK_INTERFACE_LIBRARIES: + LINK_INTERFACE_LIBRARIES(_DEBUG)?: bat diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake index 11b4e22..03223e8 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake @@ -5,7 +5,9 @@ add_library(foo SHARED empty_vs6_1.cpp) add_library(bar SHARED empty_vs6_2.cpp) add_library(bat SHARED empty_vs6_3.cpp) target_link_libraries(bar LINK_PUBLIC foo) +# Replace the compatibility values set by target_link_libraries set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat) +set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES_DEBUG bat) add_library(user SHARED empty.cpp) target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake.cmake b/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake.cmake index 23fae13..6968c8b 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake.cmake +++ b/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake.cmake @@ -1,6 +1,6 @@ cmake_policy(SET CMP0069 NEW) -set(_CMAKE_IPO_SUPPORTED_BY_CMAKE NO) +set(_CMAKE_CXX_IPO_SUPPORTED_BY_CMAKE NO) add_executable(foo main.cpp) set_target_properties(foo PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) diff --git a/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler.cmake b/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler.cmake index 24b409a..ecb197b 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler.cmake +++ b/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler.cmake @@ -1,7 +1,7 @@ cmake_policy(SET CMP0069 NEW) -set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) -set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) +set(_CMAKE_CXX_IPO_SUPPORTED_BY_CMAKE YES) +set(_CMAKE_CXX_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) add_executable(foo main.cpp) set_target_properties(foo PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) diff --git a/Tests/RunCMake/CMP0069/CMP0069-NEW-generator.cmake b/Tests/RunCMake/CMP0069/CMP0069-NEW-generator.cmake index df2a888..80d4e15 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-NEW-generator.cmake +++ b/Tests/RunCMake/CMP0069/CMP0069-NEW-generator.cmake @@ -1,7 +1,7 @@ cmake_policy(SET CMP0069 NEW) -set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) -set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) +set(_CMAKE_CXX_IPO_SUPPORTED_BY_CMAKE YES) +set(_CMAKE_CXX_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) add_executable(foo main.cpp) set_target_properties(foo PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) diff --git a/Tests/RunCMake/CMP0069/CMP0069-WARN.cmake b/Tests/RunCMake/CMP0069/CMP0069-WARN.cmake index 0e3e670..2049c9e 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-WARN.cmake +++ b/Tests/RunCMake/CMP0069/CMP0069-WARN.cmake @@ -1,4 +1,4 @@ -set(_CMAKE_IPO_LEGACY_BEHAVIOR NO) +set(_CMAKE_CXX_IPO_LEGACY_BEHAVIOR NO) add_executable(foo main.cpp) set_target_properties(foo PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) diff --git a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake index 61ba458..f44f840 100644 --- a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake @@ -5,7 +5,6 @@ run_cmake(CMP0069-NEW-cmake) run_cmake(CMP0069-NEW-compiler) run_cmake(CMP0069-WARN) -string(COMPARE EQUAL "${RunCMake_GENERATOR}" "Xcode" is_xcode) -if(is_xcode OR RunCMake_GENERATOR MATCHES "^Visual Studio ") +if(RunCMake_GENERATOR MATCHES "^Visual Studio ") run_cmake(CMP0069-NEW-generator) endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 75d4e29..0369fa4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -147,7 +147,7 @@ endif() add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) -add_RunCMake_test(GNUInstallDirs) +add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) @@ -181,8 +181,10 @@ add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) add_RunCMake_test(add_subdirectory) add_RunCMake_test(build_command) +add_executable(exit_code exit_code.c) +set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>) if(NOT CMake_TEST_EXTERNAL_CMAKE) - set(execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>) + list(APPEND execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>) endif() add_RunCMake_test(execute_process) add_RunCMake_test(export) @@ -341,6 +343,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>) + if(DEFINED CMake_TEST_CUDA) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) + endif() add_RunCMake_test(CompilerLauncher) endif() diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake index ce039f5..99d3155 100644 --- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake +++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake @@ -33,7 +33,7 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - findExpectedFile("${FILE_NO}" "file_") + findExpectedFile("${FILE_NO}" "file_" "glob_expr_") # component and monolithic packages differ for some reason by either having # package filename prefix in path or not diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 8ca7126..faf151a 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -5,7 +5,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" true "COMPONENT") +run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") run_cpack_test(DEBUGINFO "RPM" true "COMPONENT") run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") run_cpack_test(DIST "RPM" false "MONOLITHIC") @@ -24,5 +24,6 @@ run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_co 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") run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake index 08224d3..68b1eab 100644 --- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -35,7 +35,7 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - findExpectedFile("${FILE_NO}" "file_") + findExpectedFile("${FILE_NO}" "file_" "glob_expr_") get_filename_component(prefix_ "${file_}" NAME) # NAME_WE removes everything after the dot and dot is in version so replace instead diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 59751a7..470ebf7 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR) -function(findExpectedFile FILE_NO RESULT_VAR) +function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR) if(NOT DEFINED EXPECTED_FILE_${FILE_NO}) # explicit file name regex was not provided - construct one from other data # set defaults if parameters are not provided if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_NAME) @@ -21,6 +21,7 @@ function(findExpectedFile FILE_NO RESULT_VAR) file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}") set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE) + set(${GLOBING_EXPR_VAR} "${EXPECTED_FILE_${FILE_NO}}" PARENT_SCOPE) endfunction() include("${config_file}") @@ -39,7 +40,8 @@ include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake") # check that expected generated files exist and contain expected content if(NOT EXPECTED_FILES_COUNT EQUAL 0) foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) - findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}") + findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}" + "EXPECTED_FILE_${file_no_}") list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}") list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_) diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake index ae5f0af..5cb280c 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake @@ -9,4 +9,7 @@ set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") string(TOLOWER "${GENERATOR_TYPE}" file_extension_) set(EXPECTED_FILE_3 "pkg_3_abc.${file_extension_}") +elseif(GENERATOR_TYPE STREQUAL "TGZ") + set(EXPECTED_FILE_2 "second.tar.gz") + set(EXPECTED_FILE_3 "pkg_3_abc.tar.gz") endif() diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake index 0c2b37b..4c20e41 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake @@ -7,6 +7,9 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second") string(TOLOWER "${GENERATOR_TYPE}" file_extension_) set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_3_FILE_NAME "pkg_3_abc.${file_extension_}") +elseif(GENERATOR_TYPE STREQUAL "TGZ") + set(CPACK_ARCHIVE_PKG_2_FILE_NAME "second") + set(CPACK_ARCHIVE_PKG_3_FILE_NAME "pkg_3_abc") endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake new file mode 100644 index 0000000..05be748 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake @@ -0,0 +1,13 @@ +set(EXPECTED_FILES_COUNT "1") + +set(EXPECTED_FILE_CONTENT_1_LIST + "/usr" + "/usr/empty_dir" + "/usr/non_empty_dir" + "/usr/non_empty_dir/CMakeLists.txt" + "/usr/symlink_to_empty_dir" + "/usr/symlink_to_non_empty_dir") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILE_1_COMPONENT "links") +endif() diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake new file mode 100644 index 0000000..f3df46b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake @@ -0,0 +1,5 @@ +function(get_test_prerequirements found_var config_file) + if(UNIX) # limit test to platforms that support symlinks + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake new file mode 100644 index 0000000..0632319 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake @@ -0,0 +1,26 @@ +set(whitespaces "[\\t\\n\\r ]*") + +####################### +# verify generated symbolic links +####################### +file(GLOB_RECURSE symlink_files RELATIVE "${bin_dir}" "${bin_dir}/*/symlink_*") + +foreach(check_symlink IN LISTS symlink_files) + get_filename_component(symlink_name "${check_symlink}" NAME) + execute_process(COMMAND ls -la "${check_symlink}" + WORKING_DIRECTORY "${bin_dir}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if("${symlink_name}" STREQUAL "symlink_to_empty_dir") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}empty_dir$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_to_non_empty_dir") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}non_empty_dir$" check_symlink "${SYMLINK_POINT_}") + else() + message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'") + endif() + + if(NOT check_symlink) + message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'") + endif() +endforeach() diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake new file mode 100644 index 0000000..fef765c --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake @@ -0,0 +1,14 @@ +install(DIRECTORY DESTINATION empty_dir COMPONENT links) +install(FILES CMakeLists.txt DESTINATION non_empty_dir COMPONENT links) + +# test symbolic link to an empty dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink empty_dir symlink_to_empty_dir) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_empty_dir DESTINATION "." COMPONENT links) + +# test symbolic link to a non empty dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink non_empty_dir symlink_to_non_empty_dir) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_empty_dir DESTINATION "." COMPONENT links) + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL links) +endif() diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake index 1a373b9..8fc1218 100644 --- a/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake +++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake @@ -1,6 +1,6 @@ add_executable(mytest test.cpp) -file(GENERATE OUTPUT runtest_info.cmake CONTENT [[ +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtest_info.cmake CONTENT [[ set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") ]]) diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake index 77fe8ed..b23d3c7 100644 --- a/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake +++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake @@ -6,7 +6,7 @@ foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) OUTPUT_NAME_${UPPER_CONFIG} bar_${CONFIG}) endforeach() -file(GENERATE OUTPUT runtest_info_$<CONFIG>.cmake CONTENT [[ +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtest_info_$<CONFIG>.cmake CONTENT [[ set(CPACK_BUILD_CONFIG "$<CONFIG>") set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") ]]) diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake index 2e1d465..2001d9f 100644 --- a/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake +++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake @@ -1,6 +1,6 @@ add_executable(mytest test.cpp) -file(GENERATE OUTPUT runtest_info.cmake CONTENT [[ +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtest_info.cmake CONTENT [[ set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") ]]) diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake index 588a75d..e145569 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 |Xcode$)") +if(RunCMake_GENERATOR MATCHES "^Visual Studio ") run_cmake(not-supported-by-generator) endif() diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt index f63f30f..c49a024 100644 --- a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): - IPO is not supported \(CMake doesn't support IPO for current compiler\)\. + IPO is not supported \(CMake doesn't support IPO for current C compiler\)\. Call Stack \(most recent call first\): .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) not-supported-by-cmake\.cmake:[0-9]+ \(check_ipo_supported\) diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake index 6f61f7e..e583dd0 100644 --- a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake @@ -1,3 +1,3 @@ project(${RunCMake_TEST} LANGUAGES C) -set(_CMAKE_IPO_SUPPORTED_BY_CMAKE NO) +set(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE NO) check_ipo_supported() diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt index 5f5f410..675c2d3 100644 --- a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): - IPO is not supported \(Compiler doesn't support IPO\)\. + IPO is not supported \(C compiler doesn't support IPO\)\. Call Stack \(most recent call first\): .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) not-supported-by-compiler\.cmake:[0-9]+ \(check_ipo_supported\) diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake index 652cfd5..86c8f8d 100644 --- a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake @@ -1,4 +1,4 @@ project(${RunCMake_TEST} LANGUAGES C) -set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) -set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) +set(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE YES) +set(_CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) check_ipo_supported() diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake index dc0fa09..c32af6e 100644 --- a/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake @@ -1,6 +1,6 @@ project(${RunCMake_TEST} LANGUAGES C) -set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) -set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) +set(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE YES) +set(_CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) check_ipo_supported() diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake index 2d14a9e..b24a680 100644 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake @@ -6,9 +6,10 @@ add_library(empty3 INTERFACE) target_compile_features(empty3 INTERFACE cxx_std_11) target_link_libraries(empty1 - # When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the + # When starting, $<COMPILE_FEATURES:cxx_std_11> is '0', so 'freeze' the # CXX_STANDARD at 98 during computation. - $<$<COMPILE_FEATURES:cxx_auto_type>:empty2> + $<$<COMPILE_FEATURES:cxx_std_11>:empty2> + # This would add cxx_std_11, but that would require CXX_STANDARD = 11, # which is not allowed after freeze. Report an error. empty3 diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake index 8dc627d..5a70da2 100644 --- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -1,3 +1,4 @@ +cmake_policy(SET CMP0057 NEW) include(RunCMake) run_cmake(NotAFeature) @@ -28,13 +29,13 @@ endif() if (NOT CXX_FEATURES) run_cmake(NoSupportedCxxFeatures) run_cmake(NoSupportedCxxFeaturesGenex) -else() +elseif (cxx_std_98 IN_LIST CXX_FEATURES AND cxx_std_11 IN_LIST CXX_FEATURES) if(CXX_STANDARD_DEFAULT EQUAL 98) run_cmake(LinkImplementationFeatureCycle) endif() run_cmake(LinkImplementationFeatureCycleSolved) - if (";${CXX_FEATURES};" MATCHES ";cxx_final;") + if (cxx_final IN_LIST CXX_FEATURES) set(RunCMake_TEST_OPTIONS "-DHAVE_FINAL=1") endif() run_cmake(NonValidTarget1) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CUDA-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CUDA-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-launch.cmake b/Tests/RunCMake/CompilerLauncher/CUDA-launch.cmake new file mode 100644 index 0000000..6b4b816 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CUDA.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA.cmake b/Tests/RunCMake/CompilerLauncher/CUDA.cmake new file mode 100644 index 0000000..fe5560b --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA.cmake @@ -0,0 +1,4 @@ +enable_language(CUDA) +set(CMAKE_CUDA_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cu) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index 5884d5c..ab26512 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -15,9 +15,14 @@ function(run_compiler_launcher lang) run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) endfunction() -run_compiler_launcher(C) -run_compiler_launcher(CXX) -if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") - run_compiler_launcher(C-launch) - run_compiler_launcher(CXX-launch) +set(langs C CXX) +if(CMake_TEST_CUDA) + list(APPEND langs CUDA) endif() + +foreach(lang ${langs}) + run_compiler_launcher(${lang}) + if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_compiler_launcher(${lang}-launch) + endif() +endforeach() diff --git a/Tests/RunCMake/CompilerLauncher/main.cu b/Tests/RunCMake/CompilerLauncher/main.cu new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.cu @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/File_Generate/CMP0070-NEW-check.cmake b/Tests/RunCMake/File_Generate/CMP0070-NEW-check.cmake new file mode 100644 index 0000000..05ec26e --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-NEW-check.cmake @@ -0,0 +1,13 @@ +foreach(f + "${RunCMake_TEST_SOURCE_DIR}/relative-input-NEW.txt" + "${RunCMake_TEST_BINARY_DIR}/relative-output-NEW.txt" + ) + if(EXISTS "${f}") + file(READ "${f}" content) + if(NOT content MATCHES "^relative-input-NEW[\r\n]*$") + string(APPEND RunCMake_TEST_FAILED "File\n ${f}\ndoes not have expected content.\n") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "Missing\n ${f}\n") + endif() +endforeach() diff --git a/Tests/RunCMake/File_Generate/CMP0070-NEW.cmake b/Tests/RunCMake/File_Generate/CMP0070-NEW.cmake new file mode 100644 index 0000000..1a03822 --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT relative-output-NEW.txt INPUT relative-input-NEW.txt) diff --git a/Tests/RunCMake/File_Generate/CMP0070-OLD-check.cmake b/Tests/RunCMake/File_Generate/CMP0070-OLD-check.cmake new file mode 100644 index 0000000..a71d822 --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-OLD-check.cmake @@ -0,0 +1,13 @@ +foreach(f + "${RunCMake_TEST_BINARY_DIR}/relative-input-OLD.txt" + "${RunCMake_TEST_BINARY_DIR}/relative-output-OLD.txt" + ) + if(EXISTS "${f}") + file(READ "${f}" content) + if(NOT content MATCHES "^relative-input-OLD[\r\n]*$") + string(APPEND RunCMake_TEST_FAILED "File\n ${f}\ndoes not have expected content.\n") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "Missing\n ${f}\n") + endif() +endforeach() diff --git a/Tests/RunCMake/File_Generate/CMP0070-OLD.cmake b/Tests/RunCMake/File_Generate/CMP0070-OLD.cmake new file mode 100644 index 0000000..0fb47cd --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-OLD.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 OLD) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/relative-input-OLD.txt "relative-input-OLD\n") +file(GENERATE OUTPUT relative-output-OLD.txt INPUT relative-input-OLD.txt) diff --git a/Tests/RunCMake/File_Generate/CMP0070-WARN-check.cmake b/Tests/RunCMake/File_Generate/CMP0070-WARN-check.cmake new file mode 100644 index 0000000..1488df0 --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-WARN-check.cmake @@ -0,0 +1,13 @@ +foreach(f + "${RunCMake_TEST_BINARY_DIR}/relative-input-WARN.txt" + "${RunCMake_TEST_BINARY_DIR}/relative-output-WARN.txt" + ) + if(EXISTS "${f}") + file(READ "${f}" content) + if(NOT content MATCHES "^relative-input-WARN[\r\n]*$") + string(APPEND RunCMake_TEST_FAILED "File\n ${f}\ndoes not have expected content.\n") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "Missing\n ${f}\n") + endif() +endforeach() diff --git a/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt b/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt new file mode 100644 index 0000000..dbabaa9 --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt @@ -0,0 +1,27 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0070 is not set: Define file\(GENERATE\) behavior for relative + paths. Run "cmake --help-policy CMP0070" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + file\(GENERATE\) given relative INPUT path: + + relative-input-WARN.txt + + This is not defined behavior unless CMP0070 is set to NEW. For + compatibility with older versions of CMake, the previous undefined behavior + will be used. +This warning is for project developers. Use -Wno-dev to suppress it.( ++ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0070 is not set: Define file\(GENERATE\) behavior for relative + paths. Run "cmake --help-policy CMP0070" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + file\(GENERATE\) given relative OUTPUT path: + + relative-output-WARN.txt + + This is not defined behavior unless CMP0070 is set to NEW. For + compatibility with older versions of CMake, the previous undefined behavior + will be used. +This warning is for project developers. Use -Wno-dev to suppress it.)+$ diff --git a/Tests/RunCMake/File_Generate/CMP0070-WARN.cmake b/Tests/RunCMake/File_Generate/CMP0070-WARN.cmake new file mode 100644 index 0000000..ccb0452 --- /dev/null +++ b/Tests/RunCMake/File_Generate/CMP0070-WARN.cmake @@ -0,0 +1,2 @@ +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/relative-input-WARN.txt "relative-input-WARN\n") +file(GENERATE OUTPUT relative-output-WARN.txt INPUT relative-input-WARN.txt) diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake index e2b081d..59ccf19 100644 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -7,6 +7,6 @@ target_compile_options(empty ) file(GENERATE - OUTPUT opts-$<COMPILE_LANGUAGE>.txt + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opts-$<COMPILE_LANGUAGE>.txt CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n" ) diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake index 109d60e..541d86d 100644 --- a/Tests/RunCMake/File_Generate/ReRunCMake.cmake +++ b/Tests/RunCMake/File_Generate/ReRunCMake.cmake @@ -1,5 +1,5 @@ file(GENERATE - OUTPUT output_file.txt + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output_file.txt" INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt" ) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 82e903d..b660463 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,5 +1,9 @@ include(RunCMake) +run_cmake(CMP0070-NEW) +run_cmake(CMP0070-OLD) +run_cmake(CMP0070-WARN) + run_cmake(CommandConflict) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") run_cmake(OutputConflict) diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake b/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake index d1d832a..bb36a4c 100644 --- a/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake +++ b/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake @@ -1,5 +1,5 @@ file(GENERATE - OUTPUT output_file.txt + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output_file.txt CONTENT "123" ) diff --git a/Tests/RunCMake/File_Generate/relative-input-NEW.txt b/Tests/RunCMake/File_Generate/relative-input-NEW.txt new file mode 100644 index 0000000..7293e90 --- /dev/null +++ b/Tests/RunCMake/File_Generate/relative-input-NEW.txt @@ -0,0 +1 @@ +relative-input-NEW diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake index 3d62a8a..4f42459 100644 --- a/Tests/RunCMake/Framework/FrameworkLayout.cmake +++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake @@ -22,4 +22,4 @@ set_source_files_properties(some.txt PROPERTIES MACOSX_PACKAGE_LOCATION somedir) add_custom_command(TARGET Framework POST_BUILD COMMAND /usr/bin/file $<TARGET_FILE:Framework>) -file(GENERATE OUTPUT FrameworkName.cmake CONTENT "set(framework-dir \"$<TARGET_BUNDLE_DIR:Framework>\")\n") +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkName.cmake CONTENT "set(framework-dir \"$<TARGET_BUNDLE_DIR:Framework>\")\n") diff --git a/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt index 8d90f5f..f664db9 100644 --- a/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt +++ b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt @@ -1 +1,3 @@ -.*/Framework: Mach-O[^\n]* dynamically linked shared library.* +.*/Framework:( Mach-O universal binary with [^ +]*)? Mach-O[^ +]* dynamically linked shared library.* diff --git a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt index c9f50b6..532cfed 100644 --- a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt +++ b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt @@ -1 +1,2 @@ -.*/Framework: current ar archive random library.* +.*/Framework:( Mach-O universal binary with [^ +]*)? current ar archive random library.* diff --git a/Tests/RunCMake/GNUInstallDirs/Common.cmake b/Tests/RunCMake/GNUInstallDirs/Common.cmake index 5f119af..919cd91 100644 --- a/Tests/RunCMake/GNUInstallDirs/Common.cmake +++ b/Tests/RunCMake/GNUInstallDirs/Common.cmake @@ -1,8 +1,5 @@ set(CMAKE_SIZEOF_VOID_P 8) set(CMAKE_LIBRARY_ARCHITECTURE "arch") -if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") - set(CMAKE_SYSTEM_NAME "OpenBSD-Fake") -endif() include(GNUInstallDirs) set(dirs BINDIR diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-BSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-BSD-stderr.txt new file mode 100644 index 0000000..09ae303 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt-BSD-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Opt' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin' +CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt' +CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include' +CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/info' +CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run/opt/Opt' +CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/man' +CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root-BSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-BSD-stderr.txt new file mode 100644 index 0000000..4be66bc --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root-BSD-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='usr/bin' +CMAKE_INSTALL_DATADIR='usr/share' +CMAKE_INSTALL_DATAROOTDIR='usr/share' +CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' +CMAKE_INSTALL_INCLUDEDIR='usr/include' +CMAKE_INSTALL_INFODIR='usr/info' +CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='usr/libexec' +CMAKE_INSTALL_LOCALEDIR='usr/share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='usr/man' +CMAKE_INSTALL_SBINDIR='usr/sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' +CMAKE_INSTALL_FULL_MANDIR='/usr/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake index f88569a..b544ba6 100644 --- a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -1,6 +1,17 @@ include(RunCMake) -run_cmake(Opt) -run_cmake(Root) -run_cmake(Usr) -run_cmake(UsrLocal) +if(SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$") + set(EXPECT_BSD 1) +endif() + +foreach(case + Opt + Root + Usr + UsrLocal + ) + if(EXPECT_BSD) + set(RunCMake-stderr-file ${case}-BSD-stderr.txt) + endif() + run_cmake(${case}) +endforeach() diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-BSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-BSD-stderr.txt new file mode 100644 index 0000000..3d7b4c8 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr-BSD-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Usr' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='info' +CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' +CMAKE_INSTALL_FULL_MANDIR='/usr/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-BSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-BSD-stderr.txt new file mode 100644 index 0000000..e1425d5 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-BSD-stderr.txt @@ -0,0 +1,30 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' +CMAKE_INSTALL_MANDIR='man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/local/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/local/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/usr/local/var/run' +CMAKE_INSTALL_FULL_MANDIR='/usr/local/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$ diff --git a/Tests/RunCMake/Ninja/CommandConcat.cmake b/Tests/RunCMake/Ninja/CommandConcat.cmake new file mode 100644 index 0000000..790cf9d --- /dev/null +++ b/Tests/RunCMake/Ninja/CommandConcat.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.7) +project(concat_cmd NONE) +set(output1 ${CMAKE_BINARY_DIR}/out1.txt) +set(output2 ${CMAKE_BINARY_DIR}/out2.txt) +file(REMOVE ${output1} ${output2}) +# Check that second command runs if first command contains "||" which has higher precedence than "&&" on Windows +add_custom_target(concat_cmd ALL + COMMAND ${CMAKE_COMMAND} -E echo "Hello || pipe world" && ${CMAKE_COMMAND} -E touch ${output1} || exit 1 + COMMAND ${CMAKE_COMMAND} -E touch ${output2}) +# Check output +add_custom_target(check_output ALL + COMMAND ${CMAKE_COMMAND} -E copy ${output1} ${output1}.copy + COMMAND ${CMAKE_COMMAND} -E copy ${output2} ${output2}.copy) +add_dependencies(check_output concat_cmd) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 8c3bc20..b3720fb 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -40,6 +40,16 @@ run_CMP0058(NEW-by) run_cmake(CustomCommandDepfile) +function(run_CommandConcat) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandConcat-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(CommandConcat) + run_cmake_command(CommandConcat-build ${CMAKE_COMMAND} --build .) +endfunction() +run_CommandConcat() + function(run_SubDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SubDir-build) diff --git a/Tests/RunCMake/TargetObjects/NoTarget.cmake b/Tests/RunCMake/TargetObjects/NoTarget.cmake index 5d7e33e..268577d 100644 --- a/Tests/RunCMake/TargetObjects/NoTarget.cmake +++ b/Tests/RunCMake/TargetObjects/NoTarget.cmake @@ -1,7 +1,7 @@ add_library(iface INTERFACE) target_sources(iface INTERFACE $<TARGET_OBJECTS:NoTarget>) -file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:NoTarget>) -file(GENERATE OUTPUT test_output2 CONTENT $<TARGET_PROPERTY:iface,INTERFACE_SOURCES>) +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output CONTENT $<TARGET_OBJECTS:NoTarget>) +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output2 CONTENT $<TARGET_PROPERTY:iface,INTERFACE_SOURCES>) install(FILES $<TARGET_OBJECTS:NoTarget> DESTINATION objects) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake index 8e5fdd0..3bb3e37 100644 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake +++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake @@ -1,3 +1,3 @@ add_library(StaticLib empty.cpp) -file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:StaticLib>) +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output CONTENT $<TARGET_OBJECTS:StaticLib>) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 3af877f..6e7c2f3 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) run_cmake(VsCSharpCustomTags) +run_cmake(VsCSharpReferenceProps) diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake index 70ea193..9eb4619 100644 --- a/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake +++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake @@ -4,20 +4,31 @@ if(NOT EXISTS "${csProjectFile}") return() endif() -set(tagFound FALSE) +# test VS_CSHARP_* for the following extensions +set(fileExtensions + "cs" + "png" + "jpg" + "xml" + "settings") +# set(tagName "MyCustomTag") set(tagValue "MyCustomValue") file(STRINGS "${csProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *<${tagName}>${tagValue}</${tagName}>") - message(STATUS "foo.csproj has tag ${tagName} with value ${tagValue} defined") - set(tagFound TRUE) + +foreach(e ${fileExtensions}) + string(TOUPPER ${e} eUC) + set(tagFound FALSE) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<${tagName}${eUC}>${tagValue}${eUC}</${tagName}${eUC}>") + message(STATUS "foo.csproj has tag ${tagName}${eUC} with value ${tagValue}${eUC} defined") + set(tagFound TRUE) + endif() + endforeach() + if(NOT tagFound) + set(RunCMake_TEST_FAILED "Source file tag ${tagName}${eUC} with value ${tagValue}${eUC} not found.") + return() endif() endforeach() - -if(NOT tagFound) - set(RunCMake_TEST_FAILED "Source file tag ${tagName} with value ${tagValue} not found.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake index c51e9c3..45766a0 100644 --- a/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake +++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake @@ -1,11 +1,27 @@ enable_language(CSharp) -add_library(foo foo.cs) -set(props_file "${CMAKE_CURRENT_SOURCE_DIR}/my.props") +# test VS_CSHARP_* for the following extensions +set(fileExtensions + "cs" + "png" + "jpg" + "xml" + "settings") +# set(tagName "MyCustomTag") set(tagValue "MyCustomValue") -set_source_files_properties(foo.cs - PROPERTIES - VS_CSHARP_${tagName} "${tagValue}") +set(fileNames) +foreach(e ${fileExtensions}) + set(currentFile "${CMAKE_CURRENT_BINARY_DIR}/foo.${e}") + list(APPEND fileNames ${currentFile}) + execute_process(COMMAND ${CMAKE_COMMAND} -E touch + "${currentFile}") + string(TOUPPER ${e} eUC) + set_source_files_properties("${currentFile}" + PROPERTIES + VS_CSHARP_${tagName}${eUC} "${tagValue}${eUC}") +endforeach() + +add_library(foo ${fileNames}) diff --git a/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake new file mode 100644 index 0000000..8b9bb67 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake @@ -0,0 +1,49 @@ +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() + +set(test1Reference "System") +set(test1Tag "Hello") +set(test1Value "World") + +set(test2Reference "foo2") +set(test2Tag "Hallo") +set(test2Value "Welt") + +set(tag1Found FALSE) +set(ref1Found FALSE) + +file(STRINGS "${csProjectFile}" lines) + +foreach(i 1 2) + set(testReference "${test${i}Reference}") + set(testTag "${test${i}Tag}") + set(testValue "${test${i}Value}") + foreach(line IN LISTS lines) + if(line MATCHES "^ *<(Project|)Reference .*>$") + set(validTag FALSE) + if(line MATCHES "^ *<(Project|)Reference .*\".*${testReference}.*\".*>$") + set(validTag TRUE) + message(STATUS "foo.csproj is using reference ${testReference}") + set(ref${i}Found TRUE) + endif() + endif() + if(line MATCHES "^ *<${testTag}>${testValue}</${testTag}>$") + if(validTag) + message(STATUS "foo.csproj reference ${testReference} has tag ${testTag}") + set(tag${i}Found TRUE) + else() + message(STATUS "tag ${testTag} found in wrong place!") + set(tag${i}Found FALSE) + endif() + endif() + endforeach() +endforeach() + +if(NOT tag1Found OR NOT ref1Found OR + NOT tag2Found OR NOT ref2Found) + set(RunCMake_TEST_FAILED "Custom reference XML tag not found.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake new file mode 100644 index 0000000..2af1756 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake @@ -0,0 +1,19 @@ +enable_language(CSharp) +add_library(foo foo.cs) +add_library(foo2 foo.cs) + +set(test1Reference "System") +set(test1Tag "Hello") +set(test1Value "World") + +set(test2Reference "foo2") +set(test2Tag "Hallo") +set(test2Value "Welt") + +target_link_libraries(foo foo2) + +set_target_properties(foo PROPERTIES + VS_DOTNET_REFERENCES "${test1Reference};Blubb" + VS_DOTNET_REFERENCEPROP_${test1Reference}_TAG_${test1Tag} ${test1Value} + VS_DOTNET_REFERENCEPROP_${test2Reference}_TAG_${test2Tag} ${test2Value} + ) diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt new file mode 100644 index 0000000..4825d7a --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt @@ -0,0 +1,3 @@ + *Error when uploading file: .*/Configure.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/CDashSubmitHeaders-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stdout.txt new file mode 100644 index 0000000..3973872 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stdout.txt @@ -0,0 +1 @@ +Add HTTP Header: "Authorization: Bearer asdf" diff --git a/Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt new file mode 100644 index 0000000..706e1f5 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt @@ -0,0 +1 @@ +Error in HttpRequest diff --git a/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt new file mode 100644 index 0000000..3973872 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt @@ -0,0 +1 @@ +Add HTTP Header: "Authorization: Bearer asdf" diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake index e104f8a..b5d90d2 100644 --- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake @@ -25,6 +25,8 @@ 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(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf") +run_ctest_submit(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf") function(run_ctest_CDashUploadFTP) set(CASE_DROP_METHOD ftp) diff --git a/Tests/RunCMake/execute_process/ExitValues-stdout.txt b/Tests/RunCMake/execute_process/ExitValues-stdout.txt new file mode 100644 index 0000000..3bcaf46 --- /dev/null +++ b/Tests/RunCMake/execute_process/ExitValues-stdout.txt @@ -0,0 +1,14 @@ +^-- 1 - 1 RESULT_VARIABLE: 0 +-- 1 - 2 RESULT_VARIABLE: [^0].* +-- 2 - 1 RESULT_VARIABLE: 0 +-- 2 - 1 RESULTS_VARIABLE: 0 +-- 2 - 2 RESULT_VARIABLE: [^0].* +-- 2 - 2 RESULTS_VARIABLE: [^0].* +-- 3 - 1 RESULTS_VARIABLE: 0 +-- 3 - 2 RESULTS_VARIABLE: [^0].* +-- 4 - 1 RESULT_VARIABLE: 0 +-- 4 - 1 RESULTS_VARIABLE: [^0].*;0;[^0].*;0;[^0].*;0 +-- 4 - 1 RESULTS_VARIABLE_LENGTH: 6 +-- 5 - 1 RESULT_VARIABLE: [^0].* +-- 5 - 1 RESULTS_VARIABLE: 0;0;[^0].* +-- 5 - 1 RESULTS_VARIABLE_LENGTH: 3$ diff --git a/Tests/RunCMake/execute_process/ExitValues.cmake b/Tests/RunCMake/execute_process/ExitValues.cmake new file mode 100644 index 0000000..d80a57b --- /dev/null +++ b/Tests/RunCMake/execute_process/ExitValues.cmake @@ -0,0 +1,120 @@ +#1st TEST RESULT_VARIABLE ONLY +execute_process(COMMAND ${EXIT_CODE_EXE} "zero_exit" + RESULT_VARIABLE r0 + ) +message(STATUS " 1 - 1 RESULT_VARIABLE: ${r0}") +if(NOT r0 EQUAL 0) + message(FATAL_ERROR "zero exit code expected") +endif() +execute_process(COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + RESULT_VARIABLE r01 + ERROR_QUIET + ) +message(STATUS " 1 - 2 RESULT_VARIABLE: ${r01}") +if(r01 EQUAL 0) + message(FATAL_ERROR "non-zero exit code expected") +endif() +#2nd TEST RESULT_VARIABLE and RESULTS_VARIABLE +execute_process(COMMAND ${EXIT_CODE_EXE} "zero_exit" + RESULT_VARIABLE r1 + RESULTS_VARIABLE r1s + ) +message(STATUS " 2 - 1 RESULT_VARIABLE: ${r1}") +message(STATUS " 2 - 1 RESULTS_VARIABLE: ${r1s}") +if(NOT r1 EQUAL 0 OR NOT r1s EQUAL 0) + message(FATAL_ERROR "zero exit code expected") +endif() +execute_process(COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + RESULT_VARIABLE r11 + RESULTS_VARIABLE r11s + ERROR_QUIET + ) +message(STATUS " 2 - 2 RESULT_VARIABLE: ${r11}") +message(STATUS " 2 - 2 RESULTS_VARIABLE: ${r11s}") +if(r11 EQUAL 0 OR r11s EQUAL 0) + message(FATAL_ERROR "non-zero exit code expected") +endif() +#3rd TEST RESULTS_VARIABLE +execute_process(COMMAND ${EXIT_CODE_EXE} "zero_exit" + RESULTS_VARIABLE r2s + ) +message(STATUS " 3 - 1 RESULTS_VARIABLE: ${r2s}") +if(NOT r2s EQUAL 0) + message(FATAL_ERROR "zero exit code expected") +endif() +execute_process(COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + RESULTS_VARIABLE r21s + ERROR_QUIET + ) +message(STATUS " 3 - 2 RESULTS_VARIABLE: ${r21s}") +if(r21s EQUAL 0) + message(FATAL_ERROR "non-zero exit code expected") +endif() +#4th TEST RESULT_VARIABLE and RESULTS_VARIABLE WITH MULTICOMMAND +execute_process(COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + COMMAND ${EXIT_CODE_EXE} "zero_exit" + COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + COMMAND ${EXIT_CODE_EXE} "zero_exit" + COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + COMMAND ${EXIT_CODE_EXE} "zero_exit" + RESULT_VARIABLE r31 + RESULTS_VARIABLE r31s + OUTPUT_QUIET + ERROR_QUIET + ) +message(STATUS " 4 - 1 RESULT_VARIABLE: ${r31}") +message(STATUS " 4 - 1 RESULTS_VARIABLE: ${r31s}") +if(NOT r31 EQUAL 0) + message(FATAL_ERROR "zero exit code expected for last command") +endif() +list(LENGTH r31s r31sLen) +message(STATUS " 4 - 1 RESULTS_VARIABLE_LENGTH: ${r31sLen}") +if(NOT r31sLen EQUAL 6) + message(FATAL_ERROR "length of RESULTS_VARIABLE is not as expected") +else() + foreach(loop_var RANGE 5) + list(GET r31s ${loop_var} rsLocal) + math(EXPR isOdd "${loop_var} % 2") + if(isOdd) + if(NOT rsLocal EQUAL 0) + message(FATAL_ERROR "zero exit code expected") + endif() + else() + if(rsLocal EQUAL 0) + message(FATAL_ERROR "non-zero exit code expected") + endif() + endif() + endforeach() +endif() +#5th TEST RESULT_VARIABLE and RESULTS_VARIABLE WITH MULTICOMMAND +execute_process(COMMAND ${EXIT_CODE_EXE} "zero_exit" + COMMAND ${EXIT_CODE_EXE} "zero_exit" + COMMAND ${EXIT_CODE_EXE} "non_zero_exit" + RESULT_VARIABLE r41 + RESULTS_VARIABLE r41s + OUTPUT_QUIET + ERROR_QUIET + ) +message(STATUS " 5 - 1 RESULT_VARIABLE: ${r41}") +message(STATUS " 5 - 1 RESULTS_VARIABLE: ${r41s}") +if(r41 EQUAL 0) + message(FATAL_ERROR "non-zero exit code expected for last command") +endif() +list(LENGTH r41s r41sLen) +message(STATUS " 5 - 1 RESULTS_VARIABLE_LENGTH: ${r41sLen}") +if(NOT r31sLen EQUAL 6) + message(FATAL_ERROR "length of RESULTS_VARIABLE is not as expected") +else() + list(GET r41s 0 rsLocal) + if(NOT rsLocal EQUAL 0) + message(FATAL_ERROR "zero exit code expected") + endif() + list(GET r41s 1 rsLocal) + if(NOT rsLocal EQUAL 0) + message(FATAL_ERROR "zero exit code expected") + endif() + list(GET r41s 2 rsLocal) + if(rsLocal EQUAL 0) + message(FATAL_ERROR "non-zero exit code expected") + endif() +endif() diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index 62e18c6..83589bb 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -11,3 +11,7 @@ run_cmake(EncodingMissing) if(TEST_ENCODING_EXE) run_cmake_command(EncodingUTF8 ${CMAKE_COMMAND} -DTEST_ENCODING=UTF8 -DTEST_ENCODING_EXE=${TEST_ENCODING_EXE} -P ${RunCMake_SOURCE_DIR}/Encoding.cmake) endif() + +if(EXIT_CODE_EXE) + run_cmake_command(ExitValues ${CMAKE_COMMAND} -DEXIT_CODE_EXE=${EXIT_CODE_EXE} -P ${RunCMake_SOURCE_DIR}/ExitValues.cmake) +endif() diff --git a/Tests/RunCMake/exit_code.c b/Tests/RunCMake/exit_code.c new file mode 100644 index 0000000..3eba019 --- /dev/null +++ b/Tests/RunCMake/exit_code.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +// Usage: +// +// /path/to/program arg1 [arg2 [...]] +// +// Return EXIT_SUCCESS if 'zero_exit' +// string was found in <arg1>. +// Return EXIT_FAILURE if 'non_zero_exit' +// string was found in <arg1>. + +int main(int argc, const char* argv[]) +{ + const char* substring_failure = "non_zero_exit"; + const char* substring_success = "zero_exit"; + const char* str = argv[1]; + if (argc < 2) { + return EXIT_FAILURE; + } + if (strcmp(str, substring_success) == 0) { + return EXIT_SUCCESS; + } else if (strcmp(str, substring_failure) == 0) { + return EXIT_FAILURE; + } + fprintf(stderr, "Failed to find string '%s' in '%s'\n", substring_success, + str); + return EXIT_FAILURE; +} diff --git a/Tests/RunCMake/find_dependency/CMakeLists.txt b/Tests/RunCMake/find_dependency/CMakeLists.txt index 04d09f2..12cd3c7 100644 --- a/Tests/RunCMake/find_dependency/CMakeLists.txt +++ b/Tests/RunCMake/find_dependency/CMakeLists.txt @@ -1,4 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) project(${RunCMake_TEST} NONE) -set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt deleted file mode 100644 index 348f8bb..0000000 --- a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): - Invalid arguments to find_dependency. EXACT may only be specified if a - VERSION is specified -Call Stack \(most recent call first\): - EXACT-no-version.cmake:4 \(find_dependency\) - CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version.cmake b/Tests/RunCMake/find_dependency/EXACT-no-version.cmake deleted file mode 100644 index b05665b7..0000000 --- a/Tests/RunCMake/find_dependency/EXACT-no-version.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(CMakeFindDependencyMacro) - -find_dependency(Pack1 EXACT) diff --git a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake index 9403136..a72d189 100644 --- a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake @@ -1,7 +1,10 @@ include(RunCMake) -run_cmake(EXACT-no-version) -run_cmake(empty-version) -run_cmake(empty-arg-3) -run_cmake(invalid-arg-3) -run_cmake(extra-args) +# Success tests +run_cmake(realistic) +run_cmake(basic) + +# Failure tests +run_cmake(invalid-arg) +run_cmake(bad-version-fuzzy) +run_cmake(bad-version-exact) diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt b/Tests/RunCMake/find_dependency/bad-version-exact-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt +++ b/Tests/RunCMake/find_dependency/bad-version-exact-result.txt diff --git a/Tests/RunCMake/find_dependency/bad-version-exact-stderr.txt b/Tests/RunCMake/find_dependency/bad-version-exact-stderr.txt new file mode 100644 index 0000000..0929f84 --- /dev/null +++ b/Tests/RunCMake/find_dependency/bad-version-exact-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(find_package\): + Could not find a configuration file for package "Pack1" that exactly + matches requested version "1.1". + + The following configuration files were considered but not accepted: + + .*/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake, version: 1.3 + +Call Stack \(most recent call first\): + bad-version-exact.cmake:5 \(find_dependency\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_dependency/bad-version-exact.cmake b/Tests/RunCMake/find_dependency/bad-version-exact.cmake new file mode 100644 index 0000000..c4ca5e2 --- /dev/null +++ b/Tests/RunCMake/find_dependency/bad-version-exact.cmake @@ -0,0 +1,5 @@ +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.1 EXACT REQUIRED) diff --git a/Tests/RunCMake/find_dependency/extra-args-result.txt b/Tests/RunCMake/find_dependency/bad-version-fuzzy-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/find_dependency/extra-args-result.txt +++ b/Tests/RunCMake/find_dependency/bad-version-fuzzy-result.txt diff --git a/Tests/RunCMake/find_dependency/bad-version-fuzzy-stderr.txt b/Tests/RunCMake/find_dependency/bad-version-fuzzy-stderr.txt new file mode 100644 index 0000000..c63256f --- /dev/null +++ b/Tests/RunCMake/find_dependency/bad-version-fuzzy-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(find_package\): + Could not find a configuration file for package "Pack1" that is compatible + with requested version "1.4". + + The following configuration files were considered but not accepted: + + .*/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake, version: 1.3 + +Call Stack \(most recent call first\): + bad-version-fuzzy.cmake:5 \(find_dependency\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_dependency/bad-version-fuzzy.cmake b/Tests/RunCMake/find_dependency/bad-version-fuzzy.cmake new file mode 100644 index 0000000..c7cf4ee --- /dev/null +++ b/Tests/RunCMake/find_dependency/bad-version-fuzzy.cmake @@ -0,0 +1,5 @@ +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.4 REQUIRED) diff --git a/Tests/RunCMake/find_dependency/basic.cmake b/Tests/RunCMake/find_dependency/basic.cmake new file mode 100644 index 0000000..c7795f2 --- /dev/null +++ b/Tests/RunCMake/find_dependency/basic.cmake @@ -0,0 +1,5 @@ +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.1) diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-result.txt b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/find_dependency/empty-arg-3-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt deleted file mode 100644 index bf9b02b..0000000 --- a/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): - Invalid arguments to find_dependency -Call Stack \(most recent call first\): - empty-arg-3.cmake:4 \(find_dependency\) - CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-arg-3.cmake b/Tests/RunCMake/find_dependency/empty-arg-3.cmake deleted file mode 100644 index b08200a..0000000 --- a/Tests/RunCMake/find_dependency/empty-arg-3.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(CMakeFindDependencyMacro) - -find_dependency(Pack1 1.2 "") diff --git a/Tests/RunCMake/find_dependency/empty-version-stderr.txt b/Tests/RunCMake/find_dependency/empty-version-stderr.txt deleted file mode 100644 index b5e9f46..0000000 --- a/Tests/RunCMake/find_dependency/empty-version-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): - Invalid arguments to find_dependency. VERSION is empty -Call Stack \(most recent call first\): - empty-version.cmake:4 \(find_dependency\) - CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-version.cmake b/Tests/RunCMake/find_dependency/empty-version.cmake deleted file mode 100644 index e6f17cd..0000000 --- a/Tests/RunCMake/find_dependency/empty-version.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(CMakeFindDependencyMacro) - -find_dependency(Pack1 "") diff --git a/Tests/RunCMake/find_dependency/extra-args-stderr.txt b/Tests/RunCMake/find_dependency/extra-args-stderr.txt deleted file mode 100644 index 83a7f02..0000000 --- a/Tests/RunCMake/find_dependency/extra-args-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): - Invalid arguments to find_dependency -Call Stack \(most recent call first\): - extra-args.cmake:4 \(find_dependency\) - CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/extra-args.cmake b/Tests/RunCMake/find_dependency/extra-args.cmake deleted file mode 100644 index 209645a..0000000 --- a/Tests/RunCMake/find_dependency/extra-args.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(CMakeFindDependencyMacro) - -find_dependency(Pack1 1.2 EXACT PATHS "${CMAKE_BINARY_DIR}") diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt deleted file mode 100644 index fee8d5d..0000000 --- a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): - Invalid arguments to find_dependency -Call Stack \(most recent call first\): - invalid-arg-3.cmake:4 \(find_dependency\) - CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-version-result.txt b/Tests/RunCMake/find_dependency/invalid-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/find_dependency/empty-version-result.txt +++ b/Tests/RunCMake/find_dependency/invalid-arg-result.txt diff --git a/Tests/RunCMake/find_dependency/invalid-arg-stderr.txt b/Tests/RunCMake/find_dependency/invalid-arg-stderr.txt new file mode 100644 index 0000000..16077b2 --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "EXACTYPO" +Call Stack \(most recent call first\): + invalid-arg.cmake:5 \(find_dependency\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3.cmake b/Tests/RunCMake/find_dependency/invalid-arg.cmake index 40ede07..daaf569 100644 --- a/Tests/RunCMake/find_dependency/invalid-arg-3.cmake +++ b/Tests/RunCMake/find_dependency/invalid-arg.cmake @@ -1,3 +1,4 @@ +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") include(CMakeFindDependencyMacro) diff --git a/Tests/RunCMake/find_dependency/realistic.cmake b/Tests/RunCMake/find_dependency/realistic.cmake new file mode 100644 index 0000000..e633a31 --- /dev/null +++ b/Tests/RunCMake/find_dependency/realistic.cmake @@ -0,0 +1,3 @@ +set(Pack2_DIR "${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/Pack2") + +find_package(Pack2 1.2 REQUIRED) diff --git a/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake index 7d55ef6..7d55ef6 100644 --- a/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake +++ b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake diff --git a/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1ConfigVersion.cmake index dfb7b6c..dfb7b6c 100644 --- a/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake +++ b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1ConfigVersion.cmake diff --git a/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake new file mode 100644 index 0000000..7e8a60b --- /dev/null +++ b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake @@ -0,0 +1,6 @@ +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 PATHS ${CMAKE_CURRENT_LIST_DIR}/..) + +add_library(Pack2::Lib INTERFACE IMPORTED) +set_target_properties(Pack2::Lib PROPERTIES INTERFACE_LINK_LIBRARIES Pack1::Lib) diff --git a/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake new file mode 100644 index 0000000..dfb7b6c --- /dev/null +++ b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "1.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/RunCMake/find_package/MissingConfig-stderr.txt b/Tests/RunCMake/find_package/MissingConfig-stderr.txt index 1eae0bb..33ff545 100644 --- a/Tests/RunCMake/find_package/MissingConfig-stderr.txt +++ b/Tests/RunCMake/find_package/MissingConfig-stderr.txt @@ -1,18 +1,3 @@ -CMake Warning at MissingConfig.cmake:1 \(find_package\): - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - CMake Warning at MissingConfig.cmake:2 \(message\): This warning must be reachable. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/find_package/MissingConfig-stdout.txt b/Tests/RunCMake/find_package/MissingConfig-stdout.txt new file mode 100644 index 0000000..7af632b --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfig-stdout.txt @@ -0,0 +1 @@ +-- Could NOT find NotHere \(missing: NotHere_DIR\) diff --git a/Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt b/Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt new file mode 100644 index 0000000..7af632b --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt @@ -0,0 +1 @@ +-- Could NOT find NotHere \(missing: NotHere_DIR\) diff --git a/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt b/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt deleted file mode 100644 index 10e71fa..0000000 --- a/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -CMake Warning at MissingConfigOneName.cmake:1 \(find_package\): - Could not find a package configuration file named "NotHereConfig.cmake" - provided by package "NotHere". - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt b/Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt new file mode 100644 index 0000000..7af632b --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt @@ -0,0 +1 @@ +-- Could NOT find NotHere \(missing: NotHere_DIR\) diff --git a/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt b/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt deleted file mode 100644 index 2f5086e..0000000 --- a/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt +++ /dev/null @@ -1,13 +0,0 @@ -CMake Warning at MissingConfigVersion.cmake:1 \(find_package\): - Could not find a package configuration file provided by "NotHere" - \(requested version 1\.2\) with any of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt b/Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt new file mode 100644 index 0000000..7af632b --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt @@ -0,0 +1 @@ +-- Could NOT find NotHere \(missing: NotHere_DIR\) diff --git a/Tests/RunCMake/find_package/PackageRoot-stderr.txt b/Tests/RunCMake/find_package/PackageRoot-stderr.txt new file mode 100644 index 0000000..07b27bd --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot-stderr.txt @@ -0,0 +1,319 @@ +Foo_ROOT : +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +Foo_ROOT : +ENV{Foo_ROOT} : +Bar_ROOT : +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND +BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND +BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND +BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND +BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND +BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +Bar_ROOT : +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT : +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/foo/env_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/foo/env_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/foo/env_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT : +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +Foo_ROOT : +ENV{Foo_ROOT} : +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +Foo_ROOT : +ENV{Foo_ROOT} : +Bar_ROOT : +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +Foo_ROOT : +ENV{Foo_ROOT} : +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +Bar_ROOT : +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT : +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT : +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} : +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe + +Foo_ROOT : +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe + +Foo_ROOT :.*/PackageRoot/foo/cmake_root +ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root +Bar_ROOT :.*/PackageRoot/bar/cmake_root +ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root +FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake new file mode 100644 index 0000000..d9f41f8 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot.cmake @@ -0,0 +1,143 @@ +cmake_policy(SET CMP0057 NEW) +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) +set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) + +macro(CleanUpPackageRootTest) + unset(Foo_ROOT) + unset(ENV{Foo_ROOT}) + unset(Bar_ROOT) + unset(ENV{Bar_ROOT}) + unset(FOO_TEST_FILE_FOO) + unset(FOO_TEST_PATH_FOO) + unset(FOO_TEST_PROG_FOO) + unset(BAR_TEST_FILE_FOO) + unset(BAR_TEST_FILE_BAR) + unset(BAR_TEST_PATH_FOO) + unset(BAR_TEST_PATH_BAR) + unset(BAR_TEST_PROG_FOO) + unset(BAR_TEST_PROG_BAR) + unset(FOO_TEST_FILE_FOO CACHE) + unset(FOO_TEST_PATH_FOO CACHE) + unset(FOO_TEST_PROG_FOO CACHE) + unset(BAR_TEST_FILE_FOO CACHE) + unset(BAR_TEST_FILE_BAR CACHE) + unset(BAR_TEST_PATH_FOO CACHE) + unset(BAR_TEST_PATH_BAR CACHE) + unset(BAR_TEST_PROG_FOO CACHE) + unset(BAR_TEST_PROG_BAR CACHE) +endmacro() + +macro(RunPackageRootTest) + set(orig_foo_cmake_root ${Foo_ROOT}) + set(orig_foo_env_root $ENV{Foo_ROOT}) + set(orig_bar_cmake_root ${Bar_ROOT}) + set(orig_bar_env_root $ENV{Bar_ROOT}) + + find_package(Foo) + message("Foo_ROOT :${Foo_ROOT}") + message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}") + message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}") + message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}") + message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}") + CleanUpPackageRootTest() + message("") + + set(Foo_ROOT ${orig_foo_cmake_root}) + set(ENV{Foo_ROOT} ${orig_foo_env_root}) + set(Bar_ROOT ${orig_bar_cmake_root}) + set(ENV{Bar_ROOT} ${orig_bar_env_root}) + + find_package(Foo COMPONENTS Bar) + message("Foo_ROOT :${Foo_ROOT}") + message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}") + message("Bar_ROOT :${Bar_ROOT}") + message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}") + message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}") + message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}") + message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}") + message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}") + message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}") + message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}") + message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}") + message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}") + message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}") + CleanUpPackageRootTest() + message("") + + unset(orig_foo_cmake_root) + unset(orig_foo_env_root) + unset(orig_bar_cmake_root) + unset(orig_bar_env_root) +endmacro() + +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +RunPackageRootTest() + +## + +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +## + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +## + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +## + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() diff --git a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake new file mode 100644 index 0000000..eefa49c --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake @@ -0,0 +1,6 @@ +find_file(BAR_TEST_FILE_FOO foo.h) +find_file(BAR_TEST_FILE_BAR bar.h) +find_path(BAR_TEST_PATH_FOO foo.h) +find_path(BAR_TEST_PATH_BAR bar.h) +find_program(BAR_TEST_PROG_FOO foo.exe) +find_program(BAR_TEST_PROG_BAR bar.exe) diff --git a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake new file mode 100644 index 0000000..cb62390 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake @@ -0,0 +1,7 @@ +find_file(FOO_TEST_FILE_FOO foo.h) +find_path(FOO_TEST_PATH_FOO foo.h) +find_program(FOO_TEST_PROG_FOO foo.exe) + +if ("Bar" IN_LIST Foo_FIND_COMPONENTS) + find_package(Bar) +endif () diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 81b2906..72f9c4d 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -13,6 +13,7 @@ run_cmake(MissingConfigOneName) run_cmake(MissingConfigRequired) run_cmake(MissingConfigVersion) run_cmake(MixedModeOptions) +run_cmake(PackageRoot) run_cmake(PolicyPush) run_cmake(PolicyPop) run_cmake(SetFoundFALSE) diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt deleted file mode 100644 index 695f645..0000000 --- a/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Warning at SetFoundFALSE.cmake:2 \(find_package\): - Found package configuration file: - - .*/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake - - but it set SetFoundFALSE_FOUND to FALSE so package "SetFoundFALSE" is - considered to be NOT FOUND. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt new file mode 100644 index 0000000..37e6e7e --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt @@ -0,0 +1 @@ +-- Could NOT find SetFoundFALSE \(missing: SetFoundFALSE_DIR\) |