diff options
author | Brad King <brad.king@kitware.com> | 2019-12-16 15:06:26 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-12-16 15:06:48 (GMT) |
commit | 19f04031b6cbdddf52d4f25e79450d8413fff7ac (patch) | |
tree | e06d54e2f6a1a858d29d7ec8c98ef2424f570437 /Tests/RunCMake | |
parent | a1dc0a3a22b78ea9a7ef0864dfb45ee1b3c76acc (diff) | |
parent | 8c062f9d9986560588bbc5b7cffbbf3de940cc02 (diff) | |
download | CMake-19f04031b6cbdddf52d4f25e79450d8413fff7ac.zip CMake-19f04031b6cbdddf52d4f25e79450d8413fff7ac.tar.gz CMake-19f04031b6cbdddf52d4f25e79450d8413fff7ac.tar.bz2 |
Merge topic 'ninja-multi'
8c062f9d99 Help: Add documentation and release notes for multi-config Ninja
e0478cc646 Tests: Add test for Multi-Configuration Ninja generator
5a8a9f7229 Ninja: Add multi-config variant
3bc63e99e4 Refactor: Prepare Ninja generator for multi-config
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4086
Diffstat (limited to 'Tests/RunCMake')
87 files changed, 1770 insertions, 35 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 004dee6..10e4c6f 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} @@ -134,6 +134,13 @@ if(CMAKE_GENERATOR STREQUAL "Ninja") list(APPEND Ninja_ARGS -DTEST_Fortran=1) endif() add_RunCMake_test(Ninja) + set(NinjaMultiConfig_ARGS + -DCYGWIN=${CYGWIN} + ) + if(CMake_TEST_Qt5 AND Qt5Core_FOUND) + list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1) + endif() + add_RunCMake_test(NinjaMultiConfig) endif() add_RunCMake_test(CTest) 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/NinjaMultiConfig/AdditionalCleanFiles-all-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-all-clean-ninja-check.cmake new file mode 100644 index 0000000..012dc2f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-all-clean-ninja-check.cmake @@ -0,0 +1,4 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + # Intentionally empty + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-check.cmake b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-check.cmake new file mode 100644 index 0000000..77412f1 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-check.cmake @@ -0,0 +1,8 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${RunCMake_TEST_BINARY_DIR}/global.txt + ${RunCMake_TEST_BINARY_DIR}/Debug.txt + ${RunCMake_TEST_BINARY_DIR}/Release.txt + ${RunCMake_TEST_BINARY_DIR}/MinSizeRel.txt + ${RunCMake_TEST_BINARY_DIR}/RelWithDebInfo.txt + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-release-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-release-clean-build-check.cmake new file mode 100644 index 0000000..f211223 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles-release-clean-build-check.cmake @@ -0,0 +1,6 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${RunCMake_TEST_BINARY_DIR}/Debug.txt + ${RunCMake_TEST_BINARY_DIR}/MinSizeRel.txt + ${RunCMake_TEST_BINARY_DIR}/RelWithDebInfo.txt + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles.cmake b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles.cmake new file mode 100644 index 0000000..983a494 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/AdditionalCleanFiles.cmake @@ -0,0 +1,3 @@ +file(GENERATE OUTPUT $<CONFIG>.txt CONTENT "$<CONFIG>\n") +file(TOUCH ${CMAKE_BINARY_DIR}/global.txt) +set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES "$<CONFIG>.txt;global.txt") diff --git a/Tests/RunCMake/NinjaMultiConfig/AutoMocExecutable.cmake b/Tests/RunCMake/NinjaMultiConfig/AutoMocExecutable.cmake new file mode 100644 index 0000000..950e18e --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/AutoMocExecutable.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_executable(badmoc badmoc.c) +target_compile_definitions(badmoc PRIVATE "CONFIG=\"$<CONFIG>\"") + +add_executable(exe main.c) +set_target_properties(exe PROPERTIES + AUTOMOC ON + AUTOMOC_EXECUTABLE $<TARGET_FILE:badmoc> + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CMakeLists.txt b/Tests/RunCMake/NinjaMultiConfig/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/NinjaMultiConfig/Clean-release-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Clean-release-build-check.cmake new file mode 100644 index 0000000..cfe6984 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Clean-release-build-check.cmake @@ -0,0 +1,16 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Release} + ${TARGET_SONAME_FILE_mylib_Release} + ${TARGET_OBJECT_FILES_mylib_Release} + + ${TARGET_OBJECT_FILES_myobj_Release} + + ${TARGET_FILE_exeall_Release} + ${TARGET_EXE_FILE_exeall_Release} + ${TARGET_OBJECT_FILES_exeall_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_exenotall_Release} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Clean-release-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Clean-release-clean-build-check.cmake new file mode 100644 index 0000000..06b3fb6 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Clean-release-clean-build-check.cmake @@ -0,0 +1,7 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + EXCLUDE + ${TARGET_OBJECT_FILES_exeall_Release} + ${TARGET_OBJECT_FILES_exenotall_Release} + ${TARGET_OBJECT_FILES_mylib_Release} + ${TARGET_OBJECT_FILES_myobj_Release} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Clean-release-notall-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Clean-release-notall-ninja-check.cmake new file mode 100644 index 0000000..42d6a78 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Clean-release-notall-ninja-check.cmake @@ -0,0 +1,16 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Release} + ${TARGET_SONAME_FILE_mylib_Release} + ${TARGET_OBJECT_FILES_mylib_Release} + + ${TARGET_OBJECT_FILES_myobj_Release} + + ${TARGET_FILE_exeall_Release} + ${TARGET_EXE_FILE_exeall_Release} + ${TARGET_OBJECT_FILES_exeall_Release} + + ${TARGET_FILE_exenotall_Release} + ${TARGET_OBJECT_FILES_exenotall_Release} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Clean.cmake b/Tests/RunCMake/NinjaMultiConfig/Clean.cmake new file mode 100644 index 0000000..2258d2b --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Clean.cmake @@ -0,0 +1,17 @@ +enable_language(C) + +add_executable(exeall main.c) +set_target_properties(exeall PROPERTIES VERSION 1.0.0) +add_executable(exenotall main.c) +set_target_properties(exenotall PROPERTIES EXCLUDE_FROM_ALL TRUE) + +add_library(mylib SHARED simplelib.c) +set_target_properties(mylib PROPERTIES + VERSION 1.0.0 + SOVERSION 1 + ) + +add_library(myobj OBJECT simplelib.c) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(exeall exenotall mylib myobj) diff --git a/Tests/RunCMake/NinjaMultiConfig/Common.cmake b/Tests/RunCMake/NinjaMultiConfig/Common.cmake new file mode 100644 index 0000000..e13bd53 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Common.cmake @@ -0,0 +1,57 @@ +function(generate_output_files) + set(content) + foreach(tgt IN LISTS ARGN) + get_property(type TARGET ${tgt} PROPERTY TYPE) + + if(NOT type STREQUAL "OBJECT_LIBRARY") + set(file " [==[$<TARGET_FILE:${tgt}>]==]") + set(filename " [==[$<TARGET_FILE_NAME:${tgt}>]==]") + else() + set(file) + set(filename) + endif() + string(APPEND content "set(TARGET_FILE_${tgt}_$<CONFIG>${file})\n") + string(APPEND content "set(TARGET_FILE_NAME_${tgt}_$<CONFIG>${filename})\n") + + if(type MATCHES "^(STATIC|MODULE|SHARED)_LIBRARY$") + set(linker_file " [==[$<TARGET_LINKER_FILE:${tgt}>]==]") + set(linker_filename " [==[$<TARGET_LINKER_FILE_NAME:${tgt}>]==]") + else() + set(linker_file) + set(linker_filename) + endif() + string(APPEND content "set(TARGET_LINKER_FILE_${tgt}_$<CONFIG>${linker_file})\n") + string(APPEND content "set(TARGET_LINKER_FILE_NAME_${tgt}_$<CONFIG>${linker_filename})\n") + + if(NOT WIN32 AND NOT CYGWIN AND type MATCHES "^(SHARED_LIBRARY)$") + set(soname_file " [==[$<TARGET_SONAME_FILE:${tgt}>]==]") + set(soname_filename " [==[$<TARGET_SONAME_FILE_NAME:${tgt}>]==]") + else() + set(soname_file) + set(soname_filename) + endif() + string(APPEND content "set(TARGET_SONAME_FILE_${tgt}_$<CONFIG>${soname_file})\n") + string(APPEND content "set(TARGET_SONAME_FILE_NAME_${tgt}_$<CONFIG>${soname_filename})\n") + + if(type MATCHES "^(EXECUTABLE)$") + set(exe_file " [==[$<TARGET_FILE_DIR:${tgt}>/$<TARGET_FILE_PREFIX:${tgt}>$<TARGET_FILE_BASE_NAME:${tgt}>$<TARGET_FILE_SUFFIX:${tgt}>]==]") + set(exe_filename " [==[$<TARGET_FILE_PREFIX:${tgt}>$<TARGET_FILE_BASE_NAME:${tgt}>$<TARGET_FILE_SUFFIX:${tgt}>]==]") + else() + set(exe_file) + set(exe_filename) + endif() + string(APPEND content "set(TARGET_EXE_FILE_${tgt}_$<CONFIG>${exe_file})\n") + string(APPEND content "set(TARGET_EXE_FILE_NAME_${tgt}_$<CONFIG>${exe_filename})\n") + + string(APPEND content "set(TARGET_OBJECT_FILES_${tgt}_$<CONFIG> [==[$<TARGET_OBJECTS:${tgt}>]==])\n") + endforeach() + + file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/target_files_$<CONFIG>.cmake" CONTENT "${content}") + + set(content) + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) + string(APPEND content "include(\${CMAKE_CURRENT_LIST_DIR}/target_files_${config}.cmake)\n") + endforeach() + + file(WRITE "${CMAKE_BINARY_DIR}/target_files.cmake" "${content}") +endfunction() diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-build-check.cmake new file mode 100644 index 0000000..2abdb43 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-build-check.cmake @@ -0,0 +1,38 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + ${GENERATED_FILES} + + ${TARGET_FILE_generator_Debug} + ${TARGET_OBJECT_FILES_generator_Debug} + + ${TARGET_FILE_generated_Debug} + ${TARGET_OBJECT_FILES_generated_Debug} + + ${TARGET_FILE_generatorlib_Debug} + ${TARGET_LINKER_FILE_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + + ${TARGET_OBJECT_FILES_generatorobj_Debug} + + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + EXCLUDE + ${TARGET_OBJECT_FILES_generator_Release} + ${TARGET_OBJECT_FILES_generated_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorobj_Release} + ${TARGET_OBJECT_FILES_emptyobj_Release} + + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-ninja-check.cmake new file mode 100644 index 0000000..aff42c3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-ninja-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + + ${TARGET_FILE_generator_Release} + ${TARGET_OBJECT_FILES_generator_Release} + + ${TARGET_FILE_generated_Release} + ${TARGET_OBJECT_FILES_generated_Release} + + ${TARGET_FILE_generatorlib_Release} + ${TARGET_LINKER_FILE_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + + ${TARGET_OBJECT_FILES_generatorobj_Release} + + ${TARGET_OBJECT_FILES_emptyobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_generator_Debug} + ${TARGET_OBJECT_FILES_generated_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorobj_Debug} + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-generated-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-generated-stdout.txt new file mode 100644 index 0000000..765d486 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-generated-stdout.txt @@ -0,0 +1,12 @@ +^Generator genex config definition: Debug +Generator genex config include dir: Debug +Generator library genex config definition: Debug +Generator library genex config include dir: Debug +Generator object genex config definition: Debug +Generator object genex config include dir: Debug +Generated genex config definition: Debug +Generated genex config include dir: Debug +Generated library genex config definition: Debug +Generated library genex config include dir: Debug +Generated object genex config definition: Debug +Generated object genex config include dir: Debug$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake new file mode 100644 index 0000000..f534319 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake @@ -0,0 +1,44 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + ${GENERATED_FILES} + + ${TARGET_FILE_generated_Debug} + ${TARGET_OBJECT_FILES_generated_Debug} + + ${TARGET_FILE_generatorlib_Debug} + ${TARGET_LINKER_FILE_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + + ${TARGET_OBJECT_FILES_generatorobj_Debug} + + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + ${TARGET_FILE_generator_Release} + ${TARGET_OBJECT_FILES_generator_Release} + + ${TARGET_FILE_generatorlib_Release} + ${TARGET_LINKER_FILE_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + + ${TARGET_OBJECT_FILES_generatorobj_Release} + + ${TARGET_OBJECT_FILES_emptyobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_generator_Debug} + + ${TARGET_OBJECT_FILES_generated_Release} + + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake new file mode 100644 index 0000000..5e30bfe --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake @@ -0,0 +1,36 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + + ${TARGET_FILE_generator_Release} + ${TARGET_OBJECT_FILES_generator_Release} + + ${TARGET_FILE_generatorlib_Release} + ${TARGET_LINKER_FILE_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + + ${TARGET_OBJECT_FILES_generatorobj_Release} + + ${TARGET_OBJECT_FILES_emptyobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_generator_Debug} + ${TARGET_OBJECT_FILES_generated_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorobj_Debug} + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + ${TARGET_OBJECT_FILES_generated_Release} + + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-generated-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-generated-stdout.txt new file mode 100644 index 0000000..1c9abef --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-generated-stdout.txt @@ -0,0 +1,12 @@ +^Generator genex config definition: Release +Generator genex config include dir: Release +Generator library genex config definition: Release +Generator library genex config include dir: Release +Generator object genex config definition: Release +Generator object genex config include dir: Release +Generated genex config definition: Debug +Generated genex config include dir: Debug +Generated library genex config definition: Debug +Generated library genex config include dir: Debug +Generated object genex config definition: Debug +Generated object genex config include dir: Debug$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-clean-build-check.cmake new file mode 100644 index 0000000..8ba6d68 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-clean-build-check.cmake @@ -0,0 +1,29 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + + EXCLUDE + ${TARGET_OBJECT_FILES_generator_Debug} + ${TARGET_OBJECT_FILES_generated_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorobj_Debug} + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + ${TARGET_OBJECT_FILES_generator_Release} + ${TARGET_OBJECT_FILES_generated_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorobj_Release} + ${TARGET_OBJECT_FILES_emptyobj_Release} + + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-generated-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-generated-stdout.txt new file mode 100644 index 0000000..576ec51 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-generated-stdout.txt @@ -0,0 +1,12 @@ +^Generator genex config definition: Release +Generator genex config include dir: Release +Generator library genex config definition: Release +Generator library genex config include dir: Release +Generator object genex config definition: Release +Generator object genex config include dir: Release +Generated genex config definition: Release +Generated genex config include dir: Release +Generated library genex config definition: Release +Generated library genex config include dir: Release +Generated object genex config definition: Release +Generated object genex config include dir: Release$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-generated-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-generated-stdout.txt new file mode 100644 index 0000000..25392af --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-generated-stdout.txt @@ -0,0 +1,12 @@ +^Generator genex config definition: Debug +Generator genex config include dir: Debug +Generator library genex config definition: Debug +Generator library genex config include dir: Debug +Generator object genex config definition: Debug +Generator object genex config include dir: Debug +Generated genex config definition: Release +Generated genex config include dir: Release +Generated library genex config definition: Release +Generated library genex config include dir: Release +Generated object genex config definition: Release +Generated object genex config include dir: Release$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake new file mode 100644 index 0000000..9500cda --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + ${GENERATED_FILES} + + ${TARGET_FILE_generator_Debug} + ${TARGET_OBJECT_FILES_generator_Debug} + + ${TARGET_FILE_generatorlib_Debug} + ${TARGET_LINKER_FILE_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + + ${TARGET_OBJECT_FILES_generatorobj_Debug} + + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + ${TARGET_FILE_generator_Release} + ${TARGET_OBJECT_FILES_generator_Release} + + ${TARGET_FILE_generated_Release} + ${TARGET_OBJECT_FILES_generated_Release} + + ${TARGET_FILE_generatorlib_Release} + ${TARGET_LINKER_FILE_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + + ${TARGET_OBJECT_FILES_generatorobj_Release} + + ${TARGET_OBJECT_FILES_emptyobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_generated_Debug} + + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-ninja-check.cmake new file mode 100644 index 0000000..b51a6a7 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-ninja-check.cmake @@ -0,0 +1,46 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${CONFIG_FILES} + ${GENERATED_FILES} + + ${TARGET_FILE_generator_Debug} + ${TARGET_OBJECT_FILES_generator_Debug} + + ${TARGET_FILE_generated_Debug} + ${TARGET_OBJECT_FILES_generated_Debug} + + ${TARGET_FILE_generatorlib_Debug} + ${TARGET_LINKER_FILE_generatorlib_Debug} + ${TARGET_OBJECT_FILES_generatorlib_Debug} + + ${TARGET_OBJECT_FILES_generatorobj_Debug} + + ${TARGET_OBJECT_FILES_emptyobj_Debug} + + ${TARGET_FILE_generator_Release} + ${TARGET_OBJECT_FILES_generator_Release} + + ${TARGET_FILE_generated_Release} + ${TARGET_OBJECT_FILES_generated_Release} + + ${TARGET_FILE_generatorlib_Release} + ${TARGET_LINKER_FILE_generatorlib_Release} + ${TARGET_OBJECT_FILES_generatorlib_Release} + + ${TARGET_OBJECT_FILES_generatorobj_Release} + + ${TARGET_OBJECT_FILES_emptyobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_generator_MinSizeRel} + ${TARGET_OBJECT_FILES_generated_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorlib_MinSizeRel} + ${TARGET_OBJECT_FILES_generatorobj_MinSizeRel} + ${TARGET_OBJECT_FILES_emptyobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_generator_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generated_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorlib_RelWithDebInfo} + ${TARGET_OBJECT_FILES_generatorobj_RelWithDebInfo} + ${TARGET_OBJECT_FILES_emptyobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator.cmake new file mode 100644 index 0000000..f4aca5e --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator.cmake @@ -0,0 +1,56 @@ +enable_language(C) + +add_library(generatorlib STATIC generatorlib.c) +add_library(generatorobj OBJECT generatorobj.c) +add_library(emptyobj OBJECT empty.c) +add_library(emptyobj2 OBJECT empty.c) + +add_executable(generator generator.c $<TARGET_OBJECTS:generatorobj>) +target_link_libraries(generator PRIVATE generatorlib) + +add_custom_command(OUTPUT generated.c COMMAND generator generated.c) +add_executable(generated ${CMAKE_BINARY_DIR}/generated.c $<TARGET_OBJECTS:generatorobj> $<TARGET_OBJECTS:emptyobj>) +target_link_libraries(generated PRIVATE generatorlib) + +file(GENERATE OUTPUT include/genex/$<CONFIG>/genex_config.h CONTENT +"#ifndef GENEX_CONFIG_H +#define GENEX_CONFIG_H + +#define GENEX_CONFIG_INCLUDE_DIR \"$<CONFIG>\" + +#endif /* GENEX_CONFIG_H */ +") +file(GENERATE OUTPUT include/intdir/$<CONFIG>/intdir_config.h CONTENT +"#ifndef INTDIR_CONFIG_H +#define INTDIR_CONFIG_H + +#define INTDIR_CONFIG_INCLUDE_DIR \"$<CONFIG>\" + +#endif /* INTDIR_CONFIG_H */ +") + +foreach(g generatorlib generatorobj generator generated) + target_compile_definitions(${g} PRIVATE + "GENEX_CONFIG_DEFINITION=\"$<CONFIG>\"" + # FIXME Get this working + # "INTDIR_CONFIG_DEFINITION=\"${CMAKE_CFG_INTDIR}\"" + ) + target_include_directories(${g} PRIVATE + "${CMAKE_BINARY_DIR}/include/genex/$<CONFIG>" + # FIXME Get this working + # "${CMAKE_BINARY_DIR}/include/intdir/${CMAKE_CFG_INTDIR}" + ) +endforeach() + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(generatorlib generatorobj emptyobj generator generated) + +file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(GENERATED_FILES [==[${CMAKE_BINARY_DIR}/generated.c]==])\n") +set(genfiles) +foreach(cfg Debug Release MinSizeRel RelWithDebInfo) + list(APPEND genfiles + ${CMAKE_BINARY_DIR}/include/genex/${cfg}/genex_config.h + ${CMAKE_BINARY_DIR}/include/intdir/${cfg}/intdir_config.h + ) +endforeach() +file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(CONFIG_FILES [==[${genfiles}]==])\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-command-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-command-ninja-check.cmake new file mode 100644 index 0000000..f5c4020 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-command-ninja-check.cmake @@ -0,0 +1,6 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ) +check_file_contents("${TARGET_DEPENDS_TopCommand}" "^Genex config: Debug\nINTDIR config: Debug\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-in-release-graph-postbuild-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-in-release-graph-postbuild-build-check.cmake new file mode 100644 index 0000000..05861b2 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-in-release-graph-postbuild-build-check.cmake @@ -0,0 +1,8 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ${TARGET_BYPRODUCTS_SubdirTarget} + ${TARGET_BYPRODUCTS_TopTarget} + ${TARGET_FILE_SubdirPostBuild_Debug} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-target-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-target-build-check.cmake new file mode 100644 index 0000000..52895b2 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-target-build-check.cmake @@ -0,0 +1,8 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ${TARGET_BYPRODUCTS_SubdirTarget} + ${TARGET_BYPRODUCTS_TopTarget} + ) +check_file_contents("${TARGET_BYPRODUCTS_TopTarget}" "^Genex config: Debug\nINTDIR config: Debug\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-targetpostbuild-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-targetpostbuild-build-check.cmake new file mode 100644 index 0000000..80439ea --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-debug-targetpostbuild-build-check.cmake @@ -0,0 +1,12 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ${TARGET_BYPRODUCTS_SubdirTarget} + ${TARGET_BYPRODUCTS_TopTarget} + ${TARGET_FILE_SubdirPostBuild_Debug} + ${TARGET_FILE_SubdirPostBuild_Release} + ${TARGET_BYPRODUCTS_SubdirPostBuild} + ${TARGET_BYPRODUCTS_TopTargetPostBuild} + ) +check_file_contents("${TARGET_BYPRODUCTS_TopTargetPostBuild}" "^Genex config: Debug\nINTDIR config: Debug\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-minsizerel-command-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-minsizerel-command-ninja-check.cmake new file mode 100644 index 0000000..2813f02 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-minsizerel-command-ninja-check.cmake @@ -0,0 +1,5 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ) +check_file_contents("${TARGET_DEPENDS_SubdirCommand}" "^Genex config: MinSizeRel\nINTDIR config: MinSizeRel\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-command-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-command-build-check.cmake new file mode 100644 index 0000000..2da9735 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-command-build-check.cmake @@ -0,0 +1,5 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ) +check_file_contents("${TARGET_DEPENDS_SubdirCommand}" "^Genex config: Release\nINTDIR config: Release\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-postbuild-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-postbuild-ninja-check.cmake new file mode 100644 index 0000000..0916b90 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-postbuild-ninja-check.cmake @@ -0,0 +1,11 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ${TARGET_BYPRODUCTS_SubdirTarget} + ${TARGET_BYPRODUCTS_TopTarget} + ${TARGET_FILE_SubdirPostBuild_Debug} + ${TARGET_FILE_SubdirPostBuild_Release} + ${TARGET_BYPRODUCTS_SubdirPostBuild} + ) +check_file_contents("${TARGET_BYPRODUCTS_SubdirPostBuild}" "^Genex config: Release\nINTDIR config: Release\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-target-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-target-ninja-check.cmake new file mode 100644 index 0000000..87e78b4 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-target-ninja-check.cmake @@ -0,0 +1,7 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ${TARGET_BYPRODUCTS_SubdirTarget} + ) +check_file_contents("${TARGET_BYPRODUCTS_SubdirTarget}" "^Genex config: Release\nINTDIR config: Release\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-targetpostbuild-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-targetpostbuild-ninja-check.cmake new file mode 100644 index 0000000..f67d5be --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-targetpostbuild-ninja-check.cmake @@ -0,0 +1,13 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_DEPENDS_SubdirCommand} + ${TARGET_DEPENDS_TopCommand} + ${TARGET_BYPRODUCTS_SubdirTarget} + ${TARGET_BYPRODUCTS_TopTarget} + ${TARGET_FILE_SubdirPostBuild_Debug} + ${TARGET_FILE_SubdirPostBuild_Release} + ${TARGET_BYPRODUCTS_SubdirPostBuild} + ${TARGET_BYPRODUCTS_TopTargetPostBuild} + ${TARGET_BYPRODUCTS_SubdirTargetPostBuild} + ) +check_file_contents("${TARGET_BYPRODUCTS_SubdirTargetPostBuild}" "^Genex config: Release\nINTDIR config: Release\n$") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake new file mode 100644 index 0000000..b2b24e8 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake @@ -0,0 +1,39 @@ +enable_language(C) + +file(REMOVE "${CMAKE_BINARY_DIR}/target_files_custom.cmake") + +function(get_write_file_command var filename) + set(${var} ${CMAKE_COMMAND} -DOUTPUT_FILE=${filename} -DGENEX_CONFIG=$<CONFIG> -DINTDIR_CONFIG=${CMAKE_CFG_INTDIR} -P ${CMAKE_SOURCE_DIR}/WriteFile.cmake PARENT_SCOPE) +endfunction() + +function(create_targets prefix) + get_write_file_command(cmd ${prefix}Command.txt) + add_custom_command(OUTPUT ${prefix}Command.txt COMMAND ${cmd}) + add_custom_target(${prefix}Command DEPENDS ${prefix}Command.txt) + + get_write_file_command(cmd ${prefix}Target.txt) + add_custom_target(${prefix}Target COMMAND ${cmd} BYPRODUCTS ${prefix}Target.txt) + + get_write_file_command(cmd ${prefix}PostBuild.txt) + add_executable(${prefix}PostBuild ${CMAKE_SOURCE_DIR}/main.c) + add_custom_command(TARGET ${prefix}PostBuild COMMAND ${cmd} BYPRODUCTS ${prefix}PostBuild.txt) + + get_write_file_command(cmd ${prefix}TargetPostBuild.txt) + add_custom_target(${prefix}TargetPostBuild) + add_custom_command(TARGET ${prefix}TargetPostBuild COMMAND ${cmd} BYPRODUCTS ${prefix}TargetPostBuild.txt) + + file(APPEND "${CMAKE_BINARY_DIR}/target_files_custom.cmake" +"set(TARGET_DEPENDS_${prefix}Command [==[${CMAKE_CURRENT_BINARY_DIR}/${prefix}Command.txt]==]) +set(TARGET_BYPRODUCTS_${prefix}Target [==[${CMAKE_CURRENT_BINARY_DIR}/${prefix}Target.txt]==]) +set(TARGET_BYPRODUCTS_${prefix}PostBuild [==[${CMAKE_CURRENT_BINARY_DIR}/${prefix}PostBuild.txt]==]) +set(TARGET_BYPRODUCTS_${prefix}TargetPostBuild [==[${CMAKE_CURRENT_BINARY_DIR}/${prefix}TargetPostBuild.txt]==]) +") +endfunction() + +add_subdirectory(CustomCommandsAndTargetsSubdir) + +create_targets(Top) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(TopPostBuild SubdirPostBuild) +file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "include(\${CMAKE_CURRENT_LIST_DIR}/target_files_custom.cmake)\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargetsSubdir/CMakeLists.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargetsSubdir/CMakeLists.txt new file mode 100644 index 0000000..894e3ed --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargetsSubdir/CMakeLists.txt @@ -0,0 +1 @@ +create_targets(Subdir) diff --git a/Tests/RunCMake/NinjaMultiConfig/Install-debug-in-release-graph-install-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Install-debug-in-release-graph-install-ninja-check.cmake new file mode 100644 index 0000000..bc15a25 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Install-debug-in-release-graph-install-ninja-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_exe_Debug} + ${TARGET_OBJECT_FILES_exe_Debug} + + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Debug} + ${TARGET_OBJECT_FILES_mylib_Debug} + + ${RunCMake_TEST_BINARY_DIR}/install/bin/Debug/${TARGET_FILE_NAME_exe_Debug} + ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_FILE_NAME_mylib_Debug} + ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_LINKER_FILE_NAME_mylib_Debug} + + ${TARGET_FILE_exe_Release} + ${TARGET_OBJECT_FILES_exe_Release} + + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Release} + ${TARGET_OBJECT_FILES_mylib_Release} + + ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/${TARGET_FILE_NAME_exe_Release} + ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_FILE_NAME_mylib_Release} + ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_LINKER_FILE_NAME_mylib_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_exe_MinSizeRel} + ${TARGET_OBJECT_FILES_mylib_MinSizeRel} + + ${TARGET_OBJECT_FILES_exe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_mylib_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Install-release-install-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Install-release-install-build-check.cmake new file mode 100644 index 0000000..3280c89 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Install-release-install-build-check.cmake @@ -0,0 +1,23 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_exe_Release} + ${TARGET_OBJECT_FILES_exe_Release} + + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Release} + ${TARGET_OBJECT_FILES_mylib_Release} + + ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/${TARGET_FILE_NAME_exe_Release} + ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_FILE_NAME_mylib_Release} + ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_LINKER_FILE_NAME_mylib_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_exe_Debug} + ${TARGET_OBJECT_FILES_mylib_Debug} + + ${TARGET_OBJECT_FILES_exe_MinSizeRel} + ${TARGET_OBJECT_FILES_mylib_MinSizeRel} + + ${TARGET_OBJECT_FILES_exe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_mylib_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Install.cmake b/Tests/RunCMake/NinjaMultiConfig/Install.cmake new file mode 100644 index 0000000..e26e3e0 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Install.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_executable(exe main.c) +add_library(mylib STATIC simplelib.c) + +install(TARGETS exe DESTINATION bin/$<CONFIG>) +install(TARGETS mylib DESTINATION lib/$<CONFIG>) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(exe mylib) diff --git a/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation-debug-in-release-graph-build-check.cmake new file mode 100644 index 0000000..3657b5b --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation-debug-in-release-graph-build-check.cmake @@ -0,0 +1,7 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Release} + ${TARGET_FILE_mylib_Debug} + ${TARGET_LINKER_FILE_mylib_Debug} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation-release-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation-release-in-release-graph-build-check.cmake new file mode 100644 index 0000000..3345ee8 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation-release-in-release-graph-build-check.cmake @@ -0,0 +1,5 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${TARGET_FILE_mylib_Release} + ${TARGET_LINKER_FILE_mylib_Release} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation.cmake b/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation.cmake new file mode 100644 index 0000000..abef3c8 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/PostfixAndLocation.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +set(CMAKE_DEBUG_POSTFIX "_debug") + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/lib) + +add_library(mylib SHARED simplelib.c) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(mylib) diff --git a/Tests/RunCMake/NinjaMultiConfig/Qt5-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Qt5-debug-in-release-graph-build-check.cmake new file mode 100644 index 0000000..2d8df13 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Qt5-debug-in-release-graph-build-check.cmake @@ -0,0 +1,7 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${AUTOGEN_FILES} + + ${TARGET_FILE_exe_Debug} + ${TARGET_OBJECT_FILES_exe_Debug} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake b/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake new file mode 100644 index 0000000..6a80b1d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake @@ -0,0 +1,18 @@ +enable_language(CXX) + +find_package(Qt5Core REQUIRED) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOMOC_COMPILER_PREDEFINES OFF) + +add_executable(exe qt5.cxx) +target_link_libraries(exe PRIVATE Qt5::Core) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(exe) + +set(autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation.cpp") +foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp") +endforeach() +file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES [==[${autogen_files}]==])\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake new file mode 100644 index 0000000..4b51ddb --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -0,0 +1,173 @@ +cmake_minimum_required(VERSION 3.16) + +include(RunCMake) + +set(RunCMake_GENERATOR "Ninja Multi-Config") +set(RunCMake_GENERATOR_IS_MULTI_CONFIG 1) + +function(check_files dir) + cmake_parse_arguments(_check_files "" "" "INCLUDE;EXCLUDE" ${ARGN}) + + set(expected ${_check_files_INCLUDE}) + list(FILTER expected EXCLUDE REGEX "^$") + list(REMOVE_DUPLICATES expected) + list(SORT expected) + + file(GLOB_RECURSE actual "${dir}/*") + list(FILTER actual EXCLUDE REGEX "/CMakeFiles/|\\.ninja$|/CMakeCache\\.txt$|/target_files[^/]*\\.cmake$|/\\.ninja_[^/]*$|/cmake_install\\.cmake$|\\.ilk$|\\.manifest$|\\.pdb$|\\.exp$|/install_manifest\\.txt$") + foreach(f IN LISTS _check_files_INCLUDE _check_files_EXCLUDE) + if(EXISTS ${f}) + list(APPEND actual ${f}) + endif() + endforeach() + list(REMOVE_DUPLICATES actual) + list(SORT actual) + + if(NOT "${expected}" STREQUAL "${actual}") + string(REPLACE ";" "\n " expected_formatted "${expected}") + string(REPLACE ";" "\n " actual_formatted "${actual}") + string(APPEND RunCMake_TEST_FAILED "Actual files did not match expected\nExpected:\n ${expected_formatted}\nActual:\n ${actual_formatted}\n") + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(check_file_contents filename expected) + if(NOT EXISTS "${filename}") + string(APPEND RunCMake_TEST_FAILED "File ${filename} does not exist\n") + else() + file(READ "${filename}" actual) + if(NOT actual MATCHES "${expected}") + string(REPLACE "\n" "\n " expected_formatted "${expected}") + string(REPLACE "\n" "\n " actual_formatted "${actual}") + string(APPEND RunCMake_TEST_FAILED "Contents of ${filename} do not match expected\nExpected:\n ${expected_formatted}\nActual:\n ${actual_formatted}\n") + endif() + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(run_cmake_configure case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${case}) +endfunction() + +function(run_cmake_build case suffix config) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(tgts) + foreach(tgt IN LISTS ARGN) + list(APPEND tgts --target ${tgt}) + endforeach() + run_cmake_command(${case}-${suffix}-build "${CMAKE_COMMAND}" --build . --config ${config} ${tgts}) +endfunction() + +function(run_ninja case suffix file) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${case}-${suffix}-ninja "${RunCMake_MAKE_PROGRAM}" -f "${file}" ${ARGN}) +endfunction() + +############################################################################### + +set(RunCMake_TEST_NO_CLEAN 1) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE=RelWithDebInfo") +run_cmake_configure(Simple) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(Simple debug-target Debug simpleexe) +run_ninja(Simple debug-target build-Debug.ninja simplestatic) +get_filename_component(simpleshared_Release "${TARGET_FILE_simpleshared_Release}" NAME) +run_cmake_build(Simple release-filename Release ${simpleshared_Release}) +file(RELATIVE_PATH simpleexe_Release "${RunCMake_TEST_BINARY_DIR}" "${TARGET_FILE_simpleexe_Release}") +run_ninja(Simple release-file build-Release.ninja ${simpleexe_Release}) +run_cmake_build(Simple all-configs Release simplestatic:all) +run_ninja(Simple default-build-file build.ninja simpleexe) +run_cmake_build(Simple all-clean Release clean:all) +run_cmake_build(Simple debug-subdir Debug SimpleSubdir/all) +run_ninja(Simple release-in-minsizerel-graph-subdir build-MinSizeRel.ninja SimpleSubdir/all:Release) +run_cmake_build(Simple all-subdir Release SimpleSubdir/all:all) +run_ninja(Simple minsizerel-top build-MinSizeRel.ninja all) +run_cmake_build(Simple debug-in-release-graph-top Release all:Debug) +run_ninja(Simple all-clean-again build-Debug.ninja clean:all) +run_ninja(Simple all-top build-RelWithDebInfo.ninja all:all) +# Leave enough time for the timestamp to change on second-resolution systems +execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) +file(TOUCH "${RunCMake_TEST_BINARY_DIR}/empty.cmake") +run_ninja(Simple reconfigure-config build-Release.ninja simpleexe) +execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) +file(TOUCH "${RunCMake_TEST_BINARY_DIR}/empty.cmake") +run_ninja(Simple reconfigure-noconfig build.ninja simpleexe) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) +run_cmake_configure(CustomCommandGenerator) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(CustomCommandGenerator debug Debug generated) +run_cmake_command(CustomCommandGenerator-debug-generated "${TARGET_FILE_generated_Debug}") +run_ninja(CustomCommandGenerator release build-Release.ninja generated) +run_cmake_command(CustomCommandGenerator-release-generated "${TARGET_FILE_generated_Release}") +run_ninja(CustomCommandGenerator debug-clean build-Debug.ninja clean) +run_cmake_build(CustomCommandGenerator release-clean Release clean) +run_cmake_build(CustomCommandGenerator debug-in-release-graph Release generated:Debug) +run_cmake_command(CustomCommandGenerator-debug-in-release-graph-generated "${TARGET_FILE_generated_Debug}") +run_ninja(CustomCommandGenerator debug-in-release-graph-clean build-Debug.ninja clean:Debug) +run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja generated:Release) +run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build) +run_cmake_configure(CustomCommandsAndTargets) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(CustomCommandsAndTargets release-command Release SubdirCommand) +#FIXME Get this working +#run_ninja(CustomCommandsAndTargets minsizerel-command build-MinSizeRel.ninja CustomCommandsAndTargetsSubdir/SubdirCommand) +run_ninja(CustomCommandsAndTargets debug-command build-Debug.ninja TopCommand) +run_ninja(CustomCommandsAndTargets release-target build-Release.ninja SubdirTarget) +run_cmake_build(CustomCommandsAndTargets debug-target Debug TopTarget) +run_cmake_build(CustomCommandsAndTargets debug-in-release-graph-postbuild Release SubdirPostBuild:Debug) +run_ninja(CustomCommandsAndTargets release-postbuild build-Release.ninja SubdirPostBuild) +run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPostBuild) +run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostfixAndLocation-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release") +run_cmake_configure(PostfixAndLocation) +set(RunCMake_TEST_OPTIONS) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(PostfixAndLocation release-in-release-graph Release mylib:Release) +run_cmake_build(PostfixAndLocation debug-in-release-graph Release mylib:Debug) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Clean-build) +run_cmake_configure(Clean) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(Clean release Release) +run_ninja(Clean release-notall build-Release.ninja exenotall) +run_cmake_build(Clean release-clean Release clean) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdditionalCleanFiles-build) +run_cmake_configure(AdditionalCleanFiles) +run_cmake_build(AdditionalCleanFiles release-clean Release clean) +run_ninja(AdditionalCleanFiles all-clean build-Debug.ninja clean:all) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Install-build) +set(RunCMake_TEST_OPTIONS -DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install) +run_cmake_configure(Install) +set(RunCMake_TEST_OPTIONS) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(Install release-install Release install) +run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Debug) + +# FIXME Get this working +#set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutoMocExecutable-build) +#run_cmake_configure(AutoMocExecutable) +#run_cmake_build(AutoMocExecutable debug-in-release-graph Release exe) + +if(CMake_TEST_Qt5) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build) + run_cmake_configure(Qt5) + include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) + run_cmake_build(Qt5 debug-in-release-graph Release exe:Debug) +endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-clean-again-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-clean-again-ninja-check.cmake new file mode 100644 index 0000000..0f919df --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-clean-again-ninja-check.cmake @@ -0,0 +1,25 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-clean-build-check.cmake new file mode 100644 index 0000000..0f919df --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-clean-build-check.cmake @@ -0,0 +1,25 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-configs-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-configs-build-check.cmake new file mode 100644 index 0000000..170a0e8 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-configs-build-check.cmake @@ -0,0 +1,47 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_LINKER_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake new file mode 100644 index 0000000..de4505c --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-subdir-build-check.cmake @@ -0,0 +1,49 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake new file mode 100644 index 0000000..c171e3d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-all-top-ninja-check.cmake @@ -0,0 +1,56 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_LINKER_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake new file mode 100644 index 0000000..fe980fe --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-in-release-graph-top-build-check.cmake @@ -0,0 +1,53 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake new file mode 100644 index 0000000..6bb7773 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-subdir-build-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-target-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-target-build-check.cmake new file mode 100644 index 0000000..6bb7773 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-target-build-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-debug-target-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-target-ninja-check.cmake new file mode 100644 index 0000000..f9c1e92 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-debug-target-ninja-check.cmake @@ -0,0 +1,33 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-ninja-check.cmake new file mode 100644 index 0000000..dae1f4d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-ninja-check.cmake @@ -0,0 +1,51 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_LINKER_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake new file mode 100644 index 0000000..bf4be49 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-minsizerel-top-ninja-check.cmake @@ -0,0 +1,51 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt new file mode 100644 index 0000000..8877451 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt @@ -0,0 +1,4 @@ +-- Configuring done +-- Generating done +-- Build files have been written to: [^ +]*/Tests/RunCMake/NinjaMultiConfig/Simple-build diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt new file mode 100644 index 0000000..8877451 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt @@ -0,0 +1,4 @@ +-- Configuring done +-- Generating done +-- Build files have been written to: [^ +]*/Tests/RunCMake/NinjaMultiConfig/Simple-build diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-release-file-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-release-file-ninja-check.cmake new file mode 100644 index 0000000..6e63aae --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-release-file-ninja-check.cmake @@ -0,0 +1,39 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-release-filename-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-release-filename-build-check.cmake new file mode 100644 index 0000000..a9bf42c --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-release-filename-build-check.cmake @@ -0,0 +1,36 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake new file mode 100644 index 0000000..b6c77ab --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-release-in-minsizerel-graph-subdir-ninja-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple.cmake new file mode 100644 index 0000000..a32f551 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +file(TOUCH ${CMAKE_BINARY_DIR}/empty.cmake) +include(${CMAKE_BINARY_DIR}/empty.cmake) + +add_subdirectory(SimpleSubdir) + +add_library(simplestatic STATIC simplelib.c) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(simpleexe simpleshared simplestatic simpleobj) + +file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(GENERATED_FILES [==[${CMAKE_BINARY_DIR}/empty.cmake]==])\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt new file mode 100644 index 0000000..7e754a3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleSubdir/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(simpleobj OBJECT ../empty.c) +add_executable(simpleexe ../main.c $<TARGET_OBJECTS:simpleobj>) +add_library(simpleshared SHARED ../simplelib.c) +target_link_libraries(simpleexe PRIVATE simpleshared) diff --git a/Tests/RunCMake/NinjaMultiConfig/WriteFile.cmake b/Tests/RunCMake/NinjaMultiConfig/WriteFile.cmake new file mode 100644 index 0000000..82681a2 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/WriteFile.cmake @@ -0,0 +1 @@ +file(WRITE "${OUTPUT_FILE}" "Genex config: ${GENEX_CONFIG}\nINTDIR config: ${INTDIR_CONFIG}\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/badmoc.c b/Tests/RunCMake/NinjaMultiConfig/badmoc.c new file mode 100644 index 0000000..aec8dc3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/badmoc.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(void) +{ + printf("BadMoc Configuration: " CONFIG "\n"); + return 1; +} diff --git a/Tests/RunCMake/NinjaMultiConfig/empty.c b/Tests/RunCMake/NinjaMultiConfig/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/empty.c diff --git a/Tests/RunCMake/NinjaMultiConfig/generator.c b/Tests/RunCMake/NinjaMultiConfig/generator.c new file mode 100644 index 0000000..465ee2f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/generator.c @@ -0,0 +1,101 @@ +#include <genex_config.h> +#include <stdio.h> +/* FIXME Get this working */ +/*#include <intdir_config.h>*/ + +const char* generatorlib_genex_config_definition(void); +const char* generatorlib_genex_config_include_dir(void); +const char* generatorobj_genex_config_definition(void); +const char* generatorobj_genex_config_include_dir(void); + +static const char contents[] = + /* clang-format off */ +"#include <stdio.h>\n" +"\n" +"#include <genex_config.h>\n" +/* FIXME Get this working */ +/*"#include <intdir_config.h>\n"*/ +"\n" +"const char* generatorlib_genex_config_definition(void);\n" +"const char* generatorlib_genex_config_include_dir(void);\n" +"const char* generatorobj_genex_config_definition(void);\n" +"const char* generatorobj_genex_config_include_dir(void);\n" +"\n" +"int main(void)\n" +"{\n" +" printf(\n" +" \"Generator genex config definition: " + GENEX_CONFIG_DEFINITION "\\n\"\n" +/* FIXME Get this working */ +/*" \"Generator INTDIR config definition: " + INTDIR_CONFIG_DEFINITION "\\n\"\n"*/ +" \"Generator genex config include dir: " + GENEX_CONFIG_INCLUDE_DIR "\\n\"\n" +/* FIXME Get this working */ +/*" \"Generator INTDIR config include dir: " + INTDIR_CONFIG_INCLUDE_DIR "\\n\"\n"*/ +" \"Generator library genex config definition: %s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generator library INTDIR config definition: %s\\n\"\n"*/ +" \"Generator library genex config include dir: %s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generator library INTDIR config include dir: %s\\n\"\n"*/ +" \"Generator object genex config definition: %s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generator object INTDIR config definition: %s\\n\"\n"*/ +" \"Generator object genex config include dir: %s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generator object INTDIR config include dir: %s\\n\"\n"*/ +" \"Generated genex config definition: \"" + " GENEX_CONFIG_DEFINITION \"\\n\"\n" +/* FIXME Get this working */ +/*" \"Generated INTDIR config definition: \"" + " INTDIR_CONFIG_DEFINITION \"\\n\"\n"*/ +" \"Generated genex config include dir: \"" + " GENEX_CONFIG_INCLUDE_DIR \"\\n\"\n" +/* FIXME Get this working */ +/*" \"Generated INTDIR config include dir: \"" + " INTDIR_CONFIG_INCLUDE_DIR \"\\n\"\n"*/ +" \"Generated library genex config definition: %%s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generated library INTDIR config definition: %%s\\n\"\n"*/ +" \"Generated library genex config include dir: %%s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generated library INTDIR config include dir: %%s\\n\"\n"*/ +" \"Generated object genex config definition: %%s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generated object INTDIR config definition: %%s\\n\"\n"*/ +" \"Generated object genex config include dir: %%s\\n\"\n" +/* FIXME Get this working */ +/*" \"Generated object INTDIR config include dir: %%s\\n\"\n"*/ +" , generatorlib_genex_config_definition()\n" +" , generatorlib_genex_config_include_dir()\n" +" , generatorobj_genex_config_definition()\n" +" , generatorobj_genex_config_include_dir());\n" +" return 0;\n" +"}\n"; +/* clang-format on */ + +int main(int argc, char** argv) +{ + const char* filename; + FILE* fout; + + if (argc < 2) { + fprintf(stderr, "Usage: %s <filename>\n", argv[0]); + return 1; + } + + filename = argv[1]; + if (!(fout = fopen(filename, "w"))) { + fprintf(stderr, "Could not open %s for writing\n", filename); + return 1; + } + fprintf(fout, contents, generatorlib_genex_config_definition(), + generatorlib_genex_config_include_dir(), + generatorobj_genex_config_definition(), + generatorobj_genex_config_include_dir()); + fclose(fout); + + return 0; +} diff --git a/Tests/RunCMake/NinjaMultiConfig/generatorlib.c b/Tests/RunCMake/NinjaMultiConfig/generatorlib.c new file mode 100644 index 0000000..de5c8f3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/generatorlib.c @@ -0,0 +1,24 @@ +#include <genex_config.h> +/* FIXME Get this working */ +/*#include <intdir_config.h>*/ + +const char* generatorlib_genex_config_definition(void) +{ + return GENEX_CONFIG_DEFINITION; +} + +const char* generatorlib_genex_config_include_dir(void) +{ + return GENEX_CONFIG_INCLUDE_DIR; +} + +/* FIXME Get this working */ +/*const char* generatorlib_intdir_config_definition(void) +{ + return INTDIR_CONFIG_DEFINITION; +} + +const char* generatorlib_intdir_config_include_dir(void) +{ + return INTDIR_CONFIG_INCLUDE_DIR; +}*/ diff --git a/Tests/RunCMake/NinjaMultiConfig/generatorobj.c b/Tests/RunCMake/NinjaMultiConfig/generatorobj.c new file mode 100644 index 0000000..7bb5aa6 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/generatorobj.c @@ -0,0 +1,24 @@ +#include <genex_config.h> +/* FIXME Get this working */ +/*#include <intdir_config.h>*/ + +const char* generatorobj_genex_config_definition(void) +{ + return GENEX_CONFIG_DEFINITION; +} + +const char* generatorobj_genex_config_include_dir(void) +{ + return GENEX_CONFIG_INCLUDE_DIR; +} + +/* FIXME Get this working */ +/*const char* generatorobj_intdir_config_definition(void) +{ + return INTDIR_CONFIG_DEFINITION; +} + +const char* generatorobj_intdir_config_include_dir(void) +{ + return INTDIR_CONFIG_INCLUDE_DIR; +}*/ diff --git a/Tests/RunCMake/NinjaMultiConfig/main.c b/Tests/RunCMake/NinjaMultiConfig/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/NinjaMultiConfig/qt5.cxx b/Tests/RunCMake/NinjaMultiConfig/qt5.cxx new file mode 100644 index 0000000..972227f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/qt5.cxx @@ -0,0 +1,9 @@ +#include <QCoreApplication> + +int main(int argc, char** argv) +{ + QCoreApplication app(argc, argv); + return app.exec(); +} + +#include "moc_qt5.cpp" diff --git a/Tests/RunCMake/NinjaMultiConfig/qt5.h b/Tests/RunCMake/NinjaMultiConfig/qt5.h new file mode 100644 index 0000000..b365b92 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/qt5.h @@ -0,0 +1,5 @@ +#include <QObject> +class QBuffer : public QObject +{ + Q_OBJECT +}; diff --git a/Tests/RunCMake/NinjaMultiConfig/simplelib.c b/Tests/RunCMake/NinjaMultiConfig/simplelib.c new file mode 100644 index 0000000..76ff921 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/simplelib.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void simplelib(void) +{ +} 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) |