Try to fix CMake old policy warning issue.

This commit is contained in:
Philip.Hazel 2019-02-16 11:58:37 +00:00
parent 740a9792dd
commit 4fd8932e83
2 changed files with 29 additions and 7 deletions

View File

@ -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 $<TARGET_FILE:pcre2grep>)
ENDIF(PCRE2_BUILD_PCRE2GREP)
GET_TARGET_PROPERTY(PCRE2TEST_EXE pcre2test DEBUG_LOCATION)
SET(PCRE2TEST_EXE $<TARGET_FILE:pcre2test>)
# =================================================
# Write out a CTest configuration file

View File

@ -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
-------------------------------