summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-10-27 13:21:24 -0400
committerAdam <Adam@anope.org>2015-10-27 13:21:24 -0400
commit162fdbe5815bbdf187f549fefac94ff476d72e62 (patch)
tree1c58968fd29dd90ef8ab6dc0f3013d88b313ce4e /cmake
parentc6a92296d4175a2d2276c2d5a46894af3d9085f4 (diff)
Beginning of new module dependency stuff, seems to compile and link. Move some of the madness in chanserv.h to the module.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Anope.cmake17
1 files changed, 17 insertions, 0 deletions
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)
+