mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-22 15:58:41 -05:00
b3b1c7bf3a
The "all" target in each directory is supposed to have targets from that
directory even if the directory itself is marked `EXCLUDE_FROM_ALL` in
its parent. This was broken by commit dc6888573d (Pass EXCLUDE_FROM_ALL
from directory to targets, 2019-01-15, v3.14.0-rc1~83^2) which made the
participation of a target in "all" independent of context. Revert much
of the logic change from that commit to restore the old behavior. Then
re-implement the behavior intended by the commit to keep its test
working. Extend the test to cover the old behavior too.
Fixes: #19753
61 lines
2.4 KiB
CMake
61 lines
2.4 KiB
CMake
include(RunCMake)
|
|
|
|
run_cmake(DoesNotExist)
|
|
run_cmake(Missing)
|
|
run_cmake(Function)
|
|
|
|
macro(run_cmake_install case)
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
set(RunCMake_TEST_OPTIONS ${ARGN})
|
|
|
|
run_cmake(${case})
|
|
run_cmake_command(${case}-install ${CMAKE_COMMAND} -P cmake_install.cmake)
|
|
run_cmake_command(${case}-install-component ${CMAKE_COMMAND} -DCOMPONENT=Unspecified -P cmake_install.cmake)
|
|
|
|
unset(RunCMake_TEST_BINARY_DIR)
|
|
unset(RunCMake_TEST_NO_CLEAN)
|
|
unset(RunCMake_TEST_OPTIONS)
|
|
endmacro()
|
|
|
|
run_cmake_install(CMP0082-WARN)
|
|
run_cmake_install(CMP0082-WARN-Nested)
|
|
run_cmake_install(CMP0082-WARN-NestedSub)
|
|
run_cmake_install(CMP0082-WARN-None)
|
|
run_cmake_install(CMP0082-WARN-NoTopInstall)
|
|
run_cmake_install(CMP0082-OLD -DCMP0082_VALUE=OLD)
|
|
run_cmake_install(CMP0082-NEW -DCMP0082_VALUE=NEW)
|
|
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build)
|
|
if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
|
set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
|
|
endif()
|
|
run_cmake(ExcludeFromAll)
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
set(RunCMake-check-file ExcludeFromAll/check.cmake)
|
|
run_cmake_command(ExcludeFromAll-build ${CMAKE_COMMAND} --build . --config Debug)
|
|
if(RunCMake_GENERATOR STREQUAL "Ninja")
|
|
if(WIN32)
|
|
set(slash [[\]])
|
|
else()
|
|
set(slash [[/]])
|
|
endif()
|
|
set(RunCMake-check-file ExcludeFromAll/check-sub.cmake)
|
|
run_cmake_command(ExcludeFromAll-build-sub ${CMAKE_COMMAND} --build . --target "ExcludeFromAll${slash}all")
|
|
elseif(RunCMake_GENERATOR MATCHES "Make")
|
|
set(RunCMake-check-file ExcludeFromAll/check-sub.cmake)
|
|
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY ${RunCMake_BINARY_DIR}/ExcludeFromAll-build/ExcludeFromAll)
|
|
run_cmake_command(ExcludeFromAll-build-sub "${RunCMake_MAKE_PROGRAM}")
|
|
elseif(RunCMake_GENERATOR MATCHES "^Visual Studio [1-9][0-9]")
|
|
set(RunCMake-check-file ExcludeFromAll/check-sub.cmake)
|
|
run_cmake_command(ExcludeFromAll-build-sub ${CMAKE_COMMAND} --build ExcludeFromAll --config Debug)
|
|
elseif(RunCMake_GENERATOR STREQUAL "Xcode")
|
|
set(RunCMake-check-file ExcludeFromAll/check-sub.cmake)
|
|
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY ${RunCMake_BINARY_DIR}/ExcludeFromAll-build/ExcludeFromAll)
|
|
run_cmake_command(ExcludeFromAll-build-sub xcodebuild -configuration Debug)
|
|
endif()
|
|
unset(RunCMake-check-file)
|
|
unset(RunCMake_TEST_NO_CLEAN)
|
|
unset(RunCMake_TEST_OPTIONS)
|
|
unset(RunCMake_TEST_BINARY_DIR)
|