Tests: Fix RunCMake infrastructure for LCC and CMP0129

Since commit 3958ed878f (LCC: Add policy CMP0129 regarding interpreting
LCC as GNU, 2021-10-19, v3.23.0-rc1~508^2) we intended to enable policy
`CMP0129` in RunCMake tests via `-DCMAKE_POLICY_DEFAULT_CMP0129=NEW`.
Fix the condition activating that to check `CMAKE_C_COMPILER_ID` where
it is always available.

Remove now-unnecessary CMP0129 settings in RunCMake cases.
This commit is contained in:
Brad King
2023-03-30 17:01:52 -04:00
parent 17e6b2bdca
commit 9fd0ecdedb
5 changed files with 10 additions and 12 deletions

View File

@@ -1,4 +1,3 @@
cmake_policy(SET CMP0129 NEW)
enable_language(CXX)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core)

View File

@@ -15,6 +15,9 @@ macro(add_RunCMake_test test)
else()
set(Test_Dir ${test})
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "LCC")
list(APPEND TEST_ARGS -DRunCMake_TEST_LCC=1)
endif()
add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
-DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig}
@@ -41,6 +44,11 @@ function(add_RunCMake_test_group test types)
file(REMOVE_RECURSE "${TEST_CONFIG_DIR}")
file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}")
set(TEST_ARGS "")
if(CMAKE_C_COMPILER_ID STREQUAL "LCC")
list(APPEND TEST_ARGS -DRunCMake_TEST_LCC=1)
endif()
foreach(type IN LISTS types)
# generate prerequirements config file in cmake as ctest doesn't have as
# much system information so it is easier to set programs and environment
@@ -68,6 +76,7 @@ function(add_RunCMake_test_group test types)
-DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test}
${TEST_ARGS}
-Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake
-P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
)

View File

@@ -1,9 +1,5 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
endif()
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "")
project(${RunCMake_TEST} CXX)

View File

@@ -1,9 +1,3 @@
cmake_minimum_required(VERSION 3.13)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
endif()
project(${RunCMake_TEST} LANGUAGES NONE)
include(${RunCMake_TEST}.cmake)

View File

@@ -94,7 +94,7 @@ function(run_cmake test)
if(APPLE)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW)
endif()
if(NOT RunCMake_TEST_NO_CMP0129 AND CMAKE_C_COMPILER_ID STREQUAL "LCC")
if(RunCMake_TEST_LCC AND NOT RunCMake_TEST_NO_CMP0129)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0129=NEW)
endif()
if(RunCMake_MAKE_PROGRAM)