From 5d2b89d5faeb01d094066dd91b65f230c4d9389a Mon Sep 17 00:00:00 2001 From: leha-bot Date: Sun, 29 Sep 2024 14:16:26 +0300 Subject: Add CMAKE_HOST_EXECUTABLE_SUFFIX for Unix/Windows Closes: #17553 --- Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/cmake_host_executable_suffix.rst | 5 +++++ Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst | 6 +++++- Help/variable/CMAKE_HOST_EXECUTABLE_SUFFIX.rst | 12 ++++++++++++ Source/cmStateSnapshot.cxx | 2 ++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/cmake_host_executable_suffix.rst create mode 100644 Help/variable/CMAKE_HOST_EXECUTABLE_SUFFIX.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 4d92339..4c27bd5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -323,6 +323,7 @@ Variables that Describe the System /variable/CMAKE_COMPILER_2005 /variable/CMAKE_HOST_APPLE /variable/CMAKE_HOST_BSD + /variable/CMAKE_HOST_EXECUTABLE_SUFFIX /variable/CMAKE_HOST_LINUX /variable/CMAKE_HOST_SOLARIS /variable/CMAKE_HOST_SYSTEM diff --git a/Help/release/dev/cmake_host_executable_suffix.rst b/Help/release/dev/cmake_host_executable_suffix.rst new file mode 100644 index 0000000..3a8b945 --- /dev/null +++ b/Help/release/dev/cmake_host_executable_suffix.rst @@ -0,0 +1,5 @@ +cmake-host-executable-suffix +---------------------------- + +* The :variable:`CMAKE_HOST_EXECUTABLE_SUFFIX` variable was added to + provide suffix for executable names on the host platform. diff --git a/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst b/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst index bc4b9df..e445c98 100644 --- a/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst +++ b/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst @@ -1,10 +1,14 @@ CMAKE_EXECUTABLE_SUFFIX ----------------------- -The suffix for executables on this platform. +The suffix for executables on the target platform. The suffix to use for the end of an executable filename if any, ``.exe`` on Windows. :variable:`CMAKE_EXECUTABLE_SUFFIX_` overrides this for language ````. + + +See the :variable:`CMAKE_HOST_EXECUTABLE_SUFFIX` variable for the +executable suffix on the host platform. diff --git a/Help/variable/CMAKE_HOST_EXECUTABLE_SUFFIX.rst b/Help/variable/CMAKE_HOST_EXECUTABLE_SUFFIX.rst new file mode 100644 index 0000000..c455aae --- /dev/null +++ b/Help/variable/CMAKE_HOST_EXECUTABLE_SUFFIX.rst @@ -0,0 +1,12 @@ +CMAKE_HOST_EXECUTABLE_SUFFIX +---------------------------- + +.. versionadded:: 3.31 + +The suffix for executables on the host platform. This may differ from +the suffix for the target platform, :variable:`CMAKE_EXECUTABLE_SUFFIX`. + +The suffix to use for the end of an executable filename if any, ``.exe`` +on Windows. + +See also :variable:`CMAKE_EXECUTABLE_SUFFIX`. diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 8217a9c..6ee0225 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -298,9 +298,11 @@ void cmStateSnapshot::SetDefaultDefinitions() if (hostSystemName == "Windows") { this->SetDefinition("WIN32", "1"); this->SetDefinition("CMAKE_HOST_WIN32", "1"); + this->SetDefinition("CMAKE_HOST_EXECUTABLE_SUFFIX", ".exe"); } else { this->SetDefinition("UNIX", "1"); this->SetDefinition("CMAKE_HOST_UNIX", "1"); + this->SetDefinition("CMAKE_HOST_EXECUTABLE_SUFFIX", ""); } #if defined(__APPLE__) this->SetDefinition("APPLE", "1"); -- cgit v0.12