diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2019-11-27 15:59:20 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2019-12-13 15:52:07 (GMT) |
commit | e0478cc64623fbfcb7dcd748f27b94cc8473fa1a (patch) | |
tree | fa28877d7db948f5aee23a9dbe0bc042d562150b /Tests/RunCMake/NinjaMultiConfig | |
parent | 5a8a9f72293ab1b3fd768ff40e5fb1f07cdb7dd2 (diff) | |
download | CMake-e0478cc64623fbfcb7dcd748f27b94cc8473fa1a.zip CMake-e0478cc64623fbfcb7dcd748f27b94cc8473fa1a.tar.gz CMake-e0478cc64623fbfcb7dcd748f27b94cc8473fa1a.tar.bz2 |
Tests: Add test for Multi-Configuration Ninja generator
Diffstat (limited to 'Tests/RunCMake/NinjaMultiConfig')
71 files changed, 1703 insertions, 0 deletions
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) +{ +} |