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(_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(alias IN LISTS _aliasList)
|
|
if(EXISTS ${PROJECT_DIR}/${_dir}/${alias})
|
|
searchHeaderFile("${alias}" "_headerLoc") #Searches if there is an Header (if not it will not generate any error)
|
|
message("${BoldCyan} |-> Target Found : ${alias} ${BoldYellow} ")
|
|
message(" |-> Header : ${_headerLoc}")
|
|
message(" |-> Source : ${_dir}/${alias}/${alias}")
|
|
message(" |-> Name : sub::${alias}")
|
|
|
|
add_library(${alias}_submodule ${PROJECT_DIR}/${_dir}/${alias})
|
|
target_compile_options(${alias}_submodule PRIVATE ${MAIN_FLAGS})
|
|
target_compile_definitions(${alias}_submodule PRIVATE ${MAIN_DEFS})
|
|
target_include_directories(${alias}_submodule PUBLIC ${COMMON_HEADERS})
|
|
add_library(sub::${alias} ALIAS ${alias}_submodule)
|
|
|
|
#Append the internal submodule list with the newly compiled element
|
|
list(APPEND _newSubmoduleList sub::${alias})
|
|
|
|
else() # When the element has no source file and is only a header.
|
|
message("${BoldMagenta} |-> No Source file for target : ${alias}")
|
|
message(" |-> Only headers will be added")
|
|
endif()
|
|
endforeach()
|
|
endforeach()
|
|
message("${ColourReset}")
|
|
#New submodule list with the names of the compiled elements
|
|
set(${_submoduleList} ${_newSubmoduleList} PARENT_SCOPE)
|
|
endfunction()
|