From 162fdbe5815bbdf187f549fefac94ff476d72e62 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 27 Oct 2015 13:21:24 -0400 Subject: Beginning of new module dependency stuff, seems to compile and link. Move some of the madness in chanserv.h to the module. --- cmake/Anope.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cmake') diff --git a/cmake/Anope.cmake b/cmake/Anope.cmake index a8624d775..48a57d213 100644 --- a/cmake/Anope.cmake +++ b/cmake/Anope.cmake @@ -89,3 +89,20 @@ macro(add_to_cpack_ignored_files ITEM) set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}") endif(DEFINED ENV{CPACK_IGNORED_FILES}) endmacro(add_to_cpack_ignored_files) + +macro(calculate_dependencies SRC) + file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*Dependencies:[ \t]*.*[ \t]*\\*/") + # Iterate through those lines + foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES}) + string(REGEX REPLACE "/\\*[ \t]*Dependencies:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_LIBRARY ${REQUIRED_LIBRARY}) + # Replace all commas with semicolons + string(REGEX REPLACE "," ";" REQUIRED_LIBRARY ${REQUIRED_LIBRARY}) + # Iterate through the libraries given + foreach(LIBRARY ${REQUIRED_LIBRARY}) + get_filename_component(TARGNAME ${SRC} NAME_WE) + target_link_libraries(${TARGNAME} ${LIBRARY}) + add_dependencies(${TARGNAME} ${LIBRARY}) + endforeach(LIBRARY) + endforeach(REQUIRED_LIBRARY) +endmacro(calculate_dependencies) + -- cgit