mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
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
This commit is contained in:
parent
fbfa004327
commit
cdc38712e4
3 changed files with 22 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -24,8 +24,10 @@ TARGET_LINK_LIBRARIES(dbug mysys)
|
|||
ADD_EXECUTABLE(tests tests.c)
|
||||
TARGET_LINK_LIBRARIES(tests dbug)
|
||||
|
||||
ADD_EXECUTABLE(factorial my_main.c factorial.c)
|
||||
TARGET_LINK_LIBRARIES(factorial dbug)
|
||||
IF(NOT CMAKE_CROSSCOMPILING)
|
||||
ADD_EXECUTABLE(factorial my_main.c factorial.c)
|
||||
TARGET_LINK_LIBRARIES(factorial dbug)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode)
|
||||
FIND_PROGRAM(GROFF groff)
|
||||
|
@ -34,11 +36,11 @@ IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode)
|
|||
SET(SOURCE_INC factorial.r main.r example1.r example2.r example3.r)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT_INC}
|
||||
DEPENDS factorial
|
||||
COMMAND ./factorial 1 2 3 4 5 > output1.r
|
||||
COMMAND ./factorial -\#t:o 2 3 > output2.r
|
||||
COMMAND ./factorial -\#d:t:o 3 > output3.r
|
||||
COMMAND ./factorial -\#d,result:o 4 > output4.r
|
||||
COMMAND ./factorial -\#d:f,factorial:F:L:o 3 > output5.r)
|
||||
COMMAND factorial 1 2 3 4 5 > output1.r
|
||||
COMMAND factorial -\#t:o 2 3 > output2.r
|
||||
COMMAND factorial -\#d:t:o 3 > output3.r
|
||||
COMMAND factorial -\#d,result:o 4 > output4.r
|
||||
COMMAND factorial -\#d:f,factorial:F:L:o 3 > output5.r)
|
||||
FOREACH(file ${SOURCE_INC})
|
||||
STRING(REGEX REPLACE "\\.r" ".c" srcfile ${file})
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${file} DEPENDS ${srcfile}
|
||||
|
|
|
@ -218,7 +218,9 @@ RUN_BISON(
|
|||
)
|
||||
|
||||
# Gen_lex_hash
|
||||
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
|
||||
IF(NOT CMAKE_CROSSCOMPILING)
|
||||
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
|
||||
|
|
Loading…
Reference in a new issue