include(/path/to/ManifestFile)
# Add a library from anywhere in the source tree, only once, as a "subdirectory"
function(builddep_find_lib lib_name)
# Already loaded?
get_property(${lib_name}_defined_globally GLOBAL PROPERTY global_${lib_name}_loaded DEFINED)
if(NOT ${lib_name}_defined_globally)
define_property(GLOBAL PROPERTY global_${lib_name}_loaded
BRIEF_DOCS "Boolean variable indicating whether a lib was loaded"
FULL_DOCS "See Brief Docs")
set_property(GLOBAL PROPERTY global_${lib_name}_loaded FALSE)
endif(NOT ${lib_name}_defined_globally)
get_property(${lib_name}_loaded GLOBAL PROPERTY global_${lib_name}_loaded)
# Use the two arg form of add_subdirectory to specify the binary_dir for the dependency
if(NOT ${lib_name}_loaded)
set_property(GLOBAL PROPERTY global_${lib_name}_loaded TRUE)
string(TOUPPER ${lib_name} lib_name_upper)
add_subdirectory(${${lib_name_upper}_IMPORT_DIR} ${CMAKE_BINARY_DIR}/${lib_name})
endif(NOT ${lib_name}_loaded)
endfunction()
# Add just the library's public includes.
# Only needed to handle circular header deps.
#
function(builddep_target_add_headers target_name scope lib_name)
string(TOUPPER ${lib_name} lib_name_upper)
target_include_directories(${target_name} ${scope} ${${lib_name_upper}_IMPORT_DIR}/include)
endfunction()