include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
+# Add a C flag to the global list of C flags.
macro(add_c_flag flag)
if(CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
message(STATUS "Configuring with C flag '${flag}'")
endmacro()
+# Add a CXX flag to the global list of CXX flags.
macro(add_cxx_flag flag)
if(CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
message(STATUS "Configuring with CXX flag '${flag}'")
endmacro()
+# Add a C and CXX flag to the global list of C/CXX flags.
macro(add_c_cxx_flag flag)
add_c_flag(${flag})
add_cxx_flag(${flag})
endmacro()
+# Check if C flag is supported and add to global list of C flags.
macro(add_check_c_flag flag)
string(REGEX REPLACE "[-=]" "_" flagname ${flag})
check_c_compiler_flag("${flag}" HAVE_FLAG${flagname})
endif()
endmacro()
+# Check if CXX flag is supported and add to global list of CXX flags.
macro(add_check_cxx_flag flag)
string(REGEX REPLACE "[-=]" "_" flagname ${flag})
check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname})
endif()
endmacro()
+# Check if C/CXX flag is supported and add to global list of C/CXX flags.
macro(add_check_c_cxx_flag flag)
add_check_c_flag(${flag})
add_check_cxx_flag(${flag})
endmacro()
+# Add required CXX flag. Configuration fails if the CXX flag is not supported
+# by the compiler.
macro(add_required_cxx_flag flag)
string(REGEX REPLACE "[-=]" "_" flagnamename ${flag})
check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname})
add_cxx_flag(${flag})
endmacro()
+# Add required C flag. Configuration fails if the C flag is not supported by
+# the compiler.
macro(add_required_c_flag flag)
string(REGEX REPLACE "[-=]" "_" flagname ${flag})
check_c_compiler_flag("${flag}" HAVE_FLAG${flagname})
add_c_flag(${flag})
endmacro()
+# Add requied C/CXX flag. Configuration fails if the C/CXX flag is not
+# supported by the compiler.
macro(add_required_c_cxx_flag flag)
add_required_c_flag(${flag})
add_required_cxx_flag(${flag})
macro(print_config str var)
if(${var} STREQUAL "ON")
set(OPT_VAL_STR "on")
- elseif(${var} STREQUAL "OFF")
+ else()
set(OPT_VAL_STR "off")
- elseif(${var} STREQUAL "IGNORE")
- set(OPT_VAL_STR "default")
endif()
message("${str} ${OPT_VAL_STR}")
endmacro()
-#-----------------------------------------------------------------------------#
-# libcvc4 helper macros
-
-# Collect all libraries that must be linked against libcvc4. These will be
-# actually linked in src/CMakeLists.txt with target_link_libaries(...).
-macro(libcvc4_link_libraries library)
- set(LIBCVC4_LIBRARIES ${LIBCVC4_LIBRARIES} ${library})
-endmacro()
-
-# Collect all include directories that are required for libcvc4. These will be
-# actually included in src/CMakeLists.txt with target_include_directories(...).
-macro(libcvc4_include_directories dirs)
- set(LIBCVC4_INCLUDES ${LIBCVC4_INCLUDES} ${dirs})
-endmacro()
-
# Collect all source files that are required to build libcvc4 in LIBCVC4_SRCS
# or LIBCVC4_GEN_SRCS. If GENERATED is the first argument the sources are
# added to LIBCVC4_GEN_SRCS. All sources are prepended with the absolute