Commit 579c4bec authored by Matt McCormick's avatar Matt McCormick
Browse files

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.
parent 7ee897be
......@@ -119,6 +119,7 @@ Properties on Targets
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/CONFIG_OUTPUT_NAME
/prop_tgt/CONFIG_POSTFIX
/prop_tgt/CROSSCOMPILING_EMULATOR
/prop_tgt/CXX_EXTENSIONS
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_STANDARD_REQUIRED
......
......@@ -25,6 +25,7 @@ Variables that Provide Information
/variable/CMAKE_CFG_INTDIR
/variable/CMAKE_COMMAND
/variable/CMAKE_CROSSCOMPILING
/variable/CMAKE_CROSSCOMPILING_EMULATOR
/variable/CMAKE_CTEST_COMMAND
/variable/CMAKE_CURRENT_BINARY_DIR
/variable/CMAKE_CURRENT_LIST_DIR
......
CROSSCOMPILING_EMULATOR
-----------------------
Use the given emulator to run executables created when crosscompiling.
CMAKE_CROSSCOMPILING_EMULATOR
-----------------------------
Default value for the :prop_tgt:`CROSSCOMPILING_EMULATOR` target property of
executables. See that target property for additional information.
......@@ -442,6 +442,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
if(this->TargetTypeValue == cmTarget::EXECUTABLE)
{
this->SetPropertyDefault("ANDROID_GUI", 0);
this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0);
}
if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY
|| this->TargetTypeValue == cmTarget::MODULE_LIBRARY)
......
......@@ -226,3 +226,7 @@ add_RunCMake_test(COMPILE_LANGUAGE-genex)
if(CMake_TEST_FindMatlab)
add_RunCMake_test(FindMatlab)
endif()
add_executable(pseudo_emulator pseudo_emulator.c)
add_RunCMake_test(CrosscompilingEmulator
-DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>)
cmake_minimum_required(VERSION 3.1)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
# 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()
include(RunCMake)
set(RunCMake_TEST_OPTIONS
"-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR}")
run_cmake(CrosscompilingEmulatorProperty)
int main(int, char **)
{
return 0;
}
#include <stdio.h>
int main(int argc, char * argv[] )
{
int ii;
printf("Command:");
for(ii = 1; ii < argc; ++ii)
{
printf(" \"%s\"", argv[ii]);
}
printf("\n");
return 42;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment