about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/find_z3.cmake5
2 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 041e4143..99508bb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,6 +186,7 @@ include(CheckCXXSymbolExists)
 include(CheckIncludeFile)
 include(CheckIncludeFileCXX)
 include(CheckPrototypeDefinition)
+include(CMakePushCheckState)
 include("${CMAKE_SOURCE_DIR}/cmake/string_to_list.cmake")
 include("${CMAKE_SOURCE_DIR}/cmake/klee_component_add_cxx_flag.cmake")
 include("${CMAKE_SOURCE_DIR}/cmake/add_global_flag.cmake")
@@ -371,8 +372,10 @@ if (ENABLE_TCMALLOC)
   message(STATUS "TCMalloc support enabled")
   set(TCMALLOC_HEADER "gperftools/malloc_extension.h")
   find_path(TCMALLOC_INCLUDE_DIR "${TCMALLOC_HEADER}")
+  cmake_push_check_state()
   set(CMAKE_REQUIRED_INCLUDES "${TCMALLOC_INCLUDE_DIR}")
   check_include_file_cxx("${TCMALLOC_HEADER}" HAVE_GPERFTOOLS_MALLOC_EXTENSION_H)
+  cmake_pop_check_state()
   if (${HAVE_GPERFTOOLS_MALLOC_EXTENSION_H})
     find_library(TCMALLOC_LIBRARIES
       NAMES tcmalloc tcmalloc_minimal
diff --git a/cmake/find_z3.cmake b/cmake/find_z3.cmake
index 60e27c26..2240d48c 100644
--- a/cmake/find_z3.cmake
+++ b/cmake/find_z3.cmake
@@ -6,6 +6,7 @@
 # License. See LICENSE.TXT for details.
 #
 #===------------------------------------------------------------------------===#
+include(CMakePushCheckState)
 
 find_package(Z3)
 # Set the default so that if the following is true:
@@ -31,12 +32,12 @@ if (ENABLE_SOLVER_Z3)
     list(APPEND KLEE_SOLVER_LIBRARIES ${Z3_LIBRARIES})
 
     # Check the signature of `Z3_get_error_msg()`
-    set (_old_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+    cmake_push_check_state()
     set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${Z3_LIBRARIES})
     check_prototype_definition(Z3_get_error_msg
       "Z3_string Z3_get_error_msg(Z3_context c, Z3_error_code err)"
       "NULL" "${Z3_INCLUDE_DIRS}/z3.h" HAVE_Z3_GET_ERROR_MSG_NEEDS_CONTEXT)
-    set(CMAKE_REQUIRED_LIBRARIES ${_old_CMAKE_REQUIRED_LIBRARIES})
+    cmake_pop_check_state()
     if (HAVE_Z3_GET_ERROR_MSG_NEEDS_CONTEXT)
       message(STATUS "Z3_get_error_msg requires context")
     else()