summaryrefslogtreecommitdiffstats
path: root/Tests/CSharpOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-07-15 16:58:44 (GMT)
committerBrad King <brad.king@kitware.com>2021-07-15 17:06:18 (GMT)
commit3ddd7f35760055fc501d454f9029f3987536957b (patch)
tree37932a0f25ef5e617cb662391503e1c4adc045cd /Tests/CSharpOnly
parent7c6234dd21b7af95e7edea6b281d859dafb2ae81 (diff)
downloadCMake-3ddd7f35760055fc501d454f9029f3987536957b.zip
CMake-3ddd7f35760055fc501d454f9029f3987536957b.tar.gz
CMake-3ddd7f35760055fc501d454f9029f3987536957b.tar.bz2
enable_language: Fix test for working compiler with CMP0126 NEW behavior
Update the logic that converts a `try_compile` result from a cache entry to a normal variable to tolerate an existing normal variable under CMP0126 NEW behavior. Otherwise the `try_compile` result is ignored because CMake uses the false value of the normal variable, and CMake incorrectly reports that the compiler does not work. This went unnoticed for some languages (e.g. C and CXX) because the check for a working compiler is skipped if ABI detection works. It does affect other languages (e.g. CSharp). Fixes: #22423
Diffstat (limited to 'Tests/CSharpOnly')
-rw-r--r--Tests/CSharpOnly/CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tests/CSharpOnly/CMakeLists.txt b/Tests/CSharpOnly/CMakeLists.txt
index f7928b6..efac58c 100644
--- a/Tests/CSharpOnly/CMakeLists.txt
+++ b/Tests/CSharpOnly/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 3.3)
+if(POLICY CMP0126)
+ cmake_policy(SET CMP0126 NEW)
+endif()
# a simple CSharp only test case
project (CSharpOnly CSharp)