mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 14:44:32 +02:00
cmake: use add_compile_definitions supported since 3.12
Now that the supported CMake version is >=3.16, this code can be simplified.
This commit is contained in:
@@ -453,6 +453,7 @@ function(idf_component_register)
|
||||
# idf_build_process
|
||||
idf_build_get_property(include_directories INCLUDE_DIRECTORIES GENERATOR_EXPRESSION)
|
||||
idf_build_get_property(compile_options COMPILE_OPTIONS GENERATOR_EXPRESSION)
|
||||
idf_build_get_property(compile_definitions COMPILE_DEFINITIONS GENERATOR_EXPRESSION)
|
||||
idf_build_get_property(c_compile_options C_COMPILE_OPTIONS GENERATOR_EXPRESSION)
|
||||
idf_build_get_property(cxx_compile_options CXX_COMPILE_OPTIONS GENERATOR_EXPRESSION)
|
||||
idf_build_get_property(asm_compile_options ASM_COMPILE_OPTIONS GENERATOR_EXPRESSION)
|
||||
@@ -460,18 +461,11 @@ function(idf_component_register)
|
||||
|
||||
include_directories("${include_directories}")
|
||||
add_compile_options("${compile_options}")
|
||||
add_compile_definitions("${compile_definitions}")
|
||||
add_c_compile_options("${c_compile_options}")
|
||||
add_cxx_compile_options("${cxx_compile_options}")
|
||||
add_asm_compile_options("${asm_compile_options}")
|
||||
|
||||
# Unfortunately add_definitions() does not support generator expressions. A new command
|
||||
# add_compile_definition() does but is only available on CMake 3.12 or newer. This uses
|
||||
# add_compile_options(), which can add any option as the workaround.
|
||||
#
|
||||
# TODO: Use add_compile_definitions() once minimum supported version is 3.12 or newer.
|
||||
idf_build_get_property(compile_definitions COMPILE_DEFINITIONS GENERATOR_EXPRESSION)
|
||||
add_compile_options("${compile_definitions}")
|
||||
|
||||
if(common_reqs) # check whether common_reqs exists, this may be the case in minimalistic host unit test builds
|
||||
list(REMOVE_ITEM common_reqs ${component_lib})
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user