cmake: extensions: Add corresponding ifndef for all ifdef functions

This commit adds the corresponding '_ifndef' functions for all the
existing '_ifdef' functions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2021-08-18 23:25:06 +09:00 committed by Anas Nashif
commit 52b2d39b6a

View file

@ -1485,6 +1485,48 @@ function(set_ifndef variable value)
endif()
endfunction()
function(add_subdirectory_ifndef feature_toggle source_dir)
if(NOT ${feature_toggle})
add_subdirectory(${source_dir} ${ARGN})
endif()
endfunction()
function(target_sources_ifndef feature_toggle target scope item)
if(NOT ${feature_toggle})
target_sources(${target} ${scope} ${item} ${ARGN})
endif()
endfunction()
function(target_compile_definitions_ifndef feature_toggle target scope item)
if(NOT ${feature_toggle})
target_compile_definitions(${target} ${scope} ${item} ${ARGN})
endif()
endfunction()
function(target_include_directories_ifndef feature_toggle target scope item)
if(NOT ${feature_toggle})
target_include_directories(${target} ${scope} ${item} ${ARGN})
endif()
endfunction()
function(target_link_libraries_ifndef feature_toggle target item)
if(NOT ${feature_toggle})
target_link_libraries(${target} ${item} ${ARGN})
endif()
endfunction()
function(add_compile_option_ifndef feature_toggle option)
if(NOT ${feature_toggle})
add_compile_options(${option})
endif()
endfunction()
function(target_compile_option_ifndef feature_toggle target scope option)
if(NOT ${feature_toggle})
target_compile_options(${target} ${scope} ${option})
endif()
endfunction()
function(target_cc_option_ifndef feature_toggle target scope option)
if(NOT ${feature_toggle})
target_cc_option(${target} ${scope} ${option})
@ -1509,12 +1551,78 @@ function(zephyr_cc_option_ifndef feature_toggle)
endif()
endfunction()
function(zephyr_ld_option_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_ld_options(${ARGN})
endif()
endfunction()
function(zephyr_link_libraries_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_link_libraries(${ARGN})
endif()
endfunction()
function(zephyr_compile_options_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_compile_options(${ARGN})
endif()
endfunction()
function(zephyr_compile_definitions_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_compile_definitions(${ARGN})
endif()
endfunction()
function(zephyr_include_directories_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_include_directories(${ARGN})
endif()
endfunction()
function(zephyr_library_compile_definitions_ifndef feature_toggle item)
if(NOT ${feature_toggle})
zephyr_library_compile_definitions(${item} ${ARGN})
endif()
endfunction()
function(zephyr_library_include_directories_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_library_include_directories(${ARGN})
endif()
endfunction()
function(zephyr_library_compile_options_ifndef feature_toggle item)
if(NOT ${feature_toggle})
zephyr_library_compile_options(${item} ${ARGN})
endif()
endfunction()
function(zephyr_link_interface_ifndef feature_toggle interface)
if(NOT ${feature_toggle})
target_link_libraries(${interface} INTERFACE zephyr_interface)
endif()
endfunction()
function(zephyr_library_link_libraries_ifndef feature_toggle item)
if(NOT ${feature_toggle})
zephyr_library_link_libraries(${item})
endif()
endfunction()
function(zephyr_linker_sources_ifndef feature_toggle)
if(NOT ${feature_toggle})
zephyr_linker_sources(${ARGN})
endif()
endfunction()
macro(list_append_ifndef feature_toggle list)
if(NOT ${feature_toggle})
list(APPEND ${list} ${ARGN})
endif()
endmacro()
# 3.3. *_option Compiler-compatibility checks
#
# Utility functions for silently omitting compiler flags when the