summaryrefslogtreecommitdiff
path: root/src/strgen
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2020-07-01 02:52:32 +0200
committerOwen Rudge <owen@owenrudge.net>2020-12-04 09:49:31 +0000
commita06fe8e8a7d749f1fbd08102a9516acd51171b24 (patch)
tree97b90a5a5229c8c1fae0729cf8ccba18d08243f5 /src/strgen
parent0b2dd2c5cd39833945fcea3a39811898bf40c6b5 (diff)
downloadopenttd-a06fe8e8a7d749f1fbd08102a9516acd51171b24.tar.xz
Fix: [CMake] cross-compiling requires native tools
Diffstat (limited to 'src/strgen')
-rw-r--r--src/strgen/CMakeLists.txt30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/strgen/CMakeLists.txt b/src/strgen/CMakeLists.txt
index b8f61cde3..c638b5c6e 100644
--- a/src/strgen/CMakeLists.txt
+++ b/src/strgen/CMakeLists.txt
@@ -1,22 +1,26 @@
cmake_minimum_required(VERSION 3.5)
-project(strgen)
+if (NOT HOST_BINARY_DIR)
+ project(strgen)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
-set(sourcefiles
- strgen.cpp
- strgen_base.cpp
- ../core/alloc_func.cpp
- ../misc/getoptdata.cpp
- ../string.cpp
-)
-add_definitions(-DSTRGEN)
-add_executable(strgen ${sourcefiles})
+ set(sourcefiles
+ strgen.cpp
+ strgen_base.cpp
+ ../core/alloc_func.cpp
+ ../misc/getoptdata.cpp
+ ../string.cpp
+ )
+ add_definitions(-DSTRGEN)
+ add_executable(strgen ${sourcefiles})
-include(Endian)
-add_endian_definition()
+ include(Endian)
+ add_endian_definition()
+ export(TARGETS strgen FILE ${CMAKE_BINARY_DIR}/strgen.cmake)
+ add_dependencies(tools strgen)
+endif()
# Source Files
add_files(strgen_base.cpp)