summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/arch.cmake17
-rw-r--r--cmake/fastd_module.cmake8
2 files changed, 25 insertions, 0 deletions
diff --git a/cmake/arch.cmake b/cmake/arch.cmake
new file mode 100644
index 0000000..fe488c2
--- /dev/null
+++ b/cmake/arch.cmake
@@ -0,0 +1,17 @@
+include(CheckCSourceCompiles)
+
+check_c_source_compiles("
+#ifndef __i386__
+#error not x86
+#endif
+
+int main() {return 0;}
+" ARCH_X86)
+
+check_c_source_compiles("
+#ifndef __x86_64__
+#error not x86_64
+#endif
+
+int main() {return 0;}
+" ARCH_X86_64)
diff --git a/cmake/fastd_module.cmake b/cmake/fastd_module.cmake
index 26285ae..093e28b 100644
--- a/cmake/fastd_module.cmake
+++ b/cmake/fastd_module.cmake
@@ -49,3 +49,11 @@ function(fastd_module_require type name)
endforeach(req)
endif(WITH_${TYPE}_${NAME})
endfunction(fastd_module_require)
+
+function(fastd_module_compile_flags type name source)
+ _fastd_module_handle_name()
+
+ if(WITH_${TYPE}_${NAME})
+ set_property(SOURCE ${source} APPEND PROPERTY COMPILE_FLAGS ${ARGN})
+ endif(WITH_${TYPE}_${NAME})
+endfunction(fastd_module_compile_flags)