diff options
Diffstat (limited to 'Tests/RunCMake')
16 files changed, 60 insertions, 35 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 004dee6..6e1e778 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -125,7 +125,7 @@ endif() if(CMAKE_GENERATOR MATCHES "Make") add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU}) endif() -if(CMAKE_GENERATOR STREQUAL "Ninja") +if(CMAKE_GENERATOR MATCHES "Ninja") set(Ninja_ARGS -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION} -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index f65cb9d..24f54c6 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -75,7 +75,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK if(package_target) set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package) else() - set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_}) + set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_} -C Debug) endif() # execute cpack diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt index 18bf617..ca25b1e 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt @@ -1,5 +1,6 @@ ^\{ - "componentGroups" :[ ] + ("buildConfig" : "Debug", +)? "componentGroups" :[ ] \{ "f12" :[ ] \{ diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index f86e8ea..e9543f1 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -9,7 +9,7 @@ function(run_compiler_launcher lang) run_cmake(${lang}) set(RunCMake_TEST_OUTPUT_MERGE 1) - if("${RunCMake_GENERATOR}" STREQUAL "Ninja") + if("${RunCMake_GENERATOR}" MATCHES "Ninja") set(verbose_args -- -v) endif() run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) diff --git a/Tests/RunCMake/FileAPI/check_index.py b/Tests/RunCMake/FileAPI/check_index.py index 23b02e9..20243c0 100644 --- a/Tests/RunCMake/FileAPI/check_index.py +++ b/Tests/RunCMake/FileAPI/check_index.py @@ -113,7 +113,7 @@ def check_cmake_generator(g): assert is_string(g["platform"]) else: assert sorted(g.keys()) == ["multiConfig", "name"] - assert is_bool(g["multiConfig"], matches(name, "^(Visual Studio |Xcode$)")) + assert is_bool(g["multiConfig"], matches(name, "^(Visual Studio |Xcode$|Ninja Multi-Config$)")) def check_index_object(indexEntry, kind, major, minor, check): assert is_dict(indexEntry) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index 66c559d..de6253f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -621,12 +621,12 @@ def gen_check_directories(c, g): }, ] - if matches(g, "^Visual Studio "): + if matches(g["name"], "^Visual Studio "): for e in expected: if e["parentSource"] is not None: e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^ZERO_CHECK"), e["targetIds"]) - elif g == "Xcode": + elif g["name"] == "Xcode": if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""): for e in expected: e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^(link_imported_object_exe)"), e["targetIds"]) @@ -5087,13 +5087,13 @@ def gen_check_targets(c, g, inSource): for s in e["sources"]: s["path"] = s["path"].replace("^.*/Tests/RunCMake/FileAPI/", "^", 1) if e["sourceGroups"] is not None: - for g in e["sourceGroups"]: - g["sourcePaths"] = [p.replace("^.*/Tests/RunCMake/FileAPI/", "^", 1) for p in g["sourcePaths"]] + for group in e["sourceGroups"]: + group["sourcePaths"] = [p.replace("^.*/Tests/RunCMake/FileAPI/", "^", 1) for p in group["sourcePaths"]] if e["compileGroups"] is not None: - for g in e["compileGroups"]: - g["sourcePaths"] = [p.replace("^.*/Tests/RunCMake/FileAPI/", "^", 1) for p in g["sourcePaths"]] + for group in e["compileGroups"]: + group["sourcePaths"] = [p.replace("^.*/Tests/RunCMake/FileAPI/", "^", 1) for p in group["sourcePaths"]] - if matches(g, "^Visual Studio "): + if matches(g["name"], "^Visual Studio "): expected = filter_list(lambda e: e["name"] not in ("ZERO_CHECK") or e["id"] == "^ZERO_CHECK::@6890427a1f51a3e7e1df$", expected) for e in expected: if e["type"] == "UTILITY": @@ -5130,7 +5130,7 @@ def gen_check_targets(c, g, inSource): if matches(d["id"], "^\\^ZERO_CHECK::@"): d["id"] = "^ZERO_CHECK::@6890427a1f51a3e7e1df$" - elif g == "Xcode": + elif g["name"] == "Xcode": if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""): expected = filter_list(lambda e: e["name"] not in ("link_imported_object_exe"), expected) for e in expected: @@ -5286,12 +5286,12 @@ def gen_check_projects(c, g): }, ] - if matches(g, "^Visual Studio "): + if matches(g["name"], "^Visual Studio "): for e in expected: if e["parentName"] is not None: e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^ZERO_CHECK"), e["targetIds"]) - elif g == "Xcode": + elif g["name"] == "Xcode": if ';' in os.environ.get("CMAKE_OSX_ARCHITECTURES", ""): for e in expected: e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^(link_imported_object_exe)"), e["targetIds"]) @@ -5327,7 +5327,7 @@ def check_object_codemodel(g): inSource = os.path.dirname(o["paths"]["build"]) == o["paths"]["source"] - if matches(g, "^(Visual Studio |Xcode$)"): + if g["multiConfig"]: assert sorted([c["name"] for c in o["configurations"]]) == ["Debug", "MinSizeRel", "RelWithDebInfo", "Release"] else: assert len(o["configurations"]) == 1 @@ -5339,4 +5339,4 @@ def check_object_codemodel(g): assert is_dict(index) assert sorted(index.keys()) == ["cmake", "objects", "reply"] -check_objects(index["objects"], index["cmake"]["generator"]["name"]) +check_objects(index["objects"], index["cmake"]["generator"]) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 808a872..a00d830 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) +set(RunCMake_GENERATOR "Ninja") +set(RunCMake_GENERATOR_IS_MULTI_CONFIG 0) + # Detect ninja version so we know what tests can be supported. execute_process( COMMAND "${RunCMake_MAKE_PROGRAM}" --version diff --git a/Tests/RunCMake/RuntimePath/Relative.cmake b/Tests/RunCMake/RuntimePath/Relative.cmake index 203241f..80ed189 100644 --- a/Tests/RunCMake/RuntimePath/Relative.cmake +++ b/Tests/RunCMake/RuntimePath/Relative.cmake @@ -1,5 +1,12 @@ enable_language(C) +set(cfg_up) +set(cfg_slash /) +if(cfg_dir) + set(cfg_up /..) + set(cfg_slash) +endif() + if(NOT CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN) if(CMAKE_C_PLATFORM_ID STREQUAL "Linux") # Sanity check for platform that is definitely known to support $ORIGIN. @@ -45,25 +52,25 @@ CheckRpath(main "\$ORIGIN") add_executable(main-norel main.c) target_link_libraries(main-norel utils) set_property(TARGET main-norel PROPERTY BUILD_RPATH_USE_ORIGIN OFF) -CheckRpath(main-norel "${CMAKE_CURRENT_BINARY_DIR}") +CheckRpath(main-norel "${CMAKE_CURRENT_BINARY_DIR}${cfg_dir}") add_executable(mainsub main.c) target_link_libraries(mainsub utils) set_property(TARGET mainsub PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -CheckRpath(mainsub "\$ORIGIN/../") +CheckRpath(mainsub "\$ORIGIN${cfg_up}/..${cfg_dir}${cfg_slash}") add_executable(main-sub main.c) target_link_libraries(main-sub utils-sub) -CheckRpath(main-sub "\$ORIGIN/libs") +CheckRpath(main-sub "\$ORIGIN${cfg_up}/libs${cfg_dir}") add_executable(mainsub-sub main.c) target_link_libraries(mainsub-sub utils-sub) set_property(TARGET mainsub-sub PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -CheckRpath(mainsub-sub "\$ORIGIN/../libs") +CheckRpath(mainsub-sub "\$ORIGIN${cfg_up}/../libs${cfg_dir}") if(externDir) # Binaries linking to libraries outside the build tree should have an absolute RPATH. add_executable(main-extern main.c) target_link_libraries(main-extern utils-extern) - CheckRpath(main-extern "${externDir}") + CheckRpath(main-extern "${externDir}${cfg_dir}") endif() diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake index 4c9ddcd..ad446e9 100644 --- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake +++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake @@ -6,7 +6,9 @@ function(run_RuntimePath name) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) set(RunCMake_TEST_NO_CLEAN 1) if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + set(RunCMake_TEST_OPTIONS -Dcfg_dir= -DCMAKE_BUILD_TYPE=Debug) + else() + set(RunCMake_TEST_OPTIONS -Dcfg_dir=/$<CONFIG>) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -14,12 +16,16 @@ function(run_RuntimePath name) run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug) endfunction() +set(cfg_dir) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(cfg_dir /Debug) +endif() + run_RuntimePath(SymlinkImplicit) run_cmake_command(SymlinkImplicitCheck - ${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/SymlinkImplicit-build -P ${RunCMake_SOURCE_DIR}/SymlinkImplicitCheck.cmake) + ${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/SymlinkImplicit-build -Dcfg_dir=${cfg_dir} -P ${RunCMake_SOURCE_DIR}/SymlinkImplicitCheck.cmake) run_RuntimePath(Relative) -# FIXME: Run RelativeCheck (appears to be broken currently) run_RuntimePath(Genex) run_cmake_command(GenexCheck diff --git a/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake index d34742e..4f50d4b 100644 --- a/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake +++ b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake @@ -1,2 +1,2 @@ -file(COPY ${dir}/bin/exe DESTINATION ${dir}) +file(COPY ${dir}/bin${cfg_dir}/exe DESTINATION ${dir}) file(RPATH_CHANGE FILE "${dir}/exe" OLD_RPATH "${dir}/libLink" NEW_RPATH "old-should-not-exist") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake index 34dcc67..c77b43c 100644 --- a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake @@ -11,7 +11,7 @@ string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAK add_library(example SHARED LinkOptionsLib.c) # use LAUNCH facility to dump linker command -set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") +set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") add_dependencies (example dump) diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt index 38566fb..206ab21 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt @@ -1 +1,2 @@ -Unable to find executable:.*MyThirdPartyDependency/src/thirdparty +Unable to find executable:.*MyThirdPartyDependency/src(/[^/ +]+)?/thirdparty diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 5db4b3b..8d1b981 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -69,7 +69,7 @@ if(NOT WIN32 OR CYGWIN) run_cmake(INSTALL-FOLLOW_SYMLINK_CHAIN) endif() -if(RunCMake_GENERATOR STREQUAL "Ninja") +if(RunCMake_GENERATOR MATCHES "Ninja") # Detect ninja version so we know what tests can be supported. execute_process( COMMAND "${RunCMake_MAKE_PROGRAM}" --version @@ -90,7 +90,7 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") endif() endif() -if(RunCMake_GENERATOR STREQUAL "Ninja" AND "${ninja_version}" VERSION_LESS 1.8) +if(RunCMake_GENERATOR MATCHES "Ninja" AND "${ninja_version}" VERSION_LESS 1.8) run_cmake(GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version) else() run_cmake(GLOB-warn-CONFIGURE_DEPENDS-late) diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 06a0c67..6e36473 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -27,7 +27,7 @@ run_cmake(NoCache) # don't rely on RunCMake_GENERATOR_IS_MULTI_CONFIG being set correctly # and instead explicitly check for a match against those generators we # expect to be multi-config -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode|Ninja Multi-Config") run_cmake(IsMultiConfig) else() run_cmake(NotMultiConfig) diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt index 1e123f6..2561263 100644 --- a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt @@ -1,4 +1,4 @@ -^CMake Warning \(dev\) at TARGETS-FILE_RPATH_CHANGE-new_rpath\.cmake:[0-9]+ \(install\): +CMake Warning \(dev\) at TARGETS-FILE_RPATH_CHANGE-new_rpath\.cmake:[0-9]+ \(install\): Policy CMP0095 is not set: RPATH entries are properly escaped in the intermediary CMake install script\. Run "cmake --help-policy CMP0095" for policy details\. Use the cmake_policy command to set the policy and @@ -20,4 +20,4 @@ CMake Warning \(dev\) at TARGETS-FILE_RPATH_CHANGE-new_rpath\.cmake:[0-9]+ \(ins intermediary cmake_install\.cmake script\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-dev to suppress it\.$ +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake index b344867..f86d19f 100644 --- a/Tests/RunCMake/target_link_options/LINKER_expansion.cmake +++ b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake @@ -1,6 +1,13 @@ enable_language(C) +set(cfg_dir) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + set(cfg_dir /Debug) +endif() +set(DUMP_EXE "${CMAKE_CURRENT_BINARY_DIR}${cfg_dir}/dump${CMAKE_EXECUTABLE_SUFFIX}") + add_executable(dump dump.c) # ensure no temp file will be used @@ -13,7 +20,7 @@ add_library(linker SHARED LinkOptionsLib.c) target_link_options(linker PRIVATE "LINKER:-foo,bar") # use LAUNCH facility to dump linker command -set_property(TARGET linker PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") +set_property(TARGET linker PROPERTY RULE_LAUNCH_LINK "\"${DUMP_EXE}\"") add_dependencies (linker dump) @@ -23,7 +30,7 @@ add_library(linker_shell SHARED LinkOptionsLib.c) target_link_options(linker_shell PRIVATE "LINKER:SHELL:-foo bar") # use LAUNCH facility to dump linker command -set_property(TARGET linker_shell PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") +set_property(TARGET linker_shell PROPERTY RULE_LAUNCH_LINK "\"${DUMP_EXE}\"") add_dependencies (linker_shell dump) |