Skip to content

Commit ed609f5

Browse files
committed
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).
1 parent b88d568 commit ed609f5

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

tools/cmake/app.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
# Add our CMake list files to CMake default module path
5+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}")
6+
47
find_program(CCACHE "ccache")
58
if(CCACHE)
69
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
@@ -12,11 +15,11 @@ include(${MBED_CONFIG_PATH}/mbed_config.cmake)
1215
# Load toolchain file
1316
if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED)
1417
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
15-
include(${mbed-os_SOURCE_DIR}/tools/cmake/toolchain.cmake)
18+
include(toolchain)
1619
endif()
1720

1821
# Specify available build profiles and add options for the selected build profile
19-
include(${mbed-os_SOURCE_DIR}/tools/cmake/profile.cmake)
22+
include(profile)
2023

2124
enable_language(C CXX ASM)
2225

@@ -26,7 +29,7 @@ set(CMAKE_EXECUTABLE_SUFFIX .elf)
2629

2730
# Find Python
2831
find_package(Python3 COMPONENTS Interpreter)
29-
include(${CMAKE_CURRENT_LIST_DIR}/CheckPythonPackage.cmake)
32+
include(CheckPythonPackage)
3033

3134
# Check python packages from requirements.txt
3235
file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/requirements.txt PYTHON_REQUIREMENTS)

tools/cmake/profile.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ else()
2929
endif()
3030
endif()
3131

32-
include(${CMAKE_CURRENT_LIST_DIR}/profiles/${LOWERCASE_CMAKE_BUILD_TYPE}.cmake)
32+
include(profiles/${LOWERCASE_CMAKE_BUILD_TYPE})

tools/cmake/toolchain.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ set(link_options "")
100100
set(common_options "")
101101
set(c_cxx_compile_options "") # compile options only for C/CXX
102102
set(asm_compile_options "") # compile options only for ASM
103-
include(${CMAKE_CURRENT_LIST_DIR}/toolchains/${MBED_TOOLCHAIN}.cmake)
104-
include(${CMAKE_CURRENT_LIST_DIR}/cores/${MBED_CPU_CORE}.cmake)
103+
104+
include(toolchains/${MBED_TOOLCHAIN})
105+
include(cores/${MBED_CPU_CORE})
105106

106107
#converts a list into a string with each of its elements seperated by a space
107108
macro(list_to_space_separated OUTPUT_VAR)# 2nd arg: LIST...

0 commit comments

Comments
 (0)