summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CrosscompilingEmulator
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-03-24 04:02:50 (GMT)
committerMatt McCormick <matt.mccormick@kitware.com>2015-04-07 17:33:34 (GMT)
commit579c4bec6e2352448f78d9333f7382ff34a08e5a (patch)
treedeb2161d3058d0ecdda1b126994cb5866d060853 /Tests/RunCMake/CrosscompilingEmulator
parent7ee897beec045761e796ac7468ed6e43cd58f1fe (diff)
downloadCMake-579c4bec6e2352448f78d9333f7382ff34a08e5a.zip
CMake-579c4bec6e2352448f78d9333f7382ff34a08e5a.tar.gz
CMake-579c4bec6e2352448f78d9333f7382ff34a08e5a.tar.bz2
Properties: Add CROSSCOMPILING_EMULATOR target property.
Add CROSSCOMPILING_EMULATOR target property for executables. This is used by subsequent patches to run exectuables created for the target system when crosscompiling. The property is initialized by the CMAKE_CROSSCOMPILING_EMULATOR variable when defined.
Diffstat (limited to 'Tests/RunCMake/CrosscompilingEmulator')
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake28
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx4
4 files changed, 41 insertions, 0 deletions
diff --git a/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt b/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt
new file mode 100644
index 0000000..2d75985
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.1)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake
new file mode 100644
index 0000000..22d537c
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake
@@ -0,0 +1,28 @@
+# 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.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.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()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake
new file mode 100644
index 0000000..cecc57f
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+set(RunCMake_TEST_OPTIONS
+ "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR}")
+
+run_cmake(CrosscompilingEmulatorProperty)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx
new file mode 100644
index 0000000..630adc6
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx
@@ -0,0 +1,4 @@
+int main(int, char **)
+{
+ return 0;
+}