summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-30 21:01:52 (GMT)
committerBrad King <brad.king@kitware.com>2023-04-03 13:42:22 (GMT)
commit9fd0ecdedbd8f6d347917af35ce1a1e25292ccec (patch)
tree8eeaa450207d29d86153609380f925edf1145d6b /Tests
parent17e6b2bdcae4d7ea98b4738a9a0fe72396d28eb5 (diff)
downloadCMake-9fd0ecdedbd8f6d347917af35ce1a1e25292ccec.zip
CMake-9fd0ecdedbd8f6d347917af35ce1a1e25292ccec.tar.gz
CMake-9fd0ecdedbd8f6d347917af35ce1a1e25292ccec.tar.bz2
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.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/Autogen/MocPredefs.cmake1
-rw-r--r--Tests/RunCMake/CMakeLists.txt9
-rw-r--r--Tests/RunCMake/CPack/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/RunCMake.cmake2
5 files changed, 10 insertions, 12 deletions
diff --git a/Tests/RunCMake/Autogen/MocPredefs.cmake b/Tests/RunCMake/Autogen/MocPredefs.cmake
index 7a89bb5..8307e04 100644
--- a/Tests/RunCMake/Autogen/MocPredefs.cmake
+++ b/Tests/RunCMake/Autogen/MocPredefs.cmake
@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0129 NEW)
enable_language(CXX)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 080740c..f05f784 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -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"
)
diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt
index f210474..18a673e 100644
--- a/Tests/RunCMake/CPack/CMakeLists.txt
+++ b/Tests/RunCMake/CPack/CMakeLists.txt
@@ -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)
diff --git a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt
index 30cb9ae..67eae65 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt
+++ b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt
@@ -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)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index e1c923d..43fd961 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -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)