From f78310f4886bad7029cc039971159ab7a97e00af Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 11 Feb 2016 15:50:16 +0100 Subject: Initial build infrastructure Contains the initial build infrastructure. Cmake was chosen for portability reasons. --- cmake/CompilerUtils.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 cmake/CompilerUtils.cmake (limited to 'cmake/CompilerUtils.cmake') diff --git a/cmake/CompilerUtils.cmake b/cmake/CompilerUtils.cmake new file mode 100644 index 00000000..99d9b662 --- /dev/null +++ b/cmake/CompilerUtils.cmake @@ -0,0 +1,15 @@ +include(CheckCXXCompilerFlag) + +function(test_and_set_cxx_compiler_flag_global _flag) + + string(REGEX REPLACE "-" "_" _sflag ${_flag}) + check_cxx_compiler_flag(${_flag} COMPILER_SUPPORTS_FLAG_${_sflag}) + + if(COMPILER_SUPPORTS_FLAG_${_sflag}) + message(STATUS "Compiler supports flag ${_flag}, added globally") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}" PARENT_SCOPE) + else(${_retval}) + message(STATUS "Compiler does not support flag ${_flag}, discarded") + endif() + +endfunction(test_and_set_cxx_compiler_flag_global) -- cgit v1.2.3