From 4fd8932e83b201bba6c891daddd64051cba9d0c1 Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Sat, 16 Feb 2019 11:58:37 +0000 Subject: [PATCH] Try to fix CMake old policy warning issue. --- CMakeLists.txt | 29 ++++++++++++++++++++++------- ChangeLog | 7 +++++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0306bc4..eb4f410 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,14 +84,16 @@ # 2018-06-27 PH added Daniel's patch to increase the stack for MSVC # 2018-11-14 PH removed unnecessary checks for stdint.h and inttypes.h # 2018-11-16 PH added PCRE2GREP_SUPPORT_CALLOUT_FORK support and tidied +# 2019-02-16 PH hacked to avoid CMP0026 policy issue (see comments below) PROJECT(PCRE2 C) -# Increased minimum to 2.8.0 to support newer add_test features. Set policy -# CMP0026 to avoid warnings for the use of LOCATION in GET_TARGET_PROPERTY. - +# Increased minimum to 2.8.0 to support newer add_test features. CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) -CMAKE_POLICY(SET CMP0026 OLD) + +# Set policy CMP0026 to avoid warnings for the use of LOCATION in +# GET_TARGET_PROPERTY. This should no longer be required. +# CMAKE_POLICY(SET CMP0026 OLD) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake @@ -647,14 +649,27 @@ IF(PCRE2_BUILD_TESTS) TARGET_LINK_LIBRARIES(pcre2_jit_test ${PCRE2_JIT_TEST_LIBS}) ENDIF(PCRE2_SUPPORT_JIT) - # exes in Debug location tested by the RunTest shell script + # exes in Debug location tested by the RunTest and RunGrepTest shell scripts # via "make test" + + # The commented out code below provokes a warning about future removal + # of the facility, and requires policy CMP0026 to be set to "OLD". I have + # got fed-up with the warnings, but my plea for help on the mailing list + # produced no response. So, I've hacked. The new code below seems to work on + # Linux. + +# IF(PCRE2_BUILD_PCRE2GREP) +# GET_TARGET_PROPERTY(PCRE2GREP_EXE pcre2grep DEBUG_LOCATION) +# ENDIF(PCRE2_BUILD_PCRE2GREP) +# +# GET_TARGET_PROPERTY(PCRE2TEST_EXE pcre2test DEBUG_LOCATION) IF(PCRE2_BUILD_PCRE2GREP) - GET_TARGET_PROPERTY(PCRE2GREP_EXE pcre2grep DEBUG_LOCATION) + SET(PCRE2GREP_EXE $) ENDIF(PCRE2_BUILD_PCRE2GREP) - GET_TARGET_PROPERTY(PCRE2TEST_EXE pcre2test DEBUG_LOCATION) + SET(PCRE2TEST_EXE $) + # ================================================= # Write out a CTest configuration file diff --git a/ChangeLog b/ChangeLog index a3c81a4..9bbeb88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -133,6 +133,13 @@ from auto-anchoring if \p{Any}* starts a pattern. 33. Compile invalid UTF check in JIT test when only pcre32 is enabled. +34. For some time now, CMake has been warning about the setting of policy +CMP0026 to "OLD" in CmakeLists.txt, and hinting that the feature might be +removed in a future version. A request for CMake expertise on the list produced +no result, so I have now hacked CMakeLists.txt along the lines of some changes +I found on the Internet. The new code no longer needs the policy setting, and +it appears to work fine on Linux. + Version 10.32 10-September-2018 -------------------------------