-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: Add option for exporting build metadata to Make
Add an opt-in feature that will generate a Makefile with build variables like CC, and KBUILD_CFLAGS for consumption by third-party Make-based build systems. This emulates the 'outputexports' target that KBuild supported and is supported for the same reasons that KBuild supported it. Easier integration with third-party build systems. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
- Loading branch information
1 parent
bd9962d
commit 5803846
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2020 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set(exports | ||
" | ||
CC = ${CMAKE_C_COMPILER} | ||
CXX = ${CMAKE_CXX_COMPILER} | ||
OBJCOPY = ${CMAKE_OBJCOPY} | ||
OBJDUMP = ${CMAKE_OBJDUMP} | ||
AS = ${CMAKE_AS} | ||
AR = ${CMAKE_AR} | ||
NM = ${CMAKE_NM} | ||
GDB = ${CMAKE_GDB} | ||
Z_CFLAGS = -I$<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_INCLUDE_DIRECTORIES>, -I> -isystem $<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>, -isystem > -D$<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_DEFINITIONS>, -D> $<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_OPTIONS>, > | ||
" | ||
) | ||
|
||
# file(GENERATE writes a file at Generation time. Also, it writes one | ||
# file per detected configuration, in this case, each COMPILE_LANGUAGE | ||
# is a new configuration. | ||
# | ||
# We use 'file(GENERATE' instead of configure_file because we want to | ||
# generate the file after Configure-time to have all the | ||
# metadata. Also, we don't use 'add_custom_command' because it cannot | ||
# read the generator expressions that we use. | ||
file(GENERATE | ||
OUTPUT ${CMAKE_BINARY_DIR}/Makefile.exports.$<COMPILE_LANGUAGE> | ||
CONTENT "${exports}" | ||
) |