mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/add_subdirectory_if_exists' into 'master'
cmake: add subdirectory if exists utility See merge request espressif/esp-idf!7302
This commit is contained in:
commit
dc63badbd2
@ -302,4 +302,17 @@ function(file_generate output)
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${output}")
|
||||
endfunction()
|
||||
|
||||
# add_subdirectory_if_exists
|
||||
#
|
||||
# Like add_subdirectory, but only proceeds if the given source directory exists.
|
||||
function(add_subdirectory_if_exists source_dir)
|
||||
get_filename_component(abs_dir "${source_dir}"
|
||||
ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
|
||||
if(EXISTS "${abs_dir}")
|
||||
add_subdirectory("${source_dir}" ${ARGN})
|
||||
else()
|
||||
message(STATUS "Subdirectory '${abs_dir}' does not exist, skipped.")
|
||||
endif()
|
||||
endfunction()
|
Loading…
x
Reference in New Issue
Block a user