summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--CMakeLists.txt12
-rw-r--r--dbug/CMakeLists.txt16
-rw-r--r--sql/CMakeLists.txt4
4 files changed, 25 insertions, 8 deletions
diff --git a/.bzrignore b/.bzrignore
index d5874ebf0f2..1de58b16581 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1459,3 +1459,4 @@ libmysql/libmysql_versions.ld
scripts/mysql_config.pl
pcre/pcre_chartables.c
pcre/test*grep
+import_executables.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4ce461022b..bad38462007 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -386,6 +386,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 "IMPORTFILE-NOTFOUND" 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)
@@ -451,6 +456,13 @@ IF(WIN32)
ENDIF()
ADD_SUBDIRECTORY(packaging/solaris)
+IF(NOT CMAKE_CROSSCOMPILING)
+ SET(EXPORTED comp_err comp_sql factorial gen_lex_hash)
+ # minimal target to build only binaries for export
+ ADD_CUSTOM_TARGET(import_executables DEPENDS ${EXPORTED})
+ EXPORT(TARGETS ${EXPORTED} 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
diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt
index 3d0b0801132..c40c70b684d 100644
--- a/dbug/CMakeLists.txt
+++ b/dbug/CMakeLists.txt
@@ -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)
@@ -36,11 +38,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}
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 965f25cbb13..2cf2fc2d133 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -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