macro(add_c_flag flag)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
+ message(STATUS "Configuring with C flag '${flag}'")
+endmacro()
+
+macro(add_cxx_flag flag)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ message(STATUS "Configuring with CXX flag '${flag}'")
+endmacro()
+
+macro(add_c_cxx_flag flag)
+ add_c_flag(${flag})
+ add_cxx_flag(${flag})
endmacro()
macro(add_check_c_flag flag)
- check_c_compiler_flag("${flag}" HAVE_FLAG_${flag})
- if(HAVE_FLAG_${flag})
+ string(REGEX REPLACE "[-=]" "_" flagname ${flag})
+ check_c_compiler_flag("${flag}" HAVE_FLAG${flagname})
+ if(HAVE_FLAG${flagname})
add_c_flag(${flag})
endif()
endmacro()
-macro(add_cxx_flag flag)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
-endmacro()
-
macro(add_check_cxx_flag flag)
- check_cxx_compiler_flag("${flag}" HAVE_FLAG_${flag})
- if(HAVE_FLAG_${flag})
+ string(REGEX REPLACE "[-=]" "_" flagname ${flag})
+ check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname})
+ if(HAVE_FLAG${flagname})
add_cxx_flag(${flag})
endif()
endmacro()
-macro(add_c_cxx_flag flag)
- add_c_flag(${flag})
- add_cxx_flag(${flag})
- message(STATUS "Configure with flag '${flag}'")
-endmacro()
-
macro(add_check_c_cxx_flag flag)
add_check_c_flag(${flag})
add_check_cxx_flag(${flag})
- message(STATUS "Configure with flag '${flag}'")
+endmacro()
+
+macro(add_required_cxx_flag flag)
+ string(REGEX REPLACE "[-=]" "_" flagnamename ${flag})
+ check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname})
+ if (NOT HAVE_FLAG${flagname})
+ message(FATAL_ERROR "Required compiler flag ${flag} not supported")
+ endif()
+ add_cxx_flag(${flag})
+endmacro()
+
+macro(add_required_c_flag flag)
+ string(REGEX REPLACE "[-=]" "_" flagname ${flag})
+ check_c_compiler_flag("${flag}" HAVE_FLAG${flagname})
+ if (NOT HAVE_FLAG${flagname})
+ message(FATAL_ERROR "Required compiler flag ${flag} not supported")
+ endif()
+ add_c_flag(${flag})
+endmacro()
+
+macro(add_required_c_cxx_flag flag)
+ add_required_c_flag(${flag})
+ add_required_cxx_flag(${flag})
endmacro()
macro(cvc4_link_library library)