Skip to content

Commit

Permalink
cmake: Guard CMAKE_BUILD_TYPE when integrating with Zephyr
Browse files Browse the repository at this point in the history
Zephyr controls compile and linker flags, such as optimization using
Kconfig and not CMAKE_BUILD_TYPE.

Therefore disable the setting of CMAKE_BUILD_TYPE when Zephyr is used
to avoid situations like `-Os -O2` when compiling Zephyr with Picolibc.

Signed-off-by: Torsten Rasmussen <[email protected]>
  • Loading branch information
tejlmand authored and keith-packard committed Oct 10, 2024
1 parent f757b3f commit d492d5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ project(Picolibc VERSION 1.8.8 LANGUAGES C ASM)
# Set a default build type if none was specified
set(default_build_type "MinSizeRel")

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES AND NOT DEFINED ZEPHYR_BASE)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
Expand Down

0 comments on commit d492d5f

Please sign in to comment.