Files
CMake/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake
Peter Würth 26d813092b add_custom_{command,target}: add genex support for COMMENT
Evaluate and expand generator expressions in the `COMMENT` argument of
the `add_custom_command()` and `add_custom_target()` commands.
This allows to include generator expressions, e.g. a targets location
$<TARGET_...> or the current configuration $<CONFIG>, in the build-time
messages.

Fixes #22507
2022-11-19 13:32:56 +01:00

35 lines
1.0 KiB
CMake

include(RunCMake)
run_cmake(BadByproduct)
run_cmake(BadCommand)
run_cmake(BadTargetName)
run_cmake(ByproductsNoCommand)
run_cmake(CommandExpandsEmpty)
run_cmake(GeneratedProperty)
run_cmake(LiteralQuotes)
run_cmake(NoArguments)
run_cmake(UsesTerminalNoCommand)
function(run_TargetOrder)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TargetOrder-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(TargetOrder)
if(RunCMake_GENERATOR STREQUAL "Ninja")
set(build_flags -j 1 -v)
endif()
run_cmake_command(TargetOrder-build ${CMAKE_COMMAND} --build . -- ${build_flags})
endfunction()
run_TargetOrder()
if(NOT RunCMake_GENERATOR STREQUAL "Xcode")
block()
run_cmake(CommentGenex)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommentGenex-build)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(CommentGenex-build ${CMAKE_COMMAND} --build .)
endblock()
endif()