CMake/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
Brad King 13ece67a58 Add genex support to TEST_LAUNCHER and CROSSCOMPILING_EMULATOR
Evaluate generator expressions in these properties, as they apply to
`add_test`, `add_custom_command`, and `add_custom_target`.

The `CMAKE_CROSSCOMPILING_EMULATOR` variable's `try_run` behavior occurs
at configure time and so cannot support generator expressions.
2024-01-29 10:30:24 -05:00

18 lines
645 B
CMake

enable_language(C)
set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
get_property(emulator TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR)
set_property(TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR "$<1:${emulator}>")
add_custom_command(OUTPUT output
COMMAND generated_exe_emulator_expected
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output
DEPENDS generated_exe_emulator_expected)
add_custom_target(ensure_build ALL
SOURCES
${CMAKE_CURRENT_BINARY_DIR}/output
)