about summary refs log tree commit diff homepage
path: root/cmake
diff options
context:
space:
mode:
authorHoang M. Le <hle@informatik.uni-bremen.de>2017-03-21 10:06:24 +0100
committerDan Liew <delcypher@gmail.com>2017-03-23 13:03:13 +0000
commit1f8638a8a638a8b523c3fb403f0f3e69f7dc95ad (patch)
tree5d748b9eddc66ddc045ed36067f2b6e12c24debb /cmake
parent7f45c811f07c44f2a010f6ea54572f76c2d9f39d (diff)
downloadklee-1f8638a8a638a8b523c3fb403f0f3e69f7dc95ad.tar.gz
remove special handling of metaSMT_CXXFLAGS (unnecessary now as we use a fixed version of metaSMT with this flag being properly set)
Diffstat (limited to 'cmake')
-rw-r--r--cmake/find_metasmt.cmake47
1 files changed, 9 insertions, 38 deletions
diff --git a/cmake/find_metasmt.cmake b/cmake/find_metasmt.cmake
index a0a02cb9..6751b31d 100644
--- a/cmake/find_metasmt.cmake
+++ b/cmake/find_metasmt.cmake
@@ -18,46 +18,17 @@ list(APPEND KLEE_COMPONENT_EXTRA_INCLUDE_DIRS
 # FIXME: We should test linking
 list(APPEND KLEE_SOLVER_LIBRARIES ${metaSMT_LIBRARIES})
 
-# THIS IS HORRIBLE. The ${metaSMT_CXXFLAGS} variable
-# is badly formed. It is a string but we can't just split
-# on spaces because its contents looks like this
-# "  -DmetaSMT_BOOLECTOR_1_API -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS".
-# So handle defines specially
-string_to_list("${metaSMT_CXXFLAGS}" _metaSMT_CXXFLAGS_broken_list)
-list(LENGTH _metaSMT_CXXFLAGS_broken_list _metaSMT_CXXFLAGS_broken_list_length)
-math(EXPR _metaSMT_CXXFLAGS_broken_list_last_index "${_metaSMT_CXXFLAGS_broken_list_length} -1")
+# Separate flags and defines from ${metaSMT_CXXFLAGS}
+string_to_list("${metaSMT_CXXFLAGS}" _metaSMT_CXXFLAGS_list)
 set(_metasmt_flags "")
 set(_metasmt_defines "")
-set(_index_to_skip "")
-foreach (index RANGE 0 ${_metaSMT_CXXFLAGS_broken_list_last_index})
-  list(FIND _index_to_skip "${index}" _should_skip)
-  if ("${_should_skip}" EQUAL "-1")
-    list(GET _metaSMT_CXXFLAGS_broken_list ${index} _current_flag)
-    if ("${_current_flag}" MATCHES "^-D")
-      # This is a define
-      if ("${_current_flag}" MATCHES "^-D$")
-        # This is a bad define. We have just `-D` and the next item
-        # is the actually definition.
-        if ("${index}" EQUAL "${_metaSMT_CXXFLAGS_broken_list_last_index}")
-          message(FATAL_ERROR "Stray -D flag!")
-        else()
-          # Get next value
-          math(EXPR _next_index "${index} + 1")
-          list(GET _metaSMT_CXXFLAGS_broken_list ${_next_index} _next_flag)
-          if ("${_next_flag}" STREQUAL "")
-            message(FATAL_ERROR "Next flag shouldn't be empty!")
-          endif()
-          list(APPEND _metasmt_defines "-D${_next_flag}")
-          list(APPEND _index_to_skip "${_next_index}")
-        endif()
-      else()
-        # This is well formed defined (e.g. `-DHELLO`)
-        list(APPEND _metasmt_defines "${_current_flag}")
-      endif()
-    else()
-      # Regular flag
-      list(APPEND _metasmt_flags "${_current_flag}")
-    endif()
+foreach (flag ${_metaSMT_CXXFLAGS_list})
+  if ("${flag}" MATCHES "^-D")
+    # This is a define
+    list(APPEND _metasmt_defines "${flag}")
+  else()
+    # Regular flag
+    list(APPEND _metasmt_flags "${flag}")
   endif()
 endforeach()