summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--Help/command/cmake_language.rst23
-rw-r--r--Help/release/dev/cmake-language-exit.rst5
-rw-r--r--Modules/Compiler/LCC-C.cmake2
-rw-r--r--Modules/FindMatlab.cmake127
-rw-r--r--Modules/FindPackageMessage.cmake1
-rw-r--r--Modules/FindX11.cmake12
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestGIT.cxx9
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx4
-rw-r--r--Source/cmCMakeLanguageCommand.cxx26
-rw-r--r--Source/cmComputeLinkInformation.cxx3
-rw-r--r--Source/cmConfigure.cmake.h.in7
-rw-r--r--Source/cmDebuggerExceptionManager.cxx2
-rw-r--r--Source/cmExecuteProcessCommand.cxx7
-rw-r--r--Source/cmExecutionStatus.h8
-rw-r--r--Source/cmMakefile.cxx15
-rw-r--r--Source/cmRST.cxx5
-rw-r--r--Source/cmStringAlgorithms.h5
-rw-r--r--Source/cmStringCommand.cxx3
-rw-r--r--Source/cmSystemTools.cxx8
-rw-r--r--Source/cmXMLParser.cxx6
-rw-r--r--Source/cmXMLParser.h4
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmake.h6
-rw-r--r--Source/cmakemain.cxx11
-rw-r--r--Tests/RunCMake/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx1
-rw-r--r--Tests/RunCMake/cmake_language/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/cmake_language/exit_0-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/exit_0.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_5-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/exit_5.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake3
-rw-r--r--Utilities/cmcppdap/include/dap/any.h2
-rw-r--r--Utilities/cmcurl/lib/vtls/openssl.c6
-rw-r--r--Utilities/cmjsoncpp/include/json/value.h4
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt4
-rw-r--r--Utilities/cmliblzma/common/sysdefs.h4
62 files changed, 278 insertions, 119 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a99cf50..dfbb38d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,6 +140,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
if(CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin|Linux|BSD|DragonFly|CYGWIN|MSYS"
AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.16)
AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.1)
+ AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "LCC" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.23)
)
set(CMake_ENABLE_DEBUGGER 1)
else()
diff --git a/Help/command/cmake_language.rst b/Help/command/cmake_language.rst
index 4b64eb6..45ac569 100644
--- a/Help/command/cmake_language.rst
+++ b/Help/command/cmake_language.rst
@@ -15,6 +15,7 @@ Synopsis
cmake_language(`DEFER`_ <options>... CALL <command> [<arg>...])
cmake_language(`SET_DEPENDENCY_PROVIDER`_ <command> SUPPORTED_METHODS <methods>...)
cmake_language(`GET_MESSAGE_LOG_LEVEL`_ <out-var>)
+ cmake_language(`EXIT`_ <exit-code>)
Introduction
^^^^^^^^^^^^
@@ -506,3 +507,25 @@ Getting current message log level
If both the command line option and the variable are set, the command line
option takes precedence. If neither are set, the default logging level
is returned.
+
+Terminating Scripts
+^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.29
+
+.. _EXIT:
+.. _exit-code:
+
+.. code-block:: cmake
+
+.. signature::
+ cmake_language(EXIT <exit-code>)
+
+ Terminate the current :option:`cmake -P` script and exit with ``<exit-code>``.
+
+ This command works only in :ref:`script mode <Script Processing Mode>`.
+
+ The ``<exit-code>`` should be non-negative.
+ If ``<exit-code>`` is negative then the behavior
+ is unspecified (e.g., on Windows the error code -1
+ becomes ``0xffffffff``, and on Linux it becomes ``255``).
diff --git a/Help/release/dev/cmake-language-exit.rst b/Help/release/dev/cmake-language-exit.rst
new file mode 100644
index 0000000..42e8ae2
--- /dev/null
+++ b/Help/release/dev/cmake-language-exit.rst
@@ -0,0 +1,5 @@
+cmake-language-exit
+-------------------
+
+* The :command:`cmake_language()` command gained a new ``EXIT``
+ sub-command to exit scripts with a specified exit code.
diff --git a/Modules/Compiler/LCC-C.cmake b/Modules/Compiler/LCC-C.cmake
index 99f791f..52c3bf3 100644
--- a/Modules/Compiler/LCC-C.cmake
+++ b/Modules/Compiler/LCC-C.cmake
@@ -33,4 +33,4 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26)
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
endif()
-__compiler_check_default_language_standard(C 1.23 90 1.20 11 1.26 17)
+__compiler_check_default_language_standard(C 1.17 89 1.23 99 1.26 17)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index c5379d5..609cd4e 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -378,32 +378,21 @@ endmacro()
Returns the release name from the version of Matlab
#]=======================================================================]
-macro(matlab_get_release_name_from_version version release_name)
+function(matlab_get_release_name_from_version version release_name)
# only the major.minor version is used
- string(REGEX MATCH "([0-9]+\\.[0-9]+)" _match ${version})
- if(CMAKE_MATCH_1)
- set(short_version ${CMAKE_MATCH_1})
- else()
- set(short_version ${version})
- endif()
+ string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" version "${version}")
- set(${release_name} "")
foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING)
- string(REGEX MATCHALL "(.+)=${short_version}" _matched ${_var})
- if(NOT _matched STREQUAL "")
- set(${release_name} ${CMAKE_MATCH_1})
- break()
+ if(_var MATCHES "(.+)=${version}")
+ set(${release_name} ${CMAKE_MATCH_1} PARENT_SCOPE)
+ return()
endif()
endforeach()
- unset(_var)
- unset(_matched)
- if(${release_name} STREQUAL "")
- message(WARNING "[MATLAB] The version ${short_version} is not registered")
- endif()
+ message(WARNING "[MATLAB] The version ${version} is not registered")
-endmacro()
+endfunction()
# extracts all the supported release names (R2022b...) of Matlab
@@ -485,26 +474,22 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio
)
if(_reg)
-
string(REGEX MATCHALL "([0-9]+\\.[0-9]+)" _versions_regex "${_reg}")
- foreach(match IN LISTS _versions_regex)
- string(REGEX MATCH "([0-9]+\\.[0-9]+)" current_match "${match}")
-
- if(NOT CMAKE_MATCH_1)
- continue()
- endif()
-
- cmake_host_system_information(RESULT _reg
- QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/${_installation_type}/${CMAKE_MATCH_1}"
- VALUE "MATLABROOT"
- )
-
- _Matlab_VersionInfoXML("${_reg}" _matlab_version_tmp)
- if(NOT "${_matlab_version_tmp}" STREQUAL "unknown")
- list(APPEND matlabs_from_registry ${_matlab_version_tmp})
- else()
- list(APPEND matlabs_from_registry ${match})
+ foreach(_match IN LISTS _versions_regex)
+ if(_match MATCHES "([0-9]+\\.[0-9]+)")
+ cmake_host_system_information(RESULT _reg
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/${_installation_type}/${CMAKE_MATCH_1}"
+ VALUE "MATLABROOT"
+ VIEW ${_view}
+ )
+
+ _Matlab_VersionInfoXML("${_reg}" _matlab_version_tmp)
+ if("${_matlab_version_tmp}" STREQUAL "unknown")
+ list(APPEND matlabs_from_registry ${_match})
+ else()
+ list(APPEND matlabs_from_registry ${_matlab_version_tmp})
+ endif()
endif()
endforeach()
@@ -560,42 +545,58 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_
# extract_matlab_versions_from_registry_brute_force or
# matlab_extract_all_installed_versions_from_registry.
+ # only the major.minor version is used in Mathworks Windows Registry keys
+ list(TRANSFORM matlab_versions REPLACE "^([0-9]+\\.[0-9]+).*" "\\1")
+
set(_matlab_roots_list )
# check for Matlab installations
foreach(_matlab_current_version IN LISTS matlab_versions)
- get_filename_component(
- current_MATLAB_ROOT
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]"
- ABSOLUTE)
+ cmake_host_system_information(RESULT current_MATLAB_ROOT
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/MATLAB/${_matlab_current_version}"
+ VALUE "MATLABROOT"
+ )
+ cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
if(IS_DIRECTORY "${current_MATLAB_ROOT}")
- list(APPEND _matlab_roots_list "MATLAB" ${_matlab_current_version} ${current_MATLAB_ROOT})
+ _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp)
+ if("${_matlab_version_tmp}" STREQUAL "unknown")
+ list(APPEND _matlab_roots_list "MATLAB" ${_matlab_current_version} ${current_MATLAB_ROOT})
+ else()
+ list(APPEND _matlab_roots_list "MATLAB" ${_matlab_version_tmp} ${current_MATLAB_ROOT})
+ endif()
endif()
endforeach()
# Check for MCR installations
foreach(_matlab_current_version IN LISTS matlab_versions)
- get_filename_component(
- current_MATLAB_ROOT
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Runtime\\${_matlab_current_version};MATLABROOT]"
- ABSOLUTE)
+ cmake_host_system_information(RESULT current_MATLAB_ROOT
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/MATLAB Runtime/${_matlab_current_version}"
+ VALUE "MATLABROOT"
+ )
+ cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
# remove the dot
string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
if(IS_DIRECTORY "${current_MATLAB_ROOT}")
- list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
+ _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp)
+ if("${_matlab_version_tmp}" STREQUAL "unknown")
+ list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
+ else()
+ list(APPEND _matlab_roots_list "MCR" ${_matlab_version_tmp} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
+ endif()
endif()
endforeach()
# Check for old MCR installations
foreach(_matlab_current_version IN LISTS matlab_versions)
- get_filename_component(
- current_MATLAB_ROOT
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Compiler Runtime\\${_matlab_current_version};MATLABROOT]"
- ABSOLUTE)
+ cmake_host_system_information(RESULT current_MATLAB_ROOT
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/MATLAB Compiler Runtime/${_matlab_current_version}"
+ VALUE "MATLABROOT"
+ )
+ cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
# remove the dot
string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
@@ -1412,19 +1413,11 @@ function(_Matlab_VersionInfoXML matlab_root _version)
set(_XMLfile ${matlab_root}/VersionInfo.xml)
if(EXISTS ${_XMLfile})
-
file(READ ${_XMLfile} versioninfo_string)
- if(versioninfo_string)
- # parses "<version>23.2.0.2365128</version>"
- string(REGEX MATCH "<version>([0-9]+(\\.[0-9]+)+)</version>"
- version_reg_match
- ${versioninfo_string}
- )
-
- if(CMAKE_MATCH_1)
- set(_ver "${CMAKE_MATCH_1}")
- endif()
+ # parses "<version>23.2.0.2365128</version>"
+ if(versioninfo_string MATCHES "<version>([0-9]+(\\.[0-9]+)+)</version>")
+ set(_ver "${CMAKE_MATCH_1}")
endif()
endif()
@@ -1635,7 +1628,17 @@ set(Matlab_VERSION_STRING "NOTFOUND")
set(Matlab_Or_MCR "UNKNOWN")
if(_numbers_of_matlab_roots GREATER 0)
if(Matlab_FIND_VERSION_EXACT)
- list(FIND _matlab_possible_roots ${Matlab_FIND_VERSION} _list_index)
+ set(_list_index -1)
+ foreach(_matlab_root_index RANGE 1 ${_numbers_of_matlab_roots} 3)
+ list(GET _matlab_possible_roots ${_matlab_root_index} _matlab_root_version)
+ # only the major.minor version is used
+ string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _matlab_root_version "${_matlab_root_version}")
+ if(_matlab_root_version VERSION_EQUAL Matlab_FIND_VERSION)
+ set(_list_index ${_matlab_root_index})
+ break()
+ endif()
+ endforeach()
+
if(_list_index LESS 0)
set(_list_index 1)
endif()
diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake
index 0628b98..7efbe18 100644
--- a/Modules/FindPackageMessage.cmake
+++ b/Modules/FindPackageMessage.cmake
@@ -37,6 +37,7 @@ function(find_package_message pkg msg details)
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
+ string(STRIP "${msg}" msg)
message(STATUS "${msg}")
# Save the find details in the cache to avoid printing the same
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 1047e4f..491ea46 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -89,6 +89,7 @@ and also the following more fine grained variables and targets:
X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND, X11::Xutil
X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND, X11::Xv
X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
+ X11_Xdbe_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xdbe_FOUND
X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
@@ -121,6 +122,10 @@ and also the following more fine grained variables and targets:
``xcb_shm``, ``xcb_sync``, ``xcb_xf86dri``, ``xcb_xinerama``, ``xcb_xinput``,
``xcb_xrm``, ``xcb_xvmc``, and ``xcb_xv`` libraries.
+.. versionadded:: 3.29
+ Added coverage of double buffer extension (variables
+ ``X11_Xdbe_INCLUDE_PATH`` and ``X11_Xdbe_FOUND``).
+
#]=======================================================================]
if (UNIX)
@@ -200,6 +205,7 @@ if (UNIX)
find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xdbe_INCLUDE_PATH X11/extensions/Xdbe.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xext_INCLUDE_PATH X11/extensions/Xext.h ${X11_INC_SEARCH_PATH})
find_path(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH})
@@ -643,6 +649,11 @@ if (UNIX)
set(X11_Xaw_FOUND TRUE)
endif()
+ if (X11_Xdbe_INCLUDE_PATH)
+ set(X11_Xdbe_FOUND TRUE)
+ list(APPEND X11_INCLUDE_DIR ${X11_Xdbe_INCLUDE_PATH})
+ endif ()
+
# Most of the X11 headers will be in the same directories, avoid
# creating a huge list of duplicates.
if (X11_INCLUDE_DIR)
@@ -1358,6 +1369,7 @@ if (UNIX)
X11_XSync_INCLUDE_PATH
X11_Xaw_LIB
X11_Xaw_INCLUDE_PATH
+ X11_Xdbe_INCLUDE_PATH
)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 9202d03..1a8083d 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 28)
-set(CMake_VERSION_PATCH 20240116)
+set(CMake_VERSION_PATCH 20240118)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 984c837..99c5a2b 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestGIT.h"
-#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <ctime>
@@ -414,14 +413,14 @@ protected:
const char* ConsumeSpace(const char* c)
{
- while (*c && isspace(*c)) {
+ while (*c && cmIsSpace(*c)) {
++c;
}
return c;
}
const char* ConsumeField(const char* c)
{
- while (*c && !isspace(*c)) {
+ while (*c && !cmIsSpace(*c)) {
++c;
}
return c;
@@ -481,7 +480,7 @@ private:
{
// Person Name <person@domain.com> 1234567890 +0000
const char* c = str;
- while (*c && isspace(*c)) {
+ while (*c && cmIsSpace(*c)) {
++c;
}
@@ -490,7 +489,7 @@ private:
++c;
}
const char* name_last = c;
- while (name_last != name_first && isspace(*(name_last - 1))) {
+ while (name_last != name_first && cmIsSpace(*(name_last - 1))) {
--name_last;
}
person.Name.assign(name_first, name_last - name_first);
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 699e23b..e4160a1 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -178,7 +178,7 @@ cm::optional<std::pair<std::string, std::string>> ParseOSReleaseLine(
if (std::isalpha(ch) || ch == '_') {
key += ch;
state = PARSE_KEY;
- } else if (!std::isspace(ch)) {
+ } else if (!cmIsSpace(ch)) {
state = IGNORE_REST;
}
break;
@@ -238,7 +238,7 @@ cm::optional<std::pair<std::string, std::string>> ParseOSReleaseLine(
break;
case PARSE_VALUE:
- if (ch == '#' || std::isspace(ch)) {
+ if (ch == '#' || cmIsSpace(ch)) {
state = IGNORE_REST;
} else {
value += ch;
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
index 329427c..9ffc363 100644
--- a/Source/cmCMakeLanguageCommand.cxx
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -398,6 +398,32 @@ bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args,
if (!moreArgs()) {
return FatalError(status, "called with incorrect number of arguments");
}
+ if (expArgs[expArg] == "EXIT"_s) {
+ ++expArg; // consume "EXIT".
+
+ if (!moreArgs()) {
+ return FatalError(status, "EXIT requires one argument");
+ }
+
+ auto workingMode =
+ status.GetMakefile().GetCMakeInstance()->GetWorkingMode();
+ if (workingMode != cmake::SCRIPT_MODE) {
+ return FatalError(status, "EXIT can be used only in SCRIPT mode");
+ }
+
+ long retCode = 0;
+
+ if (!cmStrToLong(expArgs[expArg], &retCode)) {
+ return FatalError(status,
+ cmStrCat("EXIT requires one integral argument, got \"",
+ expArgs[expArg], '\"'));
+ }
+
+ if (workingMode == cmake::SCRIPT_MODE) {
+ status.SetExitCode(static_cast<int>(retCode));
+ }
+ return true;
+ }
if (expArgs[expArg] == "SET_DEPENDENCY_PROVIDER"_s) {
finishArgs();
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 40eb902..c985767 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -553,7 +553,8 @@ bool cmComputeLinkInformation::Compute()
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
(this->Target->CanCompileSources() &&
- (this->Target->HaveCxx20ModuleSources() ||
+ (this->Target->HaveCxxModuleSupport(this->Config) ==
+ cmGeneratorTarget::Cxx20SupportLevel::Supported ||
this->Target->HaveFortranSources())))) {
return false;
}
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index de74716..23e4846 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -14,8 +14,13 @@
#pragma warning(disable : 1572) /* floating-point equality test */
#endif
-#if defined(__LCC__) && defined(__EDG__) && (__LCC__ == 123)
+#if defined(__LCC__) && defined(__EDG__)
+#if __LCC__ == 123
#pragma diag_suppress 2910 /* excess -Wunused-function in 1.23.x */
+#elif __LCC__ == 121
+#pragma diag_suppress 2727 /* excess -Wunused-function in 1.21.x */
+#include <limits.h> /* ..._MIN, ..._MAX constants */
+#endif
#endif
#cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE
diff --git a/Source/cmDebuggerExceptionManager.cxx b/Source/cmDebuggerExceptionManager.cxx
index a27426c..470e44c 100644
--- a/Source/cmDebuggerExceptionManager.cxx
+++ b/Source/cmDebuggerExceptionManager.cxx
@@ -78,7 +78,7 @@ cmDebuggerExceptionManager::HandleExceptionInfoRequest()
response.exceptionId = TheException->Id;
response.breakMode = "always";
response.description = TheException->Description;
- TheException = {};
+ TheException = cm::nullopt;
}
return response;
}
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 483a601..da6def9 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExecuteProcessCommand.h"
-#include <cctype> /* isspace */
#include <cstdint>
#include <cstdio>
#include <iostream>
@@ -35,11 +34,7 @@
namespace {
bool cmExecuteProcessCommandIsWhitespace(char c)
{
- // isspace takes 'int' but documents that the value must be representable
- // by 'unsigned char', or EOF. Cast to 'unsigned char' to avoid sign
- // extension while casting to 'int'.
- return (isspace(static_cast<int>(static_cast<unsigned char>(c))) ||
- c == '\n' || c == '\r');
+ return (cmIsSpace(c) || c == '\n' || c == '\r');
}
void cmExecuteProcessCommandFixText(std::vector<char>& output,
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index ced3548..e023971 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -7,6 +7,8 @@
#include <string>
#include <vector>
+#include <cm/optional>
+
class cmMakefile;
/** \class cmExecutionStatus
@@ -53,6 +55,11 @@ public:
void SetNestedError() { this->NestedError = true; }
bool GetNestedError() const { return this->NestedError; }
+ void SetExitCode(int code) noexcept { this->ExitCode = code; }
+ bool HasExitCode() const noexcept { return this->ExitCode.has_value(); }
+ void CleanExitCode() noexcept { this->ExitCode.reset(); }
+ int GetExitCode() const noexcept { return this->ExitCode.value_or(-1); }
+
private:
cmMakefile& Makefile;
std::string Error;
@@ -60,5 +67,6 @@ private:
bool BreakInvoked = false;
bool ContinueInvoked = false;
bool NestedError = false;
+ cm::optional<int> ExitCode;
std::vector<std::string> Variables;
};
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 936b282..2687afa 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -529,6 +529,12 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
cmSystemTools::SetFatalErrorOccurred();
}
}
+ if (this->GetCMakeInstance()->HasScriptModeExitCode() &&
+ this->GetCMakeInstance()->GetWorkingMode() == cmake::SCRIPT_MODE) {
+ // pass-through the exit code from inner cmake_language(EXIT) ,
+ // possibly from include() or similar command...
+ status.SetExitCode(this->GetCMakeInstance()->GetScriptModeExitCode());
+ }
}
} else {
if (!cmSystemTools::GetFatalErrorOccurred()) {
@@ -898,6 +904,11 @@ void cmMakefile::RunListFile(cmListFile const& listFile,
if (cmSystemTools::GetFatalErrorOccurred()) {
break;
}
+ if (status.HasExitCode()) {
+ // cmake_language EXIT was requested, early break.
+ this->GetCMakeInstance()->SetScriptModeExitCode(status.GetExitCode());
+ break;
+ }
if (status.GetReturnInvoked()) {
this->RaiseScope(status.GetReturnVariables());
// Exit early due to return command.
@@ -1427,8 +1438,8 @@ static void s_RemoveDefineFlag(std::string const& flag, std::string& dflags)
for (std::string::size_type lpos = dflags.find(flag, 0);
lpos != std::string::npos; lpos = dflags.find(flag, lpos)) {
std::string::size_type rpos = lpos + len;
- if ((lpos <= 0 || isspace(dflags[lpos - 1])) &&
- (rpos >= dflags.size() || isspace(dflags[rpos]))) {
+ if ((lpos <= 0 || cmIsSpace(dflags[lpos - 1])) &&
+ (rpos >= dflags.size() || cmIsSpace(dflags[rpos]))) {
dflags.erase(lpos, len);
} else {
++lpos;
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index f48330d..3934a29 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -3,7 +3,6 @@
#include "cmRST.h"
#include <algorithm>
-#include <cctype>
#include <cstddef>
#include <iterator>
#include <utility>
@@ -159,7 +158,7 @@ void cmRST::ProcessLine(std::string const& line)
// A line starting in .. is an explicit markup start.
if (line == ".." ||
(line.size() >= 3 && line[0] == '.' && line[1] == '.' &&
- isspace(line[2]))) {
+ cmIsSpace(line[2]))) {
this->Reset();
this->MarkupType =
(line.find_first_not_of(" \t", 2) == std::string::npos ? Markup::Empty
@@ -219,7 +218,7 @@ void cmRST::ProcessLine(std::string const& line)
}
// Indented lines following an explicit markup start are explicit markup.
else if (this->MarkupType != Markup::None &&
- (line.empty() || isspace(line[0]))) {
+ (line.empty() || cmIsSpace(line[0]))) {
this->MarkupType = Markup::Normal;
// Record markup lines if the start line was recorded.
if (!this->MarkupLines.empty()) {
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 4a9840b..55a1e46 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -44,7 +44,10 @@ private:
/** Returns true if the character @a ch is a whitespace character. **/
inline bool cmIsSpace(char ch)
{
- return ((ch & 0x80) == 0) && std::isspace(ch);
+ // isspace takes 'int' but documents that the value must be representable
+ // by 'unsigned char', or be EOF. Cast to 'unsigned char' to avoid sign
+ // extension while converting to 'int'.
+ return std::isspace(static_cast<unsigned char>(ch));
}
/** Returns a string that has whitespace removed from the start and the end. */
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 5a64588..ab87f34 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -6,7 +6,6 @@
#include "cmStringCommand.h"
#include <algorithm>
-#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <limits>
@@ -660,7 +659,7 @@ bool HandleStripCommand(std::vector<std::string> const& args,
const char* ptr = stringValue.c_str();
size_t cc;
for (cc = 0; cc < inStringLength; ++cc) {
- if (!isspace(*ptr)) {
+ if (!cmIsSpace(*ptr)) {
if (startPos > inStringLength) {
startPos = cc;
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f606c22..fca8186 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -486,7 +486,7 @@ bool cmSystemTools::SplitProgramFromArgs(std::string const& command,
const char* c = command.c_str();
// Skip leading whitespace.
- while (isspace(static_cast<unsigned char>(*c))) {
+ while (cmIsSpace(*c)) {
++c;
}
@@ -516,7 +516,7 @@ bool cmSystemTools::SplitProgramFromArgs(std::string const& command,
in_double = true;
} else if (*c == '\'') {
in_single = true;
- } else if (isspace(static_cast<unsigned char>(*c))) {
+ } else if (cmIsSpace(*c)) {
break;
} else {
program += *c;
@@ -1673,7 +1673,7 @@ void cmSystemTools::EnvDiff::PutEnv(const std::string& env)
void cmSystemTools::EnvDiff::UnPutEnv(const std::string& env)
{
- diff[env] = {};
+ diff[env] = cm::nullopt;
}
bool cmSystemTools::EnvDiff::ParseOperation(const std::string& envmod)
@@ -1728,7 +1728,7 @@ bool cmSystemTools::EnvDiff::ParseOperation(const std::string& envmod)
} else if (op == "set"_s) {
diff[name] = value;
} else if (op == "unset"_s) {
- diff[name] = {};
+ diff[name] = cm::nullopt;
} else if (op == "string_append"_s) {
apply_diff(name, [&value](std::string& output) { output += value; });
} else if (op == "string_prepend"_s) {
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 24da8c6..f4433e3 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmXMLParser.h"
-#include <cctype>
#include <cstring>
#include <iostream>
#include <sstream>
@@ -143,11 +142,6 @@ void cmXMLParser::CharacterDataHandler(const char* /*inData*/,
{
}
-int cmXMLParser::IsSpace(char c)
-{
- return isspace(c);
-}
-
const char* cmXMLParser::FindAttribute(const char** atts,
const char* attribute)
{
diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h
index 176252d..d35e44f 100644
--- a/Source/cmXMLParser.h
+++ b/Source/cmXMLParser.h
@@ -89,10 +89,6 @@ protected:
/** Called by ReportXmlParseError with basic error info. */
virtual void ReportError(int line, int column, const char* msg);
- //! Utility for convenience of subclasses. Wraps isspace C library
- // routine.
- static int IsSpace(char c);
-
//! Send the given buffer to the XML parser.
virtual int ParseBuffer(const char* buffer, std::string::size_type length);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 32064b4..7ab7600 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2820,7 +2820,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
if (cmSystemTools::GetErrorOccurredFlag()) {
return -1;
}
- return 0;
+ return this->HasScriptModeExitCode() ? this->GetScriptModeExitCode() : 0;
}
// If MAKEFLAGS are given in the environment, remove the environment
diff --git a/Source/cmake.h b/Source/cmake.h
index 58f90c9..ccf5154 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -835,7 +835,13 @@ private:
std::string DebuggerDapLogFile;
#endif
+ cm::optional<int> ScriptModeExitCode;
+
public:
+ bool HasScriptModeExitCode() const { return ScriptModeExitCode.has_value(); }
+ void SetScriptModeExitCode(int code) { ScriptModeExitCode = code; }
+ int GetScriptModeExitCode() const { return ScriptModeExitCode.value_or(-1); }
+
static cmDocumentationEntry CMAKE_STANDARD_OPTIONS_TABLE[18];
};
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index ced83dc..8462734 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -389,13 +389,16 @@ int do_cmake(int ac, char const* const* av)
}
}
- // Always return a non-negative value. Windows tools do not always
- // interpret negative return values as errors.
+ // Always return a non-negative value (except exit code from SCRIPT_MODE).
+ // Windows tools do not always interpret negative return values as errors.
if (res != 0) {
+ auto scriptModeExitCode =
+ cm.HasScriptModeExitCode() ? cm.GetScriptModeExitCode() : 0;
+ res = scriptModeExitCode ? scriptModeExitCode : 1;
#ifdef CMake_ENABLE_DEBUGGER
- cm.StopDebuggerIfNeeded(1);
+ cm.StopDebuggerIfNeeded(res);
#endif
- return 1;
+ return res;
}
#ifdef CMake_ENABLE_DEBUGGER
cm.StopDebuggerIfNeeded(0);
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 0399e74..ef088aa 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -1058,6 +1058,10 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k" AND NOT DEFINED CMake_TEST_E2K_BROKEN_L
execute_process(COMMAND "${DPKG_QUERY}" "-f" "\${Version}" "-W" "glibc" OUTPUT_VARIABLE LIBC_VERSION)
if(LIBC_VERSION MATCHES "2.29-25.*")
list(REMOVE_ITEM cpack_tests
+ DEB.DEFAULT_PERMISSIONS
+ DEB.DEBUGINFO
+ DEB.MINIMAL
+ DEB.PER_COMPONENT_FIELDS
DEB.AUTO_SUFFIXES
DEB.CUSTOM_NAMES
DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY
@@ -1125,12 +1129,12 @@ add_RunCMake_test(CMakePresets
-DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
)
-add_RunCMake_test(CMakePresetsBuild
- -DPython_EXECUTABLE=${Python_EXECUTABLE}
- -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
- -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
- )
if(NOT CMake_TEST_E2K_BROKEN_LIBC)
+ add_RunCMake_test(CMakePresetsBuild
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ )
add_RunCMake_test(CMakePresetsTest
-DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index abede44..b0571ed 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -180,6 +180,7 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
run_cxx_module_test(non-trivial-collation-order-randomized)
run_cxx_module_test(duplicate)
set(RunCMake_CXXModules_NO_TEST 1)
+ run_cxx_module_test(import-from-object)
run_cxx_module_test(circular)
run_cxx_module_test(try-compile)
run_cxx_module_test(try-run)
diff --git a/Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt
new file mode 100644
index 0000000..e9ec809
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.24...3.28)
+project(cxx_modules_import_from_object CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_STANDARD 20)
+
+add_library(a STATIC)
+target_sources(a
+ PUBLIC
+ FILE_SET CXX_MODULES
+ FILES
+ object-a.cxx)
+
+add_library(b OBJECT object-b.cxx)
+target_link_libraries(b PRIVATE a)
diff --git a/Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx b/Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx
new file mode 100644
index 0000000..9634a8f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx
@@ -0,0 +1,2 @@
+module;
+export module a;
diff --git a/Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx b/Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx
new file mode 100644
index 0000000..3b2a80c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx
@@ -0,0 +1 @@
+import a;
diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
index 38ce10b..ac4aec8 100644
--- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
@@ -84,6 +84,13 @@ run_cmake(defer_get_call_id_var)
run_cmake(defer_missing_arg)
run_cmake(defer_missing_call)
run_cmake(defer_unknown_option)
+run_cmake(exit_0)
+run_cmake(exit_5)
+run_cmake_script(exit_0_script)
+run_cmake_script(exit_5_script)
+run_cmake_script(exit_0_script_with_command)
+run_cmake_script(exit_7_script_in_include)
+run_cmake_script(exit_8_script_in_recursive_cmake_language)
# Default log level
run_cmake_command(
diff --git a/Tests/RunCMake/cmake_language/exit_0-result.txt b/Tests/RunCMake/cmake_language/exit_0-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/exit_0-stderr.txt b/Tests/RunCMake/cmake_language/exit_0-stderr.txt
new file mode 100644
index 0000000..04a586e
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at exit_0.cmake:1 \(cmake_language\):
+ cmake_language EXIT can be used only in SCRIPT mode
diff --git a/Tests/RunCMake/cmake_language/exit_0.cmake b/Tests/RunCMake/cmake_language/exit_0.cmake
new file mode 100644
index 0000000..53a150e
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 0)
diff --git a/Tests/RunCMake/cmake_language/exit_0_script-result.txt b/Tests/RunCMake/cmake_language/exit_0_script-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/cmake_language/exit_0_script-stderr.txt b/Tests/RunCMake/cmake_language/exit_0_script-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_0_script.cmake b/Tests/RunCMake/cmake_language/exit_0_script.cmake
new file mode 100644
index 0000000..53a150e
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 0)
diff --git a/Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt b/Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt b/Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake b/Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake
new file mode 100644
index 0000000..ebc4ca7
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake
@@ -0,0 +1,3 @@
+cmake_language(EXIT 0)
+
+message(FATAL_ERROR "cmake_language(EXIT 0) doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_5-result.txt b/Tests/RunCMake/cmake_language/exit_5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/exit_5-stderr.txt b/Tests/RunCMake/cmake_language/exit_5-stderr.txt
new file mode 100644
index 0000000..ad232f8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at exit_5.cmake:1 \(cmake_language\):
+ cmake_language EXIT can be used only in SCRIPT mode
diff --git a/Tests/RunCMake/cmake_language/exit_5.cmake b/Tests/RunCMake/cmake_language/exit_5.cmake
new file mode 100644
index 0000000..5e5c147
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 5)
diff --git a/Tests/RunCMake/cmake_language/exit_5_script-result.txt b/Tests/RunCMake/cmake_language/exit_5_script-result.txt
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script-result.txt
@@ -0,0 +1 @@
+5
diff --git a/Tests/RunCMake/cmake_language/exit_5_script-stderr.txt b/Tests/RunCMake/cmake_language/exit_5_script-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_5_script.cmake b/Tests/RunCMake/cmake_language/exit_5_script.cmake
new file mode 100644
index 0000000..5e5c147
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 5)
diff --git a/Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt b/Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt
@@ -0,0 +1 @@
+5
diff --git a/Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt b/Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake b/Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake
new file mode 100644
index 0000000..4400307
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake
@@ -0,0 +1,3 @@
+cmake_language(EXIT 5)
+
+message(FATAL_ERROR "cmake_language(EXIT 5) doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt b/Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt
@@ -0,0 +1 @@
+7
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt b/Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake b/Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake
new file mode 100644
index 0000000..e65fa5c
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake
@@ -0,0 +1,3 @@
+include(${CMAKE_CURRENT_LIST_DIR}/exit_7_script_included_with_exit.cmake)
+
+message(FATAL_ERROR "The cmake_language(EXIT 7) from include()-d script doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake b/Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake
new file mode 100644
index 0000000..ee36ca0
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake
@@ -0,0 +1,3 @@
+cmake_language(EXIT 7)
+
+message(FATAL_ERROR "The include()-d script with EXIT 7 doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt
@@ -0,0 +1 @@
+
diff --git a/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake
new file mode 100644
index 0000000..96daf86
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake
@@ -0,0 +1,3 @@
+cmake_language(EVAL CODE "cmake_language(EXIT 8)")
+
+message(FATAL_ERROR "The cmake_language EVAL of EXIT 8 test doesn't work")
diff --git a/Utilities/cmcppdap/include/dap/any.h b/Utilities/cmcppdap/include/dap/any.h
index b05f03d..6060546 100644
--- a/Utilities/cmcppdap/include/dap/any.h
+++ b/Utilities/cmcppdap/include/dap/any.h
@@ -159,7 +159,7 @@ any& any::operator=(const std::nullptr_t&) {
template <typename T>
T& any::get() const {
- static_assert(!std::is_same<T, std::nullptr_t>(),
+ static_assert(!std::is_same<T, std::nullptr_t>::value,
"Cannot get nullptr from 'any'.");
assert(is<T>());
return *reinterpret_cast<T*>(value);
diff --git a/Utilities/cmcurl/lib/vtls/openssl.c b/Utilities/cmcurl/lib/vtls/openssl.c
index ca6d931..4bcb340 100644
--- a/Utilities/cmcurl/lib/vtls/openssl.c
+++ b/Utilities/cmcurl/lib/vtls/openssl.c
@@ -293,9 +293,9 @@ typedef unsigned long sslerr_t;
#define HAVE_SSL_X509_STORE_SHARE
#endif
-/* FIXME: On a specific machine using LCC 1.23, OpenSSL 2.0.0
- * is found but does not seem to have X509_STORE_up_ref. */
-#if defined(__LCC__) && defined(__EDG__) && (__LCC__ == 123)
+/* FIXME: On LCC <= 1.23, OpenSSL 2.0.0 may be
+ * found but does not seem to have X509_STORE_up_ref. */
+#if defined(__LCC__) && defined(__EDG__) && (__LCC__ <= 123)
#undef HAVE_SSL_X509_STORE_SHARE
#endif
diff --git a/Utilities/cmjsoncpp/include/json/value.h b/Utilities/cmjsoncpp/include/json/value.h
index f6ac9e3..421fef8 100644
--- a/Utilities/cmjsoncpp/include/json/value.h
+++ b/Utilities/cmjsoncpp/include/json/value.h
@@ -33,6 +33,10 @@
#if __clang_major__ == 3 && __clang_minor__ <= 8
#define JSONCPP_TEMPLATE_DELETE
#endif
+#elif defined(__EDG__) && defined(__LCC__)
+#if __LCC__ < 123
+#define JSONCPP_TEMPLATE_DELETE
+#endif
#endif
#if !defined(JSONCPP_TEMPLATE_DELETE)
#define JSONCPP_TEMPLATE_DELETE = delete
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index 1237608..e47184b 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -1425,7 +1425,9 @@ CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID)
CHECK_FUNCTION_EXISTS_GLIBC(getvfsbyname HAVE_GETVFSBYNAME)
CHECK_FUNCTION_EXISTS_GLIBC(gmtime_r HAVE_GMTIME_R)
CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS)
-CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
+if(NOT CMAKE_C_COMPILER_ID STREQUAL "LCC" OR NOT CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL "1.23")
+ CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
+endif()
CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK)
CHECK_FUNCTION_EXISTS_GLIBC(linkat HAVE_LINKAT)
diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h
index 86c5da0..6e3495e 100644
--- a/Utilities/cmliblzma/common/sysdefs.h
+++ b/Utilities/cmliblzma/common/sysdefs.h
@@ -172,9 +172,9 @@ typedef unsigned char _Bool;
# include <memory.h>
#endif
-// As of MSVC 2013, inline and restrict are supported with
+// As of MSVC 2013 and LCC <= 1.21, inline and restrict are supported with
// non-standard keywords.
-#if defined(_WIN32) && defined(_MSC_VER)
+#if (defined(_WIN32) && defined(_MSC_VER)) || (defined(__EDG__) && defined(__LCC__))
# ifndef inline
# define inline __inline
# endif