CMake app: add our cmake folder to CMAKE_MODULE_PATH

All files within tools/cmake can now include within tools/cmake. We do not expose
internal folders like core/profiles/toolchains.
They should be included via toolchain file (mbed_toolchain in our case).
pull/14516/head
Martin Kojtal 2021-04-08 13:45:03 +01:00
parent b88d5687e2
commit ed609f57c4
3 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Add our CMake list files to CMake default module path
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}")
find_program(CCACHE "ccache")
if(CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
@ -12,11 +15,11 @@ include(${MBED_CONFIG_PATH}/mbed_config.cmake)
# Load toolchain file
if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED)
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
include(${mbed-os_SOURCE_DIR}/tools/cmake/toolchain.cmake)
include(toolchain)
endif()
# Specify available build profiles and add options for the selected build profile
include(${mbed-os_SOURCE_DIR}/tools/cmake/profile.cmake)
include(profile)
enable_language(C CXX ASM)
@ -26,7 +29,7 @@ set(CMAKE_EXECUTABLE_SUFFIX .elf)
# Find Python
find_package(Python3 COMPONENTS Interpreter)
include(${CMAKE_CURRENT_LIST_DIR}/CheckPythonPackage.cmake)
include(CheckPythonPackage)
# Check python packages from requirements.txt
file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/requirements.txt PYTHON_REQUIREMENTS)

View File

@ -29,4 +29,4 @@ else()
endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/profiles/${LOWERCASE_CMAKE_BUILD_TYPE}.cmake)
include(profiles/${LOWERCASE_CMAKE_BUILD_TYPE})

View File

@ -100,8 +100,9 @@ set(link_options "")
set(common_options "")
set(c_cxx_compile_options "") # compile options only for C/CXX
set(asm_compile_options "") # compile options only for ASM
include(${CMAKE_CURRENT_LIST_DIR}/toolchains/${MBED_TOOLCHAIN}.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cores/${MBED_CPU_CORE}.cmake)
include(toolchains/${MBED_TOOLCHAIN})
include(cores/${MBED_CPU_CORE})
#converts a list into a string with each of its elements seperated by a space
macro(list_to_space_separated OUTPUT_VAR)# 2nd arg: LIST...