summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake
blob: 2fdefc4ce72607b53093d9702110177c6ff93828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# This tests setting the CROSSCOMPILING_EMULATOR target property from the
# CMAKE_CROSSCOMPILING_EMULATOR variable.

# -DCMAKE_CROSSCOMPILING_EMULATOR=/path/to/pseudo_emulator is passed to this
# test
add_executable(target_with_emulator simple_src_exiterror.cxx)
get_property(emulator TARGET target_with_emulator
             PROPERTY CROSSCOMPILING_EMULATOR)
if(NOT "${emulator}" MATCHES "pseudo_emulator")
  message(SEND_ERROR "Default CROSSCOMPILING_EMULATOR property not set")
endif()

set_property(TARGET target_with_emulator
             PROPERTY CROSSCOMPILING_EMULATOR "another_emulator")
get_property(emulator TARGET target_with_emulator
             PROPERTY CROSSCOMPILING_EMULATOR)
if(NOT "${emulator}" MATCHES "another_emulator")
  message(SEND_ERROR
    "set_property/get_property CROSSCOMPILING_EMULATOR is not consistent")
endif()

unset(CMAKE_CROSSCOMPILING_EMULATOR CACHE)
add_executable(target_without_emulator simple_src_exiterror.cxx)
get_property(emulator TARGET target_without_emulator
             PROPERTY CROSSCOMPILING_EMULATOR)
if(NOT "${emulator}" STREQUAL "")
  message(SEND_ERROR "Default CROSSCOMPILING_EMULATOR property not set to null")
endif()

add_executable(target_with_empty_emulator simple_src_exiterror.cxx)
set_property(TARGET target_with_empty_emulator PROPERTY CROSSCOMPILING_EMULATOR "")

enable_testing()
add_test(NAME test_target_with_empty_emulator COMMAND target_with_empty_emulator)