project: Add test for platform variables with a Generic system

Cover that `UNIX`, `LINUX`, and other host platform variables are not
defined after `project()` when `CMAKE_SYSTEM_NAME` is `Generic`.

Issue: #28200
This commit is contained in:
Robert Maynard committed 2026-10-23 13:15:58 -04:00
1 parent 21957313f5
commit a8d1b1c06b
2 files changed
+6

No files matched your search

@@ -0,0 +1,5 @@
foreach(var APPLE UNIX WIN32 CYGWIN MSYS BSD LINUX AIX)
if(DEFINED ${var})
message(SEND_ERROR "${var} is defined as '${${var}}' for a Generic system.")
endif()
endforeach()
@@ -35,6 +35,7 @@ run_cmake(LanguagesUnordered)
if(RunCMake_GENERATOR MATCHES "Make|Ninja")
run_cmake(LanguagesUsedButNotEnabled)
endif()
run_cmake_with_options(PlatformVariablesGeneric -DCMAKE_SYSTEM_NAME=Generic)
run_cmake(ProjectCMP0126)
run_cmake(ProjectCompatVersion)
run_cmake(ProjectCompatVersion2)