summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/add_custom_command.rst2
-rw-r--r--Help/command/try_compile.rst18
-rw-r--r--Help/envvar/SSL_CERT_DIR.rst9
-rw-r--r--Help/envvar/SSL_CERT_FILE.rst9
-rw-r--r--Help/manual/cmake-env-variables.7.rst2
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0058.rst3
-rw-r--r--Help/policy/CMP0142.rst27
-rw-r--r--Help/release/dev/env-tls-certs.rst6
-rw-r--r--Help/release/dev/xcode-lib-dirs.rst6
-rw-r--r--Modules/Compiler/Clang.cmake2
-rw-r--r--Modules/FindMatlab.cmake1
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake22
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCMakePresetsGraph.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx100
-rw-r--r--Source/cmCurl.cxx11
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmPolicies.h9
-rw-r--r--Source/cmTryCompileCommand.cxx7
-rw-r--r--Source/cmTryRunCommand.cxx6
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FPHSA/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt1
-rw-r--r--Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake1
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/SearchPaths-check.cmake14
-rw-r--r--Tests/RunCMake/XcodeProject/SearchPaths.cmake10
-rw-r--r--Tests/RunCMake/try_compile/NoArgs-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/OneArg-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake4
-rw-r--r--Tests/RunCMake/try_compile/ProjectCopyFile-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/ProjectCopyFile.cmake4
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/try_compile/TwoArgs-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake9
-rw-r--r--Tests/RunCMake/try_run/old_and_new_signature_tests.cmake9
-rw-r--r--Tests/TryCompile/CMakeLists.txt11
56 files changed, 322 insertions, 56 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 9e60d2d..523e1b3 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -67,6 +67,8 @@ The options are:
Each byproduct file will be marked with the :prop_sf:`GENERATED`
source file property automatically.
+ *See policy* :policy:`CMP0058` *for the motivation behind this feature.*
+
Explicit specification of byproducts is supported by the
:generator:`Ninja` generator to tell the ``ninja`` build tool
how to regenerate byproducts when they are missing. It is
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 710fd21..97ad481 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -14,10 +14,15 @@ Try Compiling Whole Projects
.. code-block:: cmake
- try_compile(<resultVar> <bindir> <srcdir>
- <projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
+ try_compile(<resultVar> PROJECT <projectName>
+ SOURCE_DIR <srcdir>
+ [BINARY_DIR <bindir>]
+ [TARGET <targetName>]
+ [CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
+.. versionadded:: 3.25
+
Try building a project. The success or failure of the ``try_compile``,
i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``.
@@ -34,6 +39,15 @@ below for the meaning of other options.
Previously this was only done by the
:ref:`source file <Try Compiling Source Files>` signature.
+This command also supports an alternate signature
+which was present in older versions of CMake:
+
+.. code-block:: cmake
+
+ try_compile(<resultVar> <bindir> <srcdir>
+ <projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
+ [OUTPUT_VARIABLE <var>])
+
.. _`Try Compiling Source Files`:
Try Compiling Source Files
diff --git a/Help/envvar/SSL_CERT_DIR.rst b/Help/envvar/SSL_CERT_DIR.rst
new file mode 100644
index 0000000..1e678e4
--- /dev/null
+++ b/Help/envvar/SSL_CERT_DIR.rst
@@ -0,0 +1,9 @@
+SSL_CERT_DIR
+------------
+
+.. versionadded:: 3.25
+
+.. include:: ENV_VAR.txt
+
+Specify default directory containing CA certificates. It overrides
+the default CA directory used.
diff --git a/Help/envvar/SSL_CERT_FILE.rst b/Help/envvar/SSL_CERT_FILE.rst
new file mode 100644
index 0000000..23216c0
--- /dev/null
+++ b/Help/envvar/SSL_CERT_FILE.rst
@@ -0,0 +1,9 @@
+SSL_CERT_FILE
+-------------
+
+.. versionadded:: 3.25
+
+.. include:: ENV_VAR.txt
+
+Specify the file name containing CA certificates. It overrides the
+default, os-specific CA file used.
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index 737b22c..50fcf75 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -21,6 +21,8 @@ Environment Variables that Change Behavior
:maxdepth: 1
/envvar/CMAKE_PREFIX_PATH
+ /envvar/SSL_CERT_DIR
+ /envvar/SSL_CERT_FILE
Environment Variables that Control the Build
============================================
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index c0c37d1..d6a30ff 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -58,6 +58,7 @@ Policies Introduced by CMake 3.25
.. toctree::
:maxdepth: 1
+ CMP0142: The Xcode generator does not append per-config suffixes to library search paths. </policy/CMP0142>
CMP0141: MSVC debug information format flags are selected by an abstraction. </policy/CMP0141>
CMP0140: The return() command checks its arguments. </policy/CMP0140>
diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst
index 06cc74b..a9a8f1c 100644
--- a/Help/policy/CMP0058.rst
+++ b/Help/policy/CMP0058.rst
@@ -71,6 +71,9 @@ every custom command dependency, even on source files, needs to
be treated this way because CMake does not have enough information
to know which files are generated as byproducts of custom commands.
+Introducing Byproducts
+^^^^^^^^^^^^^^^^^^^^^^
+
CMake 3.2 introduced the ``BYPRODUCTS`` option to the
:command:`add_custom_command` and :command:`add_custom_target`
commands. This option allows byproducts to be specified explicitly:
diff --git a/Help/policy/CMP0142.rst b/Help/policy/CMP0142.rst
new file mode 100644
index 0000000..1f928f0
--- /dev/null
+++ b/Help/policy/CMP0142.rst
@@ -0,0 +1,27 @@
+CMP0142
+-------
+
+.. versionadded:: 3.25
+
+The :generator:`Xcode` generator does not append per-config suffixes to
+library search paths.
+
+In CMake 3.24 and below, the :generator:`Xcode` generator preceded each
+entry of a library search path with a copy of itself appended with
+``$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)``. This was left from
+very early versions of CMake in which per-config directories were not well
+modeled. Such paths often do not exist, resulting in warnings from the
+toolchain. CMake 3.25 and above prefer to not add such library search
+paths. This policy provides compatibility for projects that may have been
+accidentally relying on the old behavior.
+
+The ``OLD`` behavior for this policy is to append
+``$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)`` to all library search paths.
+The ``NEW`` behavior is to not modify library search paths.
+
+This policy was introduced in CMake version 3.25. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike many policies, CMake version |release| does *not* warn
+when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/release/dev/env-tls-certs.rst b/Help/release/dev/env-tls-certs.rst
new file mode 100644
index 0000000..4afadb4
--- /dev/null
+++ b/Help/release/dev/env-tls-certs.rst
@@ -0,0 +1,6 @@
+env-tls-certs
+-------------
+
+* The :envvar:`SSL_CERT_FILE` and :envvar:`SSL_CERT_DIR` environment
+ variables are now used to find certificate authorities for TLS/SSL
+ operations.
diff --git a/Help/release/dev/xcode-lib-dirs.rst b/Help/release/dev/xcode-lib-dirs.rst
new file mode 100644
index 0000000..fc1fe1b
--- /dev/null
+++ b/Help/release/dev/xcode-lib-dirs.rst
@@ -0,0 +1,6 @@
+xcode-lib-dirs
+--------------
+
+* The :generator:`Xcode` generator no longer adds the per-config suffix
+ ``$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)`` to library search paths.
+ See policy :policy:`CMP0142`.
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 257402a..4f9af37 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -80,7 +80,7 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
endif()
- if(ANDROID AND NOT CMAKE_ANDROID_NDK_VERSION VERSION_GREATER_EQUAL "22")
+ if(ANDROID AND CMAKE_ANDROID_NDK_VERSION VERSION_LESS "22")
# https://github.com/android-ndk/ndk/issues/242
set(CMAKE_${lang}_LINK_OPTIONS_IPO "-fuse-ld=gold")
endif()
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 941ab18..07a9adf 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -296,6 +296,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2022b=9.13"
"R2022a=9.12"
"R2021b=9.11"
"R2021a=9.10"
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 6de7dbf..56ba1e6 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -538,17 +538,21 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# check that the version variable is not empty to avoid emitting a misleading
# message (i.e. `Found unsuitable version ""`)
if (DEFINED ${_NAME}_FIND_VERSION)
- if(NOT "${${FPHSA_VERSION_VAR}}" STREQUAL "")
- set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
- if (FPHSA_HANDLE_VERSION_RANGE)
- set (FPCV_HANDLE_VERSION_RANGE HANDLE_VERSION_RANGE)
+ if(DEFINED ${FPHSA_VERSION_VAR})
+ if(NOT "${${FPHSA_VERSION_VAR}}" STREQUAL "")
+ set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
+ if (FPHSA_HANDLE_VERSION_RANGE)
+ set (FPCV_HANDLE_VERSION_RANGE HANDLE_VERSION_RANGE)
+ else()
+ set(FPCV_HANDLE_VERSION_RANGE NO_AUTHOR_WARNING_VERSION_RANGE)
+ endif()
+ find_package_check_version ("${_FOUND_VERSION}" VERSION_OK RESULT_MESSAGE_VARIABLE VERSION_MSG
+ ${FPCV_HANDLE_VERSION_RANGE})
else()
- set(FPCV_HANDLE_VERSION_RANGE NO_AUTHOR_WARNING_VERSION_RANGE)
+ set(VERSION_OK FALSE)
endif()
- find_package_check_version ("${_FOUND_VERSION}" VERSION_OK RESULT_MESSAGE_VARIABLE VERSION_MSG
- ${FPCV_HANDLE_VERSION_RANGE})
- else()
- set(VERSION_OK FALSE)
+ endif()
+ if("${${FPHSA_VERSION_VAR}}" STREQUAL "")
# if the package was not found, but a version was given, add that to the output:
if(${_NAME}_FIND_VERSION_EXACT)
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 7811814..488c8a9 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 24)
-set(CMake_VERSION_PATCH 20220916)
+set(CMake_VERSION_PATCH 20220919)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx
index 5b216bb..7fbcdab 100644
--- a/Source/cmCMakePresetsGraph.cxx
+++ b/Source/cmCMakePresetsGraph.cxx
@@ -1147,10 +1147,12 @@ void cmCMakePresetsGraph::ClearPresets()
this->ConfigurePresets.clear();
this->BuildPresets.clear();
this->TestPresets.clear();
+ this->PackagePresets.clear();
this->ConfigurePresetOrder.clear();
this->BuildPresetOrder.clear();
this->TestPresetOrder.clear();
+ this->PackagePresetOrder.clear();
this->Files.clear();
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 75aef16..2f63b3c 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -121,6 +121,26 @@ ArgumentParser::Continue TryCompileCompileDefs(Arguments& args,
return ArgumentParser::Continue::Yes;
}
+cmArgumentParser<Arguments> makeTryCompileParser(
+ const cmArgumentParser<Arguments>& base)
+{
+ return cmArgumentParser<Arguments>{ base }.Bind("OUTPUT_VARIABLE"_s,
+ &Arguments::OutputVariable);
+}
+
+cmArgumentParser<Arguments> makeTryRunParser(
+ const cmArgumentParser<Arguments>& base)
+{
+ return cmArgumentParser<Arguments>{ base }
+ .Bind("COMPILE_OUTPUT_VARIABLE"_s, &Arguments::CompileOutputVariable)
+ .Bind("RUN_OUTPUT_VARIABLE"_s, &Arguments::RunOutputVariable)
+ .Bind("RUN_OUTPUT_STDOUT_VARIABLE"_s, &Arguments::RunOutputStdOutVariable)
+ .Bind("RUN_OUTPUT_STDERR_VARIABLE"_s, &Arguments::RunOutputStdErrVariable)
+ .Bind("WORKING_DIRECTORY"_s, &Arguments::RunWorkingDirectory)
+ .Bind("ARGS"_s, &Arguments::RunArgs)
+ /* keep semicolon on own line */;
+}
+
#define BIND_LANG_PROPS(lang) \
Bind(#lang "_STANDARD"_s, TryCompileLangProp) \
.Bind(#lang "_STANDARD_REQUIRED"_s, TryCompileLangProp) \
@@ -129,13 +149,17 @@ ArgumentParser::Continue TryCompileCompileDefs(Arguments& args,
auto const TryCompileBaseArgParser =
cmArgumentParser<Arguments>{}
.Bind(0, &Arguments::CompileResultVariable)
- .Bind("SOURCES"_s, &Arguments::Sources)
.Bind("CMAKE_FLAGS"_s, &Arguments::CMakeFlags)
+ .Bind("__CMAKE_INTERNAL"_s, &Arguments::CMakeInternal)
+ /* keep semicolon on own line */;
+
+auto const TryCompileBaseNonProjectArgParser =
+ cmArgumentParser<Arguments>{ TryCompileBaseArgParser }
+ .Bind("SOURCES"_s, &Arguments::Sources)
.Bind("COMPILE_DEFINITIONS"_s, TryCompileCompileDefs,
ArgumentParser::ExpectAtLeast{ 0 })
.Bind("LINK_LIBRARIES"_s, &Arguments::LinkLibraries)
.Bind("LINK_OPTIONS"_s, &Arguments::LinkOptions)
- .Bind("__CMAKE_INTERNAL"_s, &Arguments::CMakeInternal)
.Bind("COPY_FILE"_s, &Arguments::CopyFileTo)
.Bind("COPY_FILE_ERROR"_s, &Arguments::CopyFileError)
.BIND_LANG_PROPS(C)
@@ -146,38 +170,35 @@ auto const TryCompileBaseArgParser =
.BIND_LANG_PROPS(OBJCXX)
/* keep semicolon on own line */;
-auto const TryCompileArgParser =
- cmArgumentParser<Arguments>{ TryCompileBaseArgParser }.Bind(
- "OUTPUT_VARIABLE"_s, &Arguments::OutputVariable)
+auto const TryCompileBaseProjectArgParser =
+ cmArgumentParser<Arguments>{ TryCompileBaseArgParser }
+ .Bind("PROJECT"_s, &Arguments::ProjectName)
+ .Bind("SOURCE_DIR"_s, &Arguments::SourceDirectoryOrFile)
+ .Bind("BINARY_DIR"_s, &Arguments::BinaryDirectory)
+ .Bind("TARGET"_s, &Arguments::TargetName)
/* keep semicolon on own line */;
+auto const TryCompileProjectArgParser =
+ makeTryCompileParser(TryCompileBaseProjectArgParser);
+
+auto const TryCompileSourcesArgParser =
+ makeTryCompileParser(TryCompileBaseNonProjectArgParser);
+
auto const TryCompileOldArgParser =
- cmArgumentParser<Arguments>{ TryCompileArgParser }
+ makeTryCompileParser(TryCompileBaseNonProjectArgParser)
.Bind(1, &Arguments::BinaryDirectory)
.Bind(2, &Arguments::SourceDirectoryOrFile)
.Bind(3, &Arguments::ProjectName)
.Bind(4, &Arguments::TargetName)
/* keep semicolon on own line */;
-auto const TryRunArgParser =
- cmArgumentParser<Arguments>{ TryCompileBaseArgParser }
- .Bind("COMPILE_OUTPUT_VARIABLE"_s, &Arguments::CompileOutputVariable)
- .Bind("RUN_OUTPUT_VARIABLE"_s, &Arguments::RunOutputVariable)
- .Bind("RUN_OUTPUT_STDOUT_VARIABLE"_s, &Arguments::RunOutputStdOutVariable)
- .Bind("RUN_OUTPUT_STDERR_VARIABLE"_s, &Arguments::RunOutputStdErrVariable)
- .Bind("WORKING_DIRECTORY"_s, &Arguments::RunWorkingDirectory)
- .Bind("ARGS"_s, &Arguments::RunArgs)
- /* keep semicolon on own line */;
+auto const TryRunProjectArgParser =
+ makeTryRunParser(TryCompileBaseProjectArgParser);
-auto const TryRunOldArgParser =
- cmArgumentParser<Arguments>{ TryCompileOldArgParser }
- .Bind("COMPILE_OUTPUT_VARIABLE"_s, &Arguments::CompileOutputVariable)
- .Bind("RUN_OUTPUT_VARIABLE"_s, &Arguments::RunOutputVariable)
- .Bind("RUN_OUTPUT_STDOUT_VARIABLE"_s, &Arguments::RunOutputStdOutVariable)
- .Bind("RUN_OUTPUT_STDERR_VARIABLE"_s, &Arguments::RunOutputStdErrVariable)
- .Bind("WORKING_DIRECTORY"_s, &Arguments::RunWorkingDirectory)
- .Bind("ARGS"_s, &Arguments::RunArgs)
- /* keep semicolon on own line */;
+auto const TryRunSourcesArgParser =
+ makeTryRunParser(TryCompileBaseNonProjectArgParser);
+
+auto const TryRunOldArgParser = makeTryRunParser(TryCompileOldArgParser);
#undef BIND_LANG_PROPS
}
@@ -203,11 +224,24 @@ Arguments cmCoreTryCompile::ParseArgs(
cmRange<std::vector<std::string>::const_iterator> args, bool isTryRun)
{
std::vector<std::string> unparsedArguments;
- if (cmHasLiteralPrefix(*(++args.begin()), "SOURCE")) {
- // New signature.
- auto arguments =
- this->ParseArgs(args, isTryRun ? TryRunArgParser : TryCompileArgParser,
- unparsedArguments);
+ const auto& second = *(++args.begin());
+
+ if (second == "PROJECT") {
+ // New PROJECT signature.
+ auto arguments = this->ParseArgs(
+ args, isTryRun ? TryRunProjectArgParser : TryCompileProjectArgParser,
+ unparsedArguments);
+ if (!arguments.BinaryDirectory) {
+ arguments.BinaryDirectory = unique_binary_directory;
+ }
+ return arguments;
+ }
+
+ if (cmHasLiteralPrefix(second, "SOURCE")) {
+ // New SOURCES signature.
+ auto arguments = this->ParseArgs(
+ args, isTryRun ? TryRunSourcesArgParser : TryCompileSourcesArgParser,
+ unparsedArguments);
arguments.BinaryDirectory = unique_binary_directory;
return arguments;
}
@@ -256,8 +290,14 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments,
std::string sourceDirectory;
std::string projectName;
std::string targetName;
- if (arguments.SourceDirectoryOrFile && arguments.ProjectName) {
+ if (arguments.ProjectName) {
this->SrcFileSignature = false;
+ if (!arguments.SourceDirectoryOrFile ||
+ arguments.SourceDirectoryOrFile->empty()) {
+ this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+ "No <srcdir> specified.");
+ return false;
+ }
sourceDirectory = *arguments.SourceDirectoryOrFile;
projectName = *arguments.ProjectName;
if (arguments.TargetName) {
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index 28ee24d..fd6aee1 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -34,10 +34,21 @@
std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile)
{
std::string e;
+ std::string env_ca;
if (!cafile.empty()) {
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile.c_str());
check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
}
+ /* Honor the user-configurable OpenSSL environment variables. */
+ else if (cmSystemTools::GetEnv("SSL_CERT_FILE", env_ca) &&
+ cmSystemTools::FileExists(env_ca, true)) {
+ ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, env_ca.c_str());
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+ } else if (cmSystemTools::GetEnv("SSL_CERT_DIR", env_ca) &&
+ cmSystemTools::FileIsDirectory(env_ca)) {
+ ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAPATH, env_ca.c_str());
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+ }
#ifdef CMAKE_FIND_CAFILE
# define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt"
else if (cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true)) {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6196861..2c455cf 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3776,14 +3776,20 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// add the library search paths
{
BuildObjectListOrString libSearchPaths(this, true);
+
std::string linkDirs;
for (auto const& libDir : cli->GetDirectories()) {
if (!libDir.empty() && libDir != "/usr/lib") {
- libSearchPaths.Add(this->XCodeEscapePath(
- libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ cmPolicies::PolicyStatus cmp0142 =
+ target->GetTarget()->GetPolicyStatusCMP0142();
+ if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) {
+ libSearchPaths.Add(this->XCodeEscapePath(
+ libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ }
libSearchPaths.Add(this->XCodeEscapePath(libDir));
}
}
+
// Add previously collected paths where to look for libraries
// that were added to "Link Binary With Libraries"
for (auto& libDir : linkSearchPaths) {
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ea25814..4643868 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -427,7 +427,11 @@ class cmMakefile;
SELECT( \
POLICY, CMP0141, \
"MSVC debug information format flags are selected by an abstraction.", 3, \
- 25, 0, cmPolicies::WARN)
+ 25, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0142, \
+ "The Xcode generator does not append per-config suffixes to " \
+ "library search paths.", \
+ 3, 25, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
@@ -464,7 +468,8 @@ class cmMakefile;
F(CMP0112) \
F(CMP0113) \
F(CMP0119) \
- F(CMP0131)
+ F(CMP0131) \
+ F(CMP0142)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index b59c225..a2c4ce1 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -16,12 +16,15 @@
bool cmTryCompileCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
+ cmMakefile& mf = status.GetMakefile();
+
if (args.size() < 3) {
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The try_compile() command requires at least 3 arguments.");
return false;
}
- cmMakefile& mf = status.GetMakefile();
-
if (mf.GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
mf.IssueMessage(
MessageType::FATAL_ERROR,
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 7a29521..70c7cf1 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -469,12 +469,14 @@ void TryRunCommandImpl::DoNotRunExecutable(
bool cmTryRunCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
+ cmMakefile& mf = status.GetMakefile();
+
if (args.size() < 4) {
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ "The try_run() command requires at least 4 arguments.");
return false;
}
- cmMakefile& mf = status.GetMakefile();
-
if (mf.GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
mf.IssueMessage(
MessageType::FATAL_ERROR,
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 281e63f..3b105e3 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1145,7 +1145,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
} else {
cmSystemTools::Error(
"Invalid value specified for --list-presets.\n"
- "Valid values are configure, build, test, or all. "
+ "Valid values are configure, build, test, package, or all. "
"When no value is passed the default is configure.");
return false;
}
diff --git a/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt
new file mode 100644
index 0000000..153abee
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error: Invalid value specified for --list-presets\.
+Valid values are configure, build, test, package, or all\. When no value is passed the default is configure\.
+CMake Error: Run 'cmake --help' for all supported options\.$
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index c511b34..4f57e2f 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -289,6 +289,7 @@ run_cmake_presets(UserInheritance)
# Test listing presets
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in")
run_cmake_presets(ListPresets --list-presets)
+run_cmake_presets(ListPresetsInvalidType --list-presets=invalid-type)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir")
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
index e389e6b..3b095a6 100644
--- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
@@ -44,6 +44,9 @@ run_cmake(exact_0_matching)
set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=")
run_cmake(empty_version)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}")
+run_cmake(exact_1_no_version_var)
+
# check custom error message
set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DCustomMessage_VERSION=1.2.3.4")
run_cmake(custom_message_1)
diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt
new file mode 100644
index 0000000..7cbdf6e
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt
@@ -0,0 +1 @@
+-- Found Pseudo: TRUE \(Required is at least version "1"\)
diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake
new file mode 100644
index 0000000..7b7ff34
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake
@@ -0,0 +1 @@
+find_package(Pseudo 1 REQUIRED)
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 97c3394..0d8e4c9 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -36,6 +36,7 @@
\* CMP0113
\* CMP0119
\* CMP0131
+ \* CMP0142
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake
index 71b7d8f..bec8790 100644
--- a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake
+++ b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake
@@ -12,6 +12,8 @@ set(found_target_library_FRAMEWORK_SEARCH_PATHS 0)
set(found_inherited_FRAMEWORK_SEARCH_PATHS 0)
set(found_project_LIBRARY_SEARCH_PATHS 0)
set(found_target_library_LIBRARY_SEARCH_PATHS 0)
+set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 0)
+set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 0)
set(found_inherited_LIBRARY_SEARCH_PATHS 0)
file(STRINGS "${xcProjectFile}" lines)
foreach(line IN LISTS lines)
@@ -42,6 +44,12 @@ foreach(line IN LISTS lines)
if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]])
set(found_target_library_LIBRARY_SEARCH_PATHS 1)
endif()
+ if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD(\\")?","\$\(inherited\)"\);]])
+ set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 1)
+ endif()
+ if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142NEW(\\")?","\$\(inherited\)"\);]])
+ set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 1)
+ endif()
if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("\$\(inherited\)"\);]])
set(found_inherited_LIBRARY_SEARCH_PATHS 1)
endif()
@@ -68,6 +76,12 @@ endif()
if(NOT found_target_library_LIBRARY_SEARCH_PATHS)
string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'library' in\n ${xcProjectFile}\n")
endif()
+if(NOT found_target_cmp0142old_LIBRARY_SEARCH_PATHS)
+ string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142old' in\n ${xcProjectFile}\n")
+endif()
+if(NOT found_target_cmp0142new_LIBRARY_SEARCH_PATHS)
+ string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142new' in\n ${xcProjectFile}\n")
+endif()
if(found_inherited_LIBRARY_SEARCH_PATHS)
string(APPEND RunCMake_TEST_FAILED "Found unexpected LIBRARY_SEARCH_PATHS inherited-only value in\n ${xcProjectFile}\n")
endif()
diff --git a/Tests/RunCMake/XcodeProject/SearchPaths.cmake b/Tests/RunCMake/XcodeProject/SearchPaths.cmake
index ef97709..b469772 100644
--- a/Tests/RunCMake/XcodeProject/SearchPaths.cmake
+++ b/Tests/RunCMake/XcodeProject/SearchPaths.cmake
@@ -3,6 +3,8 @@ enable_language(C)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathInc/TargetInc.framework")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework")
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD")
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW")
set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath")
set(CMAKE_XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath")
@@ -19,3 +21,11 @@ target_include_directories(include PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSe
add_executable(library main.c)
target_link_libraries(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework")
target_link_directories(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib")
+
+cmake_policy(SET CMP0142 OLD)
+add_executable(cmp0142old main.c)
+target_link_directories(cmp0142old PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD")
+
+cmake_policy(SET CMP0142 NEW)
+add_executable(cmp0142new main.c)
+target_link_directories(cmp0142new PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW")
diff --git a/Tests/RunCMake/try_compile/NoArgs-stderr.txt b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
index 72a697e..4228580 100644
--- a/Tests/RunCMake/try_compile/NoArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
@@ -1,4 +1,4 @@
CMake Error at NoArgs.cmake:[0-9]+ \(try_compile\):
- try_compile unknown error.
+ The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt
new file mode 100644
index 0000000..e9ec450
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at OldProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake
new file mode 100644
index 0000000..fa922d9
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(RESULT "" ${CMAKE_CURRENT_SOURCE_DIR}/proj Foo)
diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt
new file mode 100644
index 0000000..47dd60f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at OldProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <srcdir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake
new file mode 100644
index 0000000..dfbfba6
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} "" Foo)
diff --git a/Tests/RunCMake/try_compile/OneArg-stderr.txt b/Tests/RunCMake/try_compile/OneArg-stderr.txt
index bb0239e..a2e983e 100644
--- a/Tests/RunCMake/try_compile/OneArg-stderr.txt
+++ b/Tests/RunCMake/try_compile/OneArg-stderr.txt
@@ -1,4 +1,4 @@
CMake Error at OneArg.cmake:[0-9]+ \(try_compile\):
- try_compile unknown error.
+ The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt
new file mode 100644
index 0000000..57a2bd0
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at ProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake
new file mode 100644
index 0000000..e867cc6
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake
@@ -0,0 +1,4 @@
+try_compile(RESULT PROJECT Foo
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj
+ BINARY_DIR ""
+ )
diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt
new file mode 100644
index 0000000..45241c9
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt
@@ -0,0 +1,7 @@
+CMake Warning \(dev\) at ProjectCopyFile.cmake:[0-9]+ \(try_compile\):
+ Unknown arguments:
+
+ "COPY_FILE"
+ "result"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile.cmake b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake
new file mode 100644
index 0000000..6bfec99
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake
@@ -0,0 +1,4 @@
+try_compile(RESULT
+ PROJECT TestProject
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj
+ COPY_FILE result)
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt
new file mode 100644
index 0000000..dc6f354
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <srcdir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake
new file mode 100644
index 0000000..ac33ed0
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(RESULT PROJECT Foo SOURCE_DIR "")
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt
new file mode 100644
index 0000000..af6edd5
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ProjectSrcDirMissing.cmake:[0-9]+ \(try_compile\):
+ No <srcdir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake
new file mode 100644
index 0000000..e32cdf4
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake
@@ -0,0 +1 @@
+try_compile(RESULT PROJECT Foo)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index c0fdd9f..bb11a57 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -6,6 +6,11 @@ run_cmake(TwoArgs)
run_cmake(NoSources)
run_cmake(BinDirEmpty)
run_cmake(BinDirRelative)
+run_cmake(ProjectSrcDirMissing)
+run_cmake(ProjectSrcDirEmpty)
+run_cmake(ProjectBinDirEmpty)
+run_cmake(OldProjectSrcDirEmpty)
+run_cmake(OldProjectBinDirEmpty)
set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake)
include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
@@ -15,6 +20,7 @@ set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake)
include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
unset(RunCMake_TEST_OPTIONS)
+run_cmake(ProjectCopyFile)
run_cmake(NonSourceCopyFile)
run_cmake(NonSourceCompileDefinitions)
diff --git a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
index 38f1d75..b68e78e 100644
--- a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
@@ -1,4 +1,4 @@
CMake Error at TwoArgs.cmake:[0-9]+ \(try_compile\):
- try_compile unknown error.
+ The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
index f80d445..ac07ad3 100644
--- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
+++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
@@ -1,3 +1,12 @@
+# These tests are performed using both the historic and the newer SOURCES
+# signatures of try_compile. It is critical that they behave the same and
+# produce comparable output for both signatures. Tests that cannot do this
+# belong in RunCMakeTests.txt, not here.
+#
+# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and
+# use the variables defined therein appropriately. Refer to existing tests for
+# examples.
+
run_cmake(CopyFileErrorNoCopyFile)
run_cmake(NoCopyFile)
run_cmake(NoCopyFile2)
diff --git a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake
index 2332127..e1c1784 100644
--- a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake
+++ b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake
@@ -1,3 +1,12 @@
+# These tests are performed using both the historic and the newer SOURCES
+# signatures of try_run. It is critical that they behave the same and produce
+# comparable output for both signatures. Tests that cannot do this belong in
+# RunCMakeTests.txt, not here.
+#
+# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and
+# use the variables defined therein appropriately. Refer to existing tests for
+# examples.
+
run_cmake(BadLinkLibraries)
run_cmake(BinDirEmpty)
run_cmake(BinDirRelative)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index a53dd93..8ebb00a 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -65,7 +65,7 @@ set(try_compile_run_output_var RUN_OUTPUT)
include(old_and_new_signature_tests.cmake)
# try to compile a project (old signature)
-message("Testing try_compile project mode")
+message("Testing try_compile project mode (old signature)")
try_compile(TEST_INNER
${TryCompile_BINARY_DIR}/CMakeFiles/Inner
${TryCompile_SOURCE_DIR}/Inner
@@ -73,6 +73,15 @@ try_compile(TEST_INNER
OUTPUT_VARIABLE output)
TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
+# try to compile a project (new signature)
+message("Testing try_compile project mode (new signature)")
+try_compile(TEST_INNER
+ PROJECT TryCompileInner
+ SOURCE_DIR ${TryCompile_SOURCE_DIR}/Inner
+ TARGET innerexe
+ OUTPUT_VARIABLE output)
+TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
+
add_executable(TryCompile pass.c)
#######################################################################