summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2018-07-25 11:06:30 (GMT)
committerCraig Scott <craig.scott@crascit.com>2018-07-25 11:30:51 (GMT)
commit7ddc2a110c0e52ce6e2e360a69aadf9291edbb11 (patch)
treef2c17069e18bd8d6d40d4a331314ae9322a7fbab
parentb5061e02f86e8d003d2f8c59d7fac22207dcd860 (diff)
downloadCMake-7ddc2a110c0e52ce6e2e360a69aadf9291edbb11.zip
CMake-7ddc2a110c0e52ce6e2e360a69aadf9291edbb11.tar.gz
CMake-7ddc2a110c0e52ce6e2e360a69aadf9291edbb11.tar.bz2
GoogleTest: Ensure policy settings allow use of IN_LIST
If policy settings at the time the GoogleTest module is included are such that CMP0057 is unset or set to OLD, the use of IN_LIST with if() will lead to an error. Therefore, explicitly specify the policy settings for the whole file to ensure the function implementations have access to the required CMake features. Fixes: #18198
-rw-r--r--Modules/GoogleTest.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index bfb83e1..2c9ee11 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -238,6 +238,10 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
#]=======================================================================]
+# Save project's policies
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
#------------------------------------------------------------------------------
function(gtest_add_tests)
@@ -454,3 +458,6 @@ endfunction()
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
${CMAKE_CURRENT_LIST_DIR}/GoogleTestAddTests.cmake
)
+
+# Restore project's policies
+cmake_policy(POP)