fix fp issue (#2940)
[cvc5.git] / cmake / Helpers.cmake
index 1dc59da70613f2466882f20c3ec7d8d927178039..692e3290014c561ade53996059faf5d175eb73c3 100644 (file)
@@ -1,6 +1,7 @@
 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}")
@@ -10,6 +11,7 @@ macro(add_c_flag 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}")
@@ -19,11 +21,13 @@ macro(add_cxx_flag 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})
@@ -32,6 +36,7 @@ macro(add_check_c_flag flag)
   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})
@@ -40,11 +45,14 @@ macro(add_check_cxx_flag flag)
   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})
@@ -54,6 +62,8 @@ macro(add_required_cxx_flag flag)
   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})
@@ -63,6 +73,8 @@ macro(add_required_c_flag flag)
   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})
@@ -101,30 +113,13 @@ endfunction()
 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