summaryrefslogtreecommitdiffstats
path: root/cmake/fastd_module.cmake
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-03 11:12:42 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-03 11:12:42 +0100
commitb117a60e81c3d67880cd8b0079041c92a0818d96 (patch)
tree8db87c3e0710ce5b2201d7734a93dd3024631b1c /cmake/fastd_module.cmake
parent7fe38b0200979c15cc27a84ab51b2730e7f2d30e (diff)
downloadfastd-b117a60e81c3d67880cd8b0079041c92a0818d96.tar
fastd-b117a60e81c3d67880cd8b0079041c92a0818d96.zip
Allow building without NaCl again
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)