diff --git a/CMakeLists.txt b/CMakeLists.txt index 551d9f9c0c..4b5aceb00a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ if(BUILD_NATIVE_COMPONENTS) endif() # Install Prebuilt ARMHF Toolchain Sysroot -if(BUILD_ARM_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN) +if(BUILD_NATIVE_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN) install_arm_sysroot() endif() @@ -158,7 +158,7 @@ if(BUILD_NATIVE_COMPONENTS) list(APPEND ARM_OPTIONS "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}") endif() else() - list(APPEND ARM_OPTIONS "-DMCPI_USE_PREBUILT_ARMHF_TOOLCHAIN:BOOL=TRUE") + list(APPEND ARM_OPTIONS "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${MCPI_CMAKE_TOOLCHAIN_FILE}") endif() list(APPEND ARM_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}") # Build diff --git a/cmake/options/core-options.cmake b/cmake/options/core-options.cmake index 223260d47c..362e6139ff 100644 --- a/cmake/options/core-options.cmake +++ b/cmake/options/core-options.cmake @@ -19,11 +19,3 @@ function(mcpi_option name description type default) list(APPEND MCPI_OPTIONS "-D${full_name}:${type}=${${full_name}}") set(MCPI_OPTIONS "${MCPI_OPTIONS}" PARENT_SCOPE) endfunction() - -# Prebuilt ARMHF Toolchain -if(BUILD_ARM_COMPONENTS) - mcpi_option(USE_PREBUILT_ARMHF_TOOLCHAIN "Whether To Use A Prebuilt ARMHF Toolchain For Building ARM Components" BOOL FALSE) - if(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN) - include("${CMAKE_CURRENT_LIST_DIR}/prebuilt-armhf-toolchain.cmake") - endif() -endif() diff --git a/cmake/options/extra-options.cmake b/cmake/options/extra-options.cmake index 896aec809e..e63ff41b3a 100644 --- a/cmake/options/extra-options.cmake +++ b/cmake/options/extra-options.cmake @@ -16,6 +16,9 @@ if(BUILD_NATIVE_COMPONENTS) if(NOT IS_ARM_TARGETING) set(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN TRUE) endif() + if(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN) + include("${CMAKE_CURRENT_LIST_DIR}/prebuilt-armhf-toolchain.cmake") + endif() endif() # Media Layer diff --git a/cmake/options/prebuilt-armhf-toolchain.cmake b/cmake/options/prebuilt-armhf-toolchain.cmake index f9181491d1..d1736fac44 100644 --- a/cmake/options/prebuilt-armhf-toolchain.cmake +++ b/cmake/options/prebuilt-armhf-toolchain.cmake @@ -26,7 +26,7 @@ file(WRITE "${toolchain_dir}/toolchain.cmake" "set(CMAKE_SYSTEM_PROCESSOR \"arm\")\n" "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n" ) -set(CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE FILEPATH "" FORCE) +set(MCPI_CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE FILEPATH "" FORCE) # Build Sysroot set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot")