mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 03:59:58 +00:00
Tests: Check that CROSSCOMPILING_EMULATOR is not used on imported targets
This commit is contained in:
parent
e7480d670b
commit
f648b9be63
@ -4,7 +4,15 @@ set(CMAKE_CROSSCOMPILING 1)
|
||||
add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx)
|
||||
|
||||
# Executable: Return error code equal to 0
|
||||
add_executable(generated_exe_emulator_unexpected simple_src_exitsuccess.cxx)
|
||||
add_executable(generated_exe_emulator_unexpected generated_exe_emulator_unexpected.cxx)
|
||||
# Place the executable in a predictable location.
|
||||
set_property(TARGET generated_exe_emulator_unexpected PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}>)
|
||||
|
||||
# Executable: Imported version of above. Fake the imported target to use the above.
|
||||
add_executable(generated_exe_emulator_unexpected_imported IMPORTED)
|
||||
set_property(TARGET generated_exe_emulator_unexpected_imported PROPERTY IMPORTED_LOCATION
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated_exe_emulator_unexpected${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
add_dependencies(generated_exe_emulator_unexpected_imported generated_exe_emulator_unexpected)
|
||||
|
||||
# DoesNotUseEmulator
|
||||
add_custom_command(OUTPUT output1
|
||||
@ -22,6 +30,12 @@ add_custom_command(OUTPUT output3
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3
|
||||
DEPENDS generated_exe_emulator_unexpected)
|
||||
|
||||
# DoesNotUseEmulator: The command will fail if emulator is prepended
|
||||
add_custom_command(OUTPUT outputImp
|
||||
COMMAND generated_exe_emulator_unexpected_imported
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/outputImp
|
||||
)
|
||||
|
||||
# UsesEmulator: The command only succeeds if the emulator is prepended
|
||||
# to the command.
|
||||
add_custom_command(OUTPUT output4
|
||||
@ -34,5 +48,6 @@ add_custom_target(ensure_build ALL
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output1
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output2
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output3
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputImp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output4
|
||||
)
|
||||
|
@ -4,7 +4,15 @@ set(CMAKE_CROSSCOMPILING 1)
|
||||
add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx)
|
||||
|
||||
# Executable: Return error code equal to 0
|
||||
add_executable(generated_exe_emulator_unexpected simple_src_exitsuccess.cxx)
|
||||
add_executable(generated_exe_emulator_unexpected generated_exe_emulator_unexpected.cxx)
|
||||
# Place the executable in a predictable location.
|
||||
set_property(TARGET generated_exe_emulator_unexpected PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}>)
|
||||
|
||||
# Executable: Imported version of above. Fake the imported target to use the above.
|
||||
add_executable(generated_exe_emulator_unexpected_imported IMPORTED)
|
||||
set_property(TARGET generated_exe_emulator_unexpected_imported PROPERTY IMPORTED_LOCATION
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated_exe_emulator_unexpected${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
add_dependencies(generated_exe_emulator_unexpected_imported generated_exe_emulator_unexpected)
|
||||
|
||||
# DoesNotUseEmulator
|
||||
add_custom_target(generate_output1 ALL
|
||||
@ -22,6 +30,12 @@ add_custom_target(generate_output3 ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3
|
||||
DEPENDS generated_exe_emulator_unexpected)
|
||||
|
||||
# DoesNotUseEmulator: The command will fail if emulator is prepended
|
||||
add_custom_target(generate_outputImp ALL
|
||||
COMMAND generated_exe_emulator_unexpected_imported
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/outputImp
|
||||
)
|
||||
|
||||
# UsesEmulator: The command only succeeds if the emulator is prepended
|
||||
# to the command.
|
||||
add_custom_target(generate_output4 ALL
|
||||
|
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
fprintf(stderr, "unexpected argument: '%s'\n", argv[i]);
|
||||
}
|
||||
return argc == 1 ? 0 : 1;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user