aboutsummaryrefslogtreecommitdiff
path: root/cmake/AddCompilerFlag.cmake
diff options
context:
space:
mode:
authorclick <none@none>2010-08-20 04:09:39 +0200
committerclick <none@none>2010-08-20 04:09:39 +0200
commit8d62f4e6ce0ecc9ec865c6ffacb218f7e0ea62a2 (patch)
treec9c3fd76a4ad94f27d4358e8b35b394666c9ff02 /cmake/AddCompilerFlag.cmake
parent6501948dc8a512d9724a2813ee7075a37049898b (diff)
Buildsystem: Add helperscripts to detect SSE2 extensions, and optimize platform compileflags for the architecture
+ minifix in scripts (wrong includedir) --HG-- branch : trunk
Diffstat (limited to 'cmake/AddCompilerFlag.cmake')
-rw-r--r--cmake/AddCompilerFlag.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/AddCompilerFlag.cmake b/cmake/AddCompilerFlag.cmake
new file mode 100644
index 00000000000..5310b5982bc
--- /dev/null
+++ b/cmake/AddCompilerFlag.cmake
@@ -0,0 +1,12 @@
+include (CheckCXXCompilerFlag)
+macro(AddCompilerFlag _flag)
+ string(REGEX REPLACE "[/:= ]" "_" _flag_esc "${_flag}")
+ check_cxx_compiler_flag("${_flag}" check_compiler_flag_${_flag_esc})
+ if(check_compiler_flag_${_flag_esc})
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
+ endif(check_compiler_flag_${_flag_esc})
+ if(${ARGC} EQUAL 2)
+ set(${ARGV1} "${check_compiler_flag_${_flag_esc}}")
+ endif(${ARGC} EQUAL 2)
+endmacro(AddCompilerFlag)