Skip to content

Commit

Permalink
Pass CMAKE_TOOLCHAIN_FILE if crosscompiling (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
esteve authored and dirk-thomas committed May 6, 2019
1 parent 241fcdd commit 8b746c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sqlite3_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
find_package(SQLite3)

if (NOT SQLite3_FOUND)
set(extra_cmake_args)

if(DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND extra_cmake_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()

include(ExternalProject)
ExternalProject_Add(sqlite3-3.24.0
PREFIX sqlite3-3.24.0
URL https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip
URL_MD5 4ea1e0c6e7e82cb0490d4753d6878698
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/sqlite3_install
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/sqlite3_install
${extra_cmake_args}
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/sqlite3_install"
PATCH_COMMAND
${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/sqlite3_cmakelists.txt" <SOURCE_DIR>/CMakeLists.txt
Expand All @@ -30,4 +38,4 @@ install(DIRECTORY cmake DESTINATION share/${PROJECT_NAME})
install(FILES
"${PROJECT_BINARY_DIR}/sqlite3_vendorConfig.cmake"
"${PROJECT_BINARY_DIR}/sqlite3_vendorConfig-version.cmake"
DESTINATION share/${PROJECT_NAME}/cmake)
DESTINATION share/${PROJECT_NAME}/cmake)

0 comments on commit 8b746c7

Please sign in to comment.