about summary refs log tree commit diff homepage
path: root/test/CMakeLists.txt
diff options
context:
space:
mode:
authorLukas Zaoral <lzaoral@redhat.com>2021-04-07 21:33:36 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2021-04-08 20:53:32 +0100
commit292600cf54d5fd73278f67a4f98c2f955cbdaa10 (patch)
tree37f4453a0dc75e1269545c905a80dab45a9a8fb9 /test/CMakeLists.txt
parent36780583dd78865100114b02627a3418b2d56deb (diff)
downloadklee-292600cf54d5fd73278f67a4f98c2f955cbdaa10.tar.gz
cmake: Fix CMP0026 policy deprecation warning
CMake 3.19+ started to issue warnings if this policy is set to OLD:

CMake Deprecation Warning at test/CMakeLists.txt:143 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Diffstat (limited to 'test/CMakeLists.txt')
-rw-r--r--test/CMakeLists.txt20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a5418a51..2ff9b0eb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -135,23 +135,19 @@ add_subdirectory(Concrete)
 ###############################################################################
 
 # Find path to libkleeRuntest target for `lit.site.cfg`.
-# FIXME: This is not the right way to get the location of the target we have to
-# set CMP0026 to old.
-# This will likely break if using a multi-configuration generator.
-if (POLICY CMP0026)
-  # HACK: Allow reading `LOCATION` property.
-  cmake_policy(SET CMP0026 OLD)
-endif()
-get_property(LIB_KLEE_RUN_TEST_PATH
-  TARGET kleeRuntest
-  PROPERTY LOCATION
-)
+set(LIB_KLEE_RUN_TEST_PATH $<TARGET_FILE:kleeRuntest>)
 
 configure_file(lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.imd
   @ONLY
 )
 
+# Evaluate all generator expressions inserted during the configure step.
+file(GENERATE
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  INPUT  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.imd
+)
+
 add_custom_target(systemtests
   COMMAND "${LIT_TOOL}" ${LIT_ARGS} "${CMAKE_CURRENT_BINARY_DIR}"
   DEPENDS klee kleaver klee-replay kleeRuntest gen-bout gen-random-bout