AIX: Add platform id variables 'AIX' and 'CMAKE_HOST_AIX'

This allows projects to use `if(AIX)` blocks instead of spelling
out `if(CMAKE_SYSTEM_NAME STREQUAL "AIX")`.  We already have similar
variables for many other platforms.
This commit is contained in:
Aditya Vidyadhar Kamath 2025-02-06 22:39:32 -06:00 committed by Brad King
parent 8137cf2822
commit ff03db6657
7 changed files with 24 additions and 0 deletions

View File

@ -323,6 +323,7 @@ Variables that Describe the System
.. toctree::
:maxdepth: 1
/variable/AIX
/variable/ANDROID
/variable/APPLE
/variable/BORLAND
@ -331,6 +332,7 @@ Variables that Describe the System
/variable/CMAKE_CL_64
/variable/CMAKE_COMPILER_2005
/variable/CMAKE_HOST_APPLE
/variable/CMAKE_HOST_AIX
/variable/CMAKE_HOST_BSD
/variable/CMAKE_HOST_EXECUTABLE_SUFFIX
/variable/CMAKE_HOST_LINUX

View File

@ -41,6 +41,9 @@ Commands
Variables
---------
* The :variable:`AIX` and :variable:`CMAKE_HOST_AIX` variables are
now set to true when the target or host system is AIX, respectively.
* Linker flag variables learned to support the ``LINKER:`` prefix:
* :variable:`CMAKE_EXE_LINKER_FLAGS`

6
Help/variable/AIX.rst Normal file
View File

@ -0,0 +1,6 @@
AIX
---
.. versionadded:: 4.0
Set to true when the target system is AIX.

View File

@ -0,0 +1,6 @@
CMAKE_HOST_AIX
--------------
.. versionadded:: 4.0
Set to true when the host system is AIX.

View File

@ -17,6 +17,7 @@ unset(MSYS)
unset(WIN32)
unset(BSD)
unset(LINUX)
unset(AIX)
# The CMAKE_EFFECTIVE_SYSTEM_NAME is used to load compiler and compiler
# wrapper configuration files. By default it equals to CMAKE_SYSTEM_NAME

View File

@ -1 +1,2 @@
set(AIX 1)
set(UNIX 1)

View File

@ -325,6 +325,11 @@ void cmStateSnapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_HOST_LINUX", "1");
#endif
#if defined(_AIX)
this->SetDefinition("AIX", "1");
this->SetDefinition("CMAKE_HOST_AIX", "1");
#endif
this->SetDefinition("CMAKE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()));
this->SetDefinition("CMAKE_MINOR_VERSION",