From 620105ecaf74d2f5271403ce5d4ffd26fc9d9e85 Mon Sep 17 00:00:00 2001 From: MoroccanMalinois Date: Tue, 21 Aug 2018 23:22:33 +0000 Subject: Translations: handle cross compiling --- translations/CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'translations') diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index db60190b1..fdd5014a7 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -30,7 +30,17 @@ cmake_minimum_required(VERSION 2.8.7) project(translations) -add_executable(generate_translations_header generate_translations_header.c) +# when crosscompiling import the executable targets from a file +IF(CMAKE_CROSSCOMPILING) + message(WARNING "CrossCompiling") + SET(IMPORT_EXECUTABLES "${CMAKE_CURRENT_BINARY_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Point it to the export file from a native build") + INCLUDE(${IMPORT_EXECUTABLES}) +ENDIF(CMAKE_CROSSCOMPILING) + +# only build the generator if not crosscompiling +IF(NOT CMAKE_CROSSCOMPILING) + add_executable(generate_translations_header generate_translations_header.c) +ENDIF(NOT CMAKE_CROSSCOMPILING) find_program(LRELEASE lrelease) if(LRELEASE STREQUAL "LRELEASE-NOTFOUND") @@ -61,3 +71,8 @@ add_custom_command(TARGET generate_translations_header COMMAND generate_translations_header ${qm_files} WORKING_DIRECTORY "${CMAKE_CURRENT_BIN_DIR}" COMMENT "Generating embedded translations header") + +# export the generator target to a file, so it can be imported (see above) by another build +IF(NOT CMAKE_CROSSCOMPILING) + EXPORT(TARGETS generate_translations_header FILE ${CMAKE_CURRENT_BINARY_DIR}/ImportExecutables.cmake ) +ENDIF(NOT CMAKE_CROSSCOMPILING) -- cgit v1.2.3