You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
2.1 KiB
48 lines
2.1 KiB
function(createHeaderDirListProject _list _headersList)
|
|
foreach(DIR IN LISTS _list)
|
|
checkDirectory("${PROJECT_DIR}/${DIR}")
|
|
list(APPEND _newheaderDirList ${PROJECT_DIR}/${DIR})
|
|
message("${BoldMagenta} |-> Added : ${PROJECT_DIR}/${DIR}")
|
|
endforeach()
|
|
message("${ColourReset}")
|
|
set(${_headersList} ${_newheaderDirList} PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
####################################################################################################
|
|
# SUBMODULE MANAGEMENT
|
|
####################################################################################################
|
|
function(makeSubmodulesProject _directoryList _aliasList _submoduleList)
|
|
set(_newSubmoduleList)
|
|
set(_subName)
|
|
set(_headerLoc)
|
|
|
|
foreach(_dir IN LISTS _directoryList)
|
|
checkDirectory("${PROJECT_DIR}/${_dir}") # Does the directory exists (If not fatal error)
|
|
#For each alias of element present on the list that have been given as argument
|
|
|
|
foreach(_name IN LISTS _aliasList)
|
|
if(EXISTS ${PROJECT_DIR}/${_dir}/${_name})
|
|
string(REPLACE ".c" "" _subName ${_name})
|
|
searchHeaderFile("${_subName}" "_headerLoc") #Searches if there is an Header (if not it will not generate any error)
|
|
message("${BoldGreen} |-> Directory Found : ${PROJECT_DIR}/${_dir}")
|
|
message("${BoldCyan} |-> Target Found : ${_subName} ${BoldYellow} ")
|
|
message(" |-> Header : ${_headerLoc}")
|
|
message(" |-> Source : ${PROJECT_DIR}/${_dir}/${_name}")
|
|
message(" |-> Name : sub::${_subName}")
|
|
|
|
add_library(${_subName}_submodule ${PROJECT_DIR}/${_dir}/${_subName})
|
|
target_compile_options(${_subName}_submodule PRIVATE ${MAIN_FLAGS})
|
|
target_compile_definitions(${_subName}_submodule PRIVATE ${MAIN_DEFS})
|
|
target_include_directories(${_subName}_submodule PUBLIC ${COMMON_HEADERS})
|
|
add_library(sub::${_subName} ALIAS ${_subName}_submodule)
|
|
|
|
#Append the internal submodule list with the newly compiled element
|
|
list(APPEND _newSubmoduleList sub::${_subName})
|
|
endif()
|
|
endforeach()
|
|
endforeach()
|
|
message("${ColourReset}")
|
|
#New submodule list with the names of the compiled elements
|
|
set(${_submoduleList} ${_newSubmoduleList} PARENT_SCOPE)
|
|
endfunction()
|