diff options
author | Baruch Sterin <baruchs@gmail.com> | 2015-11-05 01:23:31 -0800 |
---|---|---|
committer | Baruch Sterin <baruchs@gmail.com> | 2015-11-05 01:23:31 -0800 |
commit | be429079b547fa235cd0bbb696a7b73368606291 (patch) | |
tree | 4edbaaa73a00386611868910893eabcb97cd2eb5 /CMakeLists.txt | |
parent | c0ba25a69388765d7057ae8729e12b8a85435e35 (diff) | |
download | abc-be429079b547fa235cd0bbb696a7b73368606291.tar.gz abc-be429079b547fa235cd0bbb696a7b73368606291.tar.bz2 abc-be429079b547fa235cd0bbb696a7b73368606291.zip |
CMakeLists.txt: pass CXX flags from the Makefile
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 08f771e3..5034e5a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,23 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.3.0) include(CMakeParseArguments) include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) -# filter out flags that are not appropriate for the compiler used +# filter out flags that are not appropriate for the compiler being used function(target_compile_options_filtered target visibility) foreach( flag ${ARGN} ) if( flag MATCHES "^-D.*" ) target_compile_options( ${target} ${visibility} ${flag} ) else() - check_c_compiler_flag( ${flag} COMPILER_SUPPORTS__${flag} ) - if( COMPILER_SUPPORTS__${flag} ) - target_compile_options( ${target} ${visibility} ${flag} ) + check_c_compiler_flag( ${flag} C_COMPILER_SUPPORTS__${flag} ) + if( C_COMPILER_SUPPORTS__${flag} ) + target_compile_options( ${target} ${visibility} $<$<COMPILE_LANGUAGE:C>:${flag}> ) + endif() + + check_cxx_compiler_flag( ${flag} CXX_COMPILER_SUPPORTS__${flag} ) + if( CXX_COMPILER_SUPPORTS__${flag} ) + target_compile_options( ${target} ${visibility} $<$<COMPILE_LANGUAGE:CXX>:${flag}> ) endif() endif() endforeach() @@ -40,6 +46,8 @@ endfunction() extract_var(SEPARATOR_SRC ABC_SRC ${MAKE_OUTPUT}) extract_var(SEPARATOR_LIBS ABC_LIBS ${MAKE_OUTPUT}) extract_var(SEPARATOR_CFLAGS ABC_CFLAGS ${MAKE_OUTPUT}) +extract_var(SEPARATOR_CXXFLAGS ABC_CXXFLAGS ${MAKE_OUTPUT}) + add_executable(abc ${ABC_SRC}) |