diff options
author | Sander Vrijders <[email protected]> | 2016-02-11 15:50:16 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-02-11 15:50:16 +0100 |
commit | f78310f4886bad7029cc039971159ab7a97e00af (patch) | |
tree | c1609e42197af649ab52888a0c50186218f7a3d8 /cmake/CompilerUtils.cmake | |
parent | 5f3ee106ad32e07e8d00513212eb0968a84b59a1 (diff) | |
download | ouroboros-f78310f4886bad7029cc039971159ab7a97e00af.tar.gz ouroboros-f78310f4886bad7029cc039971159ab7a97e00af.zip |
Initial build infrastructure
Contains the initial build infrastructure. Cmake was chosen for
portability reasons.
Diffstat (limited to 'cmake/CompilerUtils.cmake')
-rw-r--r-- | cmake/CompilerUtils.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
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) |