@ -13,31 +13,31 @@ endfunction()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
function ( makeSubmodulesProject _directoryList _aliasList _submoduleList )
set ( _newSubmoduleList )
set ( _subName )
set ( _headerLoc )
foreach ( _dir IN LISTS _directoryList )
checkDirectory ( "${PROJECT_DIR}/${_dir}" ) # D o e s t h e d i r e c t o r y exists ( If not fatal error )
# F o r e a c h a l i a s o f e l e m e n t p r e s e n t o n t h e l i s t t h a t h a v e b e e n g i v e n a s a r g u m e n t
foreach ( alias IN LISTS _aliasList )
if ( EXISTS ${ PROJECT_DIR } / ${ _dir } / ${ alias } )
searchHeaderFile ( "${alias}" "_headerLoc" ) # S e a r c h e s i f t h e r e i s a n 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}" )
foreach ( _name IN LISTS _aliasList )
if ( EXISTS ${ PROJECT_DIR } / ${ _dir } / ${ _name } )
string ( REPLACE ".c" "" _subName ${ _name } )
searchHeaderFile ( "${_subName}" "_headerLoc" ) # S e a r c h e s i f t h e r e i s a n 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 ( ${ 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 )
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 )
# A p p e n d t h e i n t e r n a l s u b m o d u l e l i s t w i t h t h e n e w l y c o m p i l e d e l e m e n t
list ( APPEND _newSubmoduleList sub:: ${ alias } )
else ( ) # W h e n t h e e l e m e n t h a s n o s o u r c e f i l e a n d i s o n l y a h e a d e r .
message ( "${BoldMagenta} |-> No Source file for target : ${alias}" )
message ( " |-> Only headers will be added" )
list ( APPEND _newSubmoduleList sub:: ${ _subName } )
endif ( )
endforeach ( )
endforeach ( )