summaryrefslogtreecommitdiffstats
path: root/cmake/fastd_module.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/fastd_module.cmake')
-rw-r--r--cmake/fastd_module.cmake28
1 files changed, 17 insertions, 11 deletions
diff --git a/cmake/fastd_module.cmake b/cmake/fastd_module.cmake
index d18719a..d1b6d3b 100644
--- a/cmake/fastd_module.cmake
+++ b/cmake/fastd_module.cmake
@@ -1,9 +1,13 @@
-function(fastd_module type enabled_var info name)
+macro(_fastd_module_handle_name)
string(TOUPPER "${type}" TYPE)
string(REPLACE - _ name_ "${name}")
string(REPLACE " " _ name_ "${name_}")
string(TOUPPER "${name_}" NAME)
+endmacro(_fastd_module_handle_name)
+
+function(fastd_module type enabled_var info name)
+ _fastd_module_handle_name()
set(WITH_${TYPE}_${NAME} TRUE CACHE BOOL "Include the ${name} ${info}")
@@ -21,11 +25,7 @@ function(fastd_module type enabled_var info name)
endfunction(fastd_module)
function(fastd_module_include_directories type name)
- string(TOUPPER "${type}" TYPE)
-
- string(REPLACE - _ name_ "${name}")
- string(REPLACE " " _ name_ "${name_}")
- string(TOUPPER "${name_}" NAME)
+ _fastd_module_handle_name()
if(WITH_${TYPE}_${NAME})
target_include_directories(${type}_${name_} PRIVATE ${ARGN})
@@ -33,13 +33,19 @@ function(fastd_module_include_directories type name)
endfunction(fastd_module_include_directories)
function(fastd_module_link_libraries type name)
- string(TOUPPER "${type}" TYPE)
-
- string(REPLACE - _ name_ "${name}")
- string(REPLACE " " _ name_ "${name_}")
- string(TOUPPER "${name_}" NAME)
+ _fastd_module_handle_name()
if(WITH_${TYPE}_${NAME})
target_link_libraries(${type}_${name_} ${ARGN})
endif(WITH_${TYPE}_${NAME})
endfunction(fastd_module_link_libraries)
+
+function(fastd_module_require type name)
+ _fastd_module_handle_name()
+
+ if(WITH_${TYPE}_${NAME})
+ foreach(req ${ARGN})
+ set_property(GLOBAL PROPERTY ${req}_REQUIRED TRUE)
+ endforeach(req)
+ endif(WITH_${TYPE}_${NAME})
+endfunction(fastd_module_require)