diff options
author | James Le Cuirot <chewi@aura-online.co.uk> | 2014-04-27 00:02:19 +0100 |
---|---|---|
committer | James Le Cuirot <chewi@aura-online.co.uk> | 2014-04-27 00:02:19 +0100 |
commit | cdc38712e4d359348346758e47e1ebc7d1743f82 (patch) | |
tree | 369cb23b079daf840b5df010b7b5e5ca99a3a958 /CMakeLists.txt | |
parent | fbfa0043279757b2860e846c82cbf55ab92af9b8 (diff) | |
download | mariadb-git-cdc38712e4d359348346758e47e1ebc7d1743f82.tar.gz |
MySQL Bug #61340: Use CMake EXPORT feature to aid cross-compiling.
This technique is documented at:
http://www.cmake.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build
Basic steps are:
# mkdir native cross
# cd native
# cmake /path/to/maria
# make IMPORT_EXECUTABLES
# cd ../cross
# cmake -DCMAKE_TOOLCHAIN_FILE=foo -DIMPORT_EXECUTABLES=/path/to/native/import_executables.cmake /path/to/maria
# make
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f8ebddc70fe..20067ad5363 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,6 +380,11 @@ ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO") SET(CMAKE_CXX_FLAGS_DEBUG "${MY_MAINTAINER_CXX_WARNINGS} ${CMAKE_CXX_FLAGS_DEBUG}") ENDIF() +IF(CMAKE_CROSSCOMPILING) + SET(IMPORT_EXECUTABLES "IMPORT_EXECUTABLES_NOT_SET" CACHE FILEPATH "Path to import_executables.cmake from a native build") + INCLUDE(${IMPORT_EXECUTABLES}) +ENDIF() + IF(WITH_UNIT_TESTS) ENABLE_TESTING() ADD_SUBDIRECTORY(unittest/mytap) @@ -443,6 +448,11 @@ IF(WIN32) ENDIF() ADD_SUBDIRECTORY(packaging/solaris) +IF(NOT CMAKE_CROSSCOMPILING) + ADD_CUSTOM_TARGET(IMPORT_EXECUTABLES DEPENDS comp_err comp_sql factorial gen_lex_hash) + EXPORT(TARGETS comp_err comp_sql factorial gen_lex_hash FILE ${CMAKE_BINARY_DIR}/import_executables.cmake) +ENDIF() + CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h) CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in |