cmake: extensions: Added a new macro zephyr_library_ifdef

Checks if a certain Kconfig is enabled and then do the same
operation as zephyr_library.
If it finds that the Kconfig is not set it will not
create a new library and will stop processing the rest of
the CMakeFile.txt. Usefull in processing the driver Cmake
files.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2018-03-27 15:12:02 +05:30 committed by Anas Nashif
commit c674167fea

View file

@ -905,6 +905,18 @@ macro(list_append_ifdef feature_toggle list)
endif() endif()
endmacro() endmacro()
# Checks if a feature is enabled and then does the same operation as
# zephyr_library. If it finds that the feature is not set it will not
# create a new library and will stop processing the rest of
# the CMakeFile.txt
macro(zephyr_library_ifdef feature_toggle)
if(${${feature_toggle}})
zephyr_library()
else()
return()
endif()
endmacro()
# 3.2. *_ifndef # 3.2. *_ifndef
# See 3.1 *_ifdef # See 3.1 *_ifdef
function(set_ifndef variable value) function(set_ifndef variable value)