1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Tests: Simplify RunCMake.ExcludeFromAll single-config case

Also avoid using parts of an unrelated test (NinjaMultiConfig)
that were not designed for use with all generators.
This commit is contained in:
Brad King
2020-07-23 07:07:12 -04:00
parent 36743436cf
commit 807c8aa9f0
2 changed files with 4 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ function(run_single_config_test label config exclude_from_all_value expectation)
-DCMAKE_BUILD_TYPE=${config}
-DTOOL_EXCLUDE_FROM_ALL=${exclude_from_all_value})
set(RunCMake_TEST_NO_CLEAN 1)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
include(${RunCMake_TEST_BINARY_DIR}/target_files_${config}.cmake)
run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config ${config})
endfunction()

View File

@@ -2,10 +2,6 @@ enable_language(C)
add_executable(tool main.c)
set_property(TARGET tool PROPERTY EXCLUDE_FROM_ALL "${TOOL_EXCLUDE_FROM_ALL}")
include(../NinjaMultiConfig/Common.cmake)
set(orig_CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES})
if("${CMAKE_CONFIGURATION_TYPES}" STREQUAL "")
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
endif()
generate_output_files(tool)
set(CMAKE_CONFIGURATION_TYPES ${orig_CMAKE_CONFIGURATION_TYPES})
file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/target_files_$<CONFIG>.cmake" CONTENT [[
set(TARGET_FILE_tool_$<CONFIG> [==[$<TARGET_FILE:tool>]==])
]])