CompilerFlags.cmake 547 B

123456789101112131415161718
  1. # check if a C compiler flag is possible
  2. include(CheckCCompilerFlag)
  3. function(check_cc_flag CC_FLAG)
  4. check_c_compiler_flag("${CC_FLAG}" CC_HAS_${CC_FLAG})
  5. if(CC_HAS_${CC_FLAG})
  6. add_definitions("${CC_FLAG}")
  7. endif()
  8. endfunction()
  9. # check if an untested C compiler flag is possible
  10. function(check_cc_flag_untested CC_FLAG)
  11. check_c_compiler_flag("${CC_FLAG}" CC_HAS_${CC_FLAG})
  12. if(CC_HAS_${CC_FLAG})
  13. add_definitions("${CC_FLAG}")
  14. message(WARNING "Add untested flag: ${CC_FLAG}")
  15. endif()
  16. endfunction()