Skip to content

Commit c9cacaf

Browse files
0xc0170hugueskamba
authored andcommitted
CMake: fix application config
These settings like enable_language should be done in the application and just once. We hit the issue when you expose sources to an app (interface or public), CMake errors as some of the internal settings have not been configured.
1 parent e0eee75 commit c9cacaf

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ if(POLICY CMP0076)
1010
cmake_policy(SET CMP0076 NEW)
1111
endif()
1212

13-
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
14-
15-
# Set default toolchain file
16-
if(NOT CMAKE_TOOLCHAIN_FILE)
17-
set(CMAKE_TOOLCHAIN_FILE "${MBED_ROOT}/tools/cmake/toolchain.cmake" CACHE INTERNAL "")
18-
endif()
19-
20-
# Toolchain setup
21-
include(${MBED_ROOT}/tools/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
22-
enable_language(C CXX ASM)
23-
2413
include(${MBED_ROOT}/tools/cmake/core.cmake)
2514
include(${MBED_ROOT}/tools/cmake/profile.cmake)
2615

tools/cmake/app.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
5+
6+
# Set default toolchain file
7+
if(NOT CMAKE_TOOLCHAIN_FILE)
8+
set(CMAKE_TOOLCHAIN_FILE "${MBED_ROOT}/tools/cmake/toolchain.cmake" CACHE INTERNAL "")
9+
endif()
10+
11+
# Toolchain setup
12+
include(${MBED_ROOT}/tools/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
13+
enable_language(C CXX ASM)

0 commit comments

Comments
 (0)