summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/execute_process.rst8
-rw-r--r--Help/release/dev/UseSWIG-output-source-properties.rst5
-rw-r--r--Help/release/dev/execute-process-command-error-is-fatal.rst5
-rw-r--r--Modules/FindSWIG.cmake7
-rw-r--r--Modules/UseSWIG.cmake51
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx3
-rw-r--r--Source/cmCMakeLanguageCommand.cxx12
-rw-r--r--Source/cmCPluginAPI.cxx9
-rw-r--r--Source/cmExecuteProcessCommand.cxx58
-rw-r--r--Source/cmForEachCommand.cxx2
-rw-r--r--Source/cmFunctionBlocker.cxx4
-rw-r--r--Source/cmFunctionCommand.cxx2
-rw-r--r--Source/cmIfCommand.cxx23
-rw-r--r--Source/cmListFileCache.cxx23
-rw-r--r--Source/cmListFileCache.h57
-rw-r--r--Source/cmMacroCommand.cxx15
-rw-r--r--Source/cmMakefile.cxx42
-rw-r--r--Source/cmMakefileProfilingData.cxx6
-rw-r--r--Source/cmMakefileProfilingData.h2
-rw-r--r--Source/cmVariableWatchCommand.cxx9
-rw-r--r--Source/cmWhileCommand.cxx2
-rw-r--r--Tests/FindPython/ArtifactsInteractive/CMakeLists.txt2
-rw-r--r--Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt2
-rw-r--r--Tests/FindPython/ExactVersion/CMakeLists.txt36
-rw-r--r--Tests/FindPython/Implementation/CMakeLists.txt6
-rw-r--r--Tests/FindPython/IronPython/CMakeLists.txt8
-rw-r--r--Tests/FindPython/IronPython2/CMakeLists.txt8
-rw-r--r--Tests/FindPython/PyPy/CMakeLists.txt12
-rw-r--r--Tests/FindPython/PyPy2/CMakeLists.txt12
-rw-r--r--Tests/FindPython/PyPy3/CMakeLists.txt12
-rw-r--r--Tests/FindPython/Python/CMakeLists.txt8
-rw-r--r--Tests/FindPython/Python2/CMakeLists.txt10
-rw-r--r--Tests/FindPython/Python2Embedded/CMakeLists.txt4
-rw-r--r--Tests/FindPython/Python2Module/CMakeLists.txt4
-rw-r--r--Tests/FindPython/Python3/CMakeLists.txt10
-rw-r--r--Tests/FindPython/Python3Embedded/CMakeLists.txt4
-rw-r--r--Tests/FindPython/Python3Module/CMakeLists.txt4
-rw-r--r--Tests/FindPython/RequiredArtifacts/CMakeLists.txt6
-rw-r--r--Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt8
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt4
-rw-r--r--Tests/FindPython/VirtualEnv/CMakeLists.txt2
-rw-r--r--Tests/FindPython/VirtualEnvConda/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/FindSWIG/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/FindSWIG/version-exact.cmake17
-rw-r--r--Tests/RunCMake/FindSWIG/version.cmake6
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandError-result.txt1
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandError-stderr.txt2
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandError.cmake8
-rw-r--r--Tests/RunCMake/execute_process/CommandError-result.txt1
-rw-r--r--Tests/RunCMake/execute_process/CommandError-stderr.txt2
-rw-r--r--Tests/RunCMake/execute_process/CommandError.cmake3
-rw-r--r--Tests/RunCMake/execute_process/LastCommandError-result.txt1
-rw-r--r--Tests/RunCMake/execute_process/LastCommandError-stderr.txt2
-rw-r--r--Tests/RunCMake/execute_process/LastCommandError.cmake8
-rw-r--r--Tests/RunCMake/execute_process/RunCMakeTest.cmake4
-rw-r--r--Tests/UseSWIG/CMakeLists.txt12
-rw-r--r--Tests/UseSWIG/NamespaceCsharp/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/CMakeLists.txt61
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/ValidateSupportFiles.cmake17
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.hpp15
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.i8
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/cs.cpp29
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.hpp15
-rw-r--r--Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.i8
65 files changed, 553 insertions, 182 deletions
diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst
index b32025f..a6f141a 100644
--- a/Help/command/execute_process.rst
+++ b/Help/command/execute_process.rst
@@ -23,7 +23,8 @@ Execute one or more child processes.
[ERROR_STRIP_TRAILING_WHITESPACE]
[ENCODING <name>]
[ECHO_OUTPUT_VARIABLE]
- [ECHO_ERROR_VARIABLE])
+ [ECHO_ERROR_VARIABLE]
+ [COMMAND_ERROR_IS_FATAL <ANY|LAST>])
Runs the given sequence of one or more commands.
@@ -116,6 +117,11 @@ Options:
This is analogous to the ``tee`` Unix command.
+``COMMAND_ERROR_IS_FATAL <ANY|LAST>``
+ ``COMMAND_ERROR_IS_FATAL ANY`` option stops processing if any command fails.
+ ``COMMAND_ERROR_IS_FATAL LAST`` option stops processing if the last command
+ in the command list fails.
+
If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
same pipe the precedence is not specified.
If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will
diff --git a/Help/release/dev/UseSWIG-output-source-properties.rst b/Help/release/dev/UseSWIG-output-source-properties.rst
new file mode 100644
index 0000000..62796a2
--- /dev/null
+++ b/Help/release/dev/UseSWIG-output-source-properties.rst
@@ -0,0 +1,5 @@
+UseSwig-output-source-properties
+--------------------------------
+
+* :module:`UseSWIG` module gains new source file properties ``OUTPUT_DIR`` and
+ ``OUTFILE_DIR`` to manage output directories on per source basis.
diff --git a/Help/release/dev/execute-process-command-error-is-fatal.rst b/Help/release/dev/execute-process-command-error-is-fatal.rst
new file mode 100644
index 0000000..fbc54bf
--- /dev/null
+++ b/Help/release/dev/execute-process-command-error-is-fatal.rst
@@ -0,0 +1,5 @@
+execute-process-command-error-is-fatal
+--------------------------------------
+
+* The :command:`execute_process` command gained a ``COMMAND_ERROR_IS_FATAL``
+ option to specify a fatal error.
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index f732289..87a3894 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -56,8 +56,8 @@ optional Fortran support:
#]=======================================================================]
# compute list of possible names
+unset (_SWIG_NAMES)
if (SWIG_FIND_VERSION_RANGE)
- set (_SWIG_NAMES)
foreach (_SWIG_MAJOR IN ITEMS 4 3 2)
if (_SWIG_MAJOR VERSION_GREATER_EQUAL SWIG_FIND_VERSION_MIN_MAJOR
AND ((SWIG_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND _SWIG_MAJOR VERSION_LESS_EQUAL SWIG_FIND_VERSION_MAX)
@@ -73,10 +73,15 @@ elseif(SWIG_FIND_VERSION)
if (_SWIG_MAJOR VERSION_GREATER_EQUAL SWIG_FIND_VERSION_MAJOR)
list (APPEND _SWIG_NAMES swig${_SWIG_MAJOR}.0)
endif()
+ endforeach()
endif()
else()
set (_SWIG_NAMES swig4.0 swig3.0 swig2.0)
endif()
+if (NOT _SWIG_NAMES)
+ # try to find any version
+ set (_SWIG_NAMES swig4.0 swig3.0 swig2.0)
+endif()
find_program(SWIG_EXECUTABLE NAMES ${_SWIG_NAMES} swig)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 59a0707..757e539 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -76,8 +76,8 @@ Defines the following command for use with ``SWIG``:
``OUTFILE_DIR``
Specify an output directory name where the generated source file will be
- placed (swig -o option). If not specified, the ``SWIG_OUTFILE_DIR`` variable
- will be used. If neither is specified, ``OUTPUT_DIR`` or
+ placed (swig ``-o`` option). If not specified, the ``SWIG_OUTFILE_DIR``
+ variable will be used. If neither is specified, ``OUTPUT_DIR`` or
``CMAKE_SWIG_OUTDIR`` is used instead.
``SOURCES``
@@ -156,6 +156,19 @@ ensure generated files will receive the required settings.
If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>``
is passed to ``SWIG`` compiler.
+``OUTPUT_DIR``
+ Specify where to write the language specific files (swig ``-outdir`` option)
+ for the considered source file. If not specified, the other ways to define
+ the output directory applies (see ``OUTPUT_DIR`` option of
+ ``swig_add_library()`` command).
+
+``OUTFILE_DIR``
+ Specify an output directory where the generated source file will be placed
+ (swig ``-o`` option) for the considered source file. If not specified,
+ ``OUTPUT_DIR`` source property will be used. If neither are specified, the
+ other ways to define output file directory applies (see ``OUTFILE_DIR``
+ option of ``swig_add_library()`` command).
+
Target library properties can be set to apply same configuration to all SWIG
input files.
@@ -209,6 +222,11 @@ information about support files generated by ``SWIG`` interface compilation.
This output property specifies the directory where support files will be
generated.
+ .. note::
+
+ When source property ``OUTPUT_DIR`` is defined, multiple directories can be
+ specified as part of ``SWIG_SUPPORT_FILES_DIRECTORY``.
+
Some variables can be set to customize the behavior of ``swig_add_library``
as well as ``SWIG``:
@@ -375,15 +393,24 @@ endfunction()
function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
get_filename_component(swig_source_file_name_we "${infile}" NAME_WE)
get_source_file_property(swig_source_file_cplusplus "${infile}" CPLUSPLUS)
-
- # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
- if(CMAKE_SWIG_OUTDIR)
+ get_source_file_property(swig_source_file_outdir "${infile}" OUTPUT_DIR)
+ get_source_file_property(swig_source_file_outfiledir "${infile}" OUTFILE_DIR)
+
+ if (swig_source_file_outdir)
+ # use source file property
+ set(outdir "${swig_source_file_outdir}")
+ if (NOT swig_source_file_outfiledir)
+ set (swig_source_file_outfiledir "${outdir}")
+ endif()
+ elseif(CMAKE_SWIG_OUTDIR)
set(outdir ${CMAKE_SWIG_OUTDIR})
else()
set(outdir ${CMAKE_CURRENT_BINARY_DIR})
endif()
- if(SWIG_OUTFILE_DIR)
+ if (swig_source_file_outfiledir)
+ set (outfiledir "${swig_source_file_outfiledir}")
+ elseif(SWIG_OUTFILE_DIR)
set(outfiledir ${SWIG_OUTFILE_DIR})
else()
set(outfiledir ${outdir})
@@ -725,6 +752,7 @@ function(SWIG_ADD_LIBRARY name)
set(swig_generated_sources)
set(swig_generated_timestamps)
+ set(swig_generated_outdirs "${outputdir}")
list(LENGTH swig_dot_i_sources swig_sources_count)
if (swig_sources_count GREATER "1")
# option -interface cannot be used
@@ -740,11 +768,16 @@ function(SWIG_ADD_LIBRARY name)
"${workingdir}" swig_timestamp)
list (APPEND swig_generated_timestamps "${swig_timestamp}")
endif()
+ get_source_file_property(swig_source_file_outdir "${swig_it}" OUTPUT_DIR)
+ if (swig_source_file_outdir)
+ list (APPEND swig_generated_outdirs "${swig_source_file_outdir}")
+ endif()
endforeach()
+ list(REMOVE_DUPLICATES swig_generated_outdirs)
set_property (DIRECTORY APPEND PROPERTY
ADDITIONAL_CLEAN_FILES ${swig_generated_sources} ${swig_generated_timestamps})
if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
- set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${outputdir}")
+ set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${swig_generated_outdirs})
endif()
add_library(${target_name}
@@ -828,8 +861,8 @@ function(SWIG_ADD_LIBRARY name)
set_target_properties (${target_name} PROPERTIES PREFIX "")
endif ()
- # target property SWIG_SUPPORT_FILES_DIRECTORY specify output directory of support files
- set_property (TARGET ${target_name} PROPERTY SWIG_SUPPORT_FILES_DIRECTORY "${outputdir}")
+ # target property SWIG_SUPPORT_FILES_DIRECTORY specify output directories of support files
+ set_property (TARGET ${target_name} PROPERTY SWIG_SUPPORT_FILES_DIRECTORY ${swig_generated_outdirs})
# target property SWIG_SUPPORT_FILES lists principal proxy support files
if (NOT SWIG_MODULE_${name}_NOPROXY)
string(TOUPPER "${_SAM_LANGUAGE}" swig_uppercase_language)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 524dea1..0b18af6 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 18)
-set(CMake_VERSION_PATCH 20201002)
+set(CMake_VERSION_PATCH 20201004)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 8b31e4b..73bf764 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -468,7 +468,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
} else if (testerName.find("BC") != std::string::npos) {
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
- } else if (testerName.find("cuda-memcheck") != std::string::npos) {
+ } else if (testerName.find("cuda-memcheck") != std::string::npos ||
+ testerName.find("compute-sanitizer") != std::string::npos) {
this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_MEMCHECK;
} else {
this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN;
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
index 9277c20..789c78d 100644
--- a/Source/cmCMakeLanguageCommand.cxx
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -77,18 +77,14 @@ bool cmCMakeLanguageCommandCALL(std::vector<cmListFileArgument> const& args,
cmMakefile& makefile = status.GetMakefile();
cmListFileContext context = makefile.GetBacktrace().Top();
- cmListFileFunction func;
- func.Name = callCommand;
- func.Line = context.Line;
+ std::vector<cmListFileArgument> funcArgs;
+ funcArgs.reserve(args.size() - startArg);
// The rest of the arguments are passed to the function call above
for (size_t i = startArg; i < args.size(); ++i) {
- cmListFileArgument lfarg;
- lfarg.Delim = args[i].Delim;
- lfarg.Line = context.Line;
- lfarg.Value = args[i].Value;
- func.Arguments.emplace_back(lfarg);
+ funcArgs.emplace_back(args[i].Value, args[i].Delim, context.Line);
}
+ cmListFileFunction func{ callCommand, context.Line, std::move(funcArgs) };
if (defer) {
if (defer->Id.empty()) {
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index ee2960b..8ebf6d2 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -419,12 +419,15 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
const char** args)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmListFileFunction lff;
- lff.Name = name;
+
+ std::vector<cmListFileArgument> lffArgs;
+ lffArgs.reserve(numArgs);
for (int i = 0; i < numArgs; ++i) {
// Assume all arguments are quoted.
- lff.Arguments.emplace_back(args[i], cmListFileArgument::Quoted, 0);
+ lffArgs.emplace_back(args[i], cmListFileArgument::Quoted, 0);
}
+
+ cmListFileFunction lff{ name, 0, std::move(lffArgs) };
cmExecutionStatus status(*mf);
return mf->ExecuteCommand(lff, status);
}
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 9c53bdf..14147e0 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -7,8 +7,10 @@
#include <cstdio>
#include <iostream>
#include <memory>
+#include <sstream>
#include <vector>
+#include <cm/string_view>
#include <cmext/algorithm>
#include <cmext/string_view>
@@ -63,6 +65,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
bool EchoOutputVariable = false;
bool EchoErrorVariable = false;
std::string Encoding;
+ std::string CommandErrorIsFatal;
};
static auto const parser =
@@ -86,7 +89,8 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
&Arguments::ErrorStripTrailingWhitespace)
.Bind("ENCODING"_s, &Arguments::Encoding)
.Bind("ECHO_OUTPUT_VARIABLE"_s, &Arguments::EchoOutputVariable)
- .Bind("ECHO_ERROR_VARIABLE"_s, &Arguments::EchoErrorVariable);
+ .Bind("ECHO_ERROR_VARIABLE"_s, &Arguments::EchoErrorVariable)
+ .Bind("COMMAND_ERROR_IS_FATAL"_s, &Arguments::CommandErrorIsFatal);
std::vector<std::string> unparsedArguments;
std::vector<std::string> keywordsMissingValue;
@@ -131,6 +135,14 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
return false;
}
}
+
+ if (!arguments.CommandErrorIsFatal.empty()) {
+ if (arguments.CommandErrorIsFatal != "ANY"_s &&
+ arguments.CommandErrorIsFatal != "LAST"_s) {
+ status.SetError("COMMAND_ERROR_IS_FATAL option can be ANY or LAST");
+ return false;
+ }
+ }
// Create a process instance.
std::unique_ptr<cmsysProcess, void (*)(cmsysProcess*)> cp_ptr(
cmsysProcess_New(), cmsysProcess_Delete);
@@ -363,6 +375,50 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
}
+ if (arguments.CommandErrorIsFatal == "ANY"_s) {
+ if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
+ std::vector<int> failedIndexes;
+ for (int i = 0; i < static_cast<int>(arguments.Commands.size()); ++i) {
+ if (cmsysProcess_GetStateByIndex(cp, i) ==
+ kwsysProcess_StateByIndex_Exited) {
+ int exitCode = cmsysProcess_GetExitValueByIndex(cp, i);
+ if (exitCode) {
+ failedIndexes.push_back(i);
+ }
+ }
+ }
+ if (!failedIndexes.empty()) {
+ std::ostringstream oss;
+ oss << "failed command indexes: ";
+ for (auto i = 0u; i < failedIndexes.size(); i++) {
+ if (i == failedIndexes.size() - 1) {
+ oss << failedIndexes[i] + 1;
+ } else {
+ oss << failedIndexes[i] + 1 << ", ";
+ }
+ }
+ status.SetError(oss.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ }
+ }
+
+ if (arguments.CommandErrorIsFatal == "LAST"_s) {
+ if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
+ int lastIndex = static_cast<int>(arguments.Commands.size() - 1);
+ if (cmsysProcess_GetStateByIndex(cp, lastIndex) ==
+ kwsysProcess_StateByIndex_Exited) {
+ int exitCode = cmsysProcess_GetExitValueByIndex(cp, lastIndex);
+ if (exitCode) {
+ status.SetError("last command failed");
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ }
+ }
+ }
+
return true;
}
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 42df923..bcacb15 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -90,7 +90,7 @@ bool cmForEachFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments(), expandedArguments);
return expandedArguments.empty() ||
expandedArguments.front() == this->Args.front();
}
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
index 643cd82..d4666d7 100644
--- a/Source/cmFunctionBlocker.cxx
+++ b/Source/cmFunctionBlocker.cxx
@@ -15,9 +15,9 @@
bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus& status)
{
- if (lff.Name.Lower == this->StartCommandName()) {
+ if (lff.LowerCaseName() == this->StartCommandName()) {
this->ScopeDepth++;
- } else if (lff.Name.Lower == this->EndCommandName()) {
+ } else if (lff.LowerCaseName() == this->EndCommandName()) {
this->ScopeDepth--;
if (this->ScopeDepth == 0U) {
cmMakefile& mf = status.GetMakefile();
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 46bd057..71c82d6 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -147,7 +147,7 @@ bool cmFunctionFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments(), expandedArguments);
return expandedArguments.empty() ||
expandedArguments.front() == this->Args.front();
}
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index fc257b1..55f6453 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -54,7 +54,7 @@ public:
bool cmIfFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile&) const
{
- return lff.Arguments.empty() || lff.Arguments == this->Args;
+ return lff.Arguments().empty() || lff.Arguments() == this->Args;
}
bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
@@ -65,19 +65,19 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
int scopeDepth = 0;
for (cmListFileFunction const& func : functions) {
// keep track of scope depth
- if (func.Name.Lower == "if") {
+ if (func.LowerCaseName() == "if") {
scopeDepth++;
}
- if (func.Name.Lower == "endif") {
+ if (func.LowerCaseName() == "endif") {
scopeDepth--;
}
// watch for our state change
- if (scopeDepth == 0 && func.Name.Lower == "else") {
+ if (scopeDepth == 0 && func.LowerCaseName() == "else") {
if (this->ElseSeen) {
- cmListFileBacktrace elseBT = mf.GetBacktrace().Push(
- cmListFileContext{ func.Name.Original,
- this->GetStartingContext().FilePath, func.Line });
+ cmListFileBacktrace elseBT = mf.GetBacktrace().Push(cmListFileContext{
+ func.OriginalName(), this->GetStartingContext().FilePath,
+ func.Line() });
mf.GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
"A duplicate ELSE command was found inside an IF block.", elseBT);
@@ -94,9 +94,10 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
if (!this->IsBlocking && mf.GetCMakeInstance()->GetTrace()) {
mf.PrintCommandTrace(func);
}
- } else if (scopeDepth == 0 && func.Name.Lower == "elseif") {
- cmListFileBacktrace elseifBT = mf.GetBacktrace().Push(cmListFileContext{
- func.Name.Original, this->GetStartingContext().FilePath, func.Line });
+ } else if (scopeDepth == 0 && func.LowerCaseName() == "elseif") {
+ cmListFileBacktrace elseifBT = mf.GetBacktrace().Push(
+ cmListFileContext{ func.OriginalName(),
+ this->GetStartingContext().FilePath, func.Line() });
if (this->ElseSeen) {
mf.GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
@@ -116,7 +117,7 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
std::string errorString;
std::vector<cmExpandedCommandArgument> expandedArguments;
- mf.ExpandArguments(func.Arguments, expandedArguments);
+ mf.ExpandArguments(func.Arguments(), expandedArguments);
MessageType messType;
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index d678b56..70ef5af 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -15,14 +15,6 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-cmCommandContext::cmCommandName& cmCommandContext::cmCommandName::operator=(
- std::string const& name)
-{
- this->Original = name;
- this->Lower = cmSystemTools::LowerCase(name);
- return *this;
-}
-
struct cmListFileParser
{
cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
@@ -43,7 +35,9 @@ struct cmListFileParser
cmMessenger* Messenger;
const char* FileName;
cmListFileLexer* Lexer;
- cmListFileFunction Function;
+ std::string FunctionName;
+ long FunctionLine;
+ std::vector<cmListFileArgument> FunctionArguments;
enum
{
SeparationOkay,
@@ -141,7 +135,9 @@ bool cmListFileParser::Parse()
if (haveNewline) {
haveNewline = false;
if (this->ParseFunction(token->text, token->line)) {
- this->ListFile->Functions.push_back(this->Function);
+ this->ListFile->Functions.emplace_back(
+ std::move(this->FunctionName), this->FunctionLine,
+ std::move(this->FunctionArguments));
} else {
return false;
}
@@ -200,9 +196,8 @@ bool cmListFile::ParseString(const char* str, const char* virtual_filename,
bool cmListFileParser::ParseFunction(const char* name, long line)
{
// Ininitialize a new function call.
- this->Function = cmListFileFunction();
- this->Function.Name = name;
- this->Function.Line = line;
+ this->FunctionName = name;
+ this->FunctionLine = line;
// Command name has already been parsed. Read the left paren.
cmListFileLexer_Token* token;
@@ -297,7 +292,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim)
{
- this->Function.Arguments.emplace_back(token->text, delim, token->line);
+ this->FunctionArguments.emplace_back(token->text, delim, token->line);
if (this->Separation == SeparationOkay) {
return true;
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 5617536..727fc60 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -14,6 +14,7 @@
#include <cm/optional>
#include "cmStateSnapshot.h"
+#include "cmSystemTools.h"
/** \class cmListFileCache
* \brief A class to cache list file contents.
@@ -28,16 +29,19 @@ struct cmCommandContext
{
struct cmCommandName
{
- std::string Lower;
std::string Original;
+ std::string Lower;
cmCommandName() = default;
- cmCommandName(std::string const& name) { *this = name; }
- cmCommandName& operator=(std::string const& name);
+ cmCommandName(std::string name)
+ : Original(std::move(name))
+ , Lower(cmSystemTools::LowerCase(this->Original))
+ {
+ }
} Name;
long Line = 0;
cmCommandContext() = default;
- cmCommandContext(const char* name, int line)
- : Name(name)
+ cmCommandContext(std::string name, long line)
+ : Name(std::move(name))
, Line(line)
{
}
@@ -103,9 +107,48 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
-struct cmListFileFunction : public cmCommandContext
+class cmListFileFunction
{
- std::vector<cmListFileArgument> Arguments;
+public:
+ cmListFileFunction(std::string name, long line,
+ std::vector<cmListFileArgument> args)
+ : Impl{ std::make_shared<Implementation>(std::move(name), line,
+ std::move(args)) }
+ {
+ }
+
+ std::string const& OriginalName() const noexcept
+ {
+ return this->Impl->Name.Original;
+ }
+
+ std::string const& LowerCaseName() const noexcept
+ {
+ return this->Impl->Name.Lower;
+ }
+
+ long Line() const noexcept { return this->Impl->Line; }
+
+ std::vector<cmListFileArgument> const& Arguments() const noexcept
+ {
+ return this->Impl->Arguments;
+ }
+
+ operator cmCommandContext const&() const noexcept { return *this->Impl; }
+
+private:
+ struct Implementation : public cmCommandContext
+ {
+ Implementation(std::string name, long line,
+ std::vector<cmListFileArgument> args)
+ : cmCommandContext{ std::move(name), line }
+ , Arguments{ std::move(args) }
+ {
+ }
+ std::vector<cmListFileArgument> Arguments;
+ };
+
+ std::shared_ptr<Implementation const> Impl;
};
// Represent a backtrace (call stack). Provide value semantics
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 91a600e..98f88c1 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -81,17 +81,14 @@ bool cmMacroHelperCommand::operator()(
argVs.emplace_back(argvName);
}
// Invoke all the functions that were collected in the block.
- cmListFileFunction newLFF;
// for each function
for (cmListFileFunction const& func : this->Functions) {
// Replace the formal arguments and then invoke the command.
- newLFF.Arguments.clear();
- newLFF.Arguments.reserve(func.Arguments.size());
- newLFF.Name = func.Name;
- newLFF.Line = func.Line;
+ std::vector<cmListFileArgument> newLFFArgs;
+ newLFFArgs.reserve(func.Arguments().size());
// for each argument of the current function
- for (cmListFileArgument const& k : func.Arguments) {
+ for (cmListFileArgument const& k : func.Arguments()) {
cmListFileArgument arg;
arg.Value = k.Value;
if (k.Delim != cmListFileArgument::Bracket) {
@@ -116,8 +113,10 @@ bool cmMacroHelperCommand::operator()(
}
arg.Delim = k.Delim;
arg.Line = k.Line;
- newLFF.Arguments.push_back(std::move(arg));
+ newLFFArgs.push_back(std::move(arg));
}
+ cmListFileFunction newLFF{ func.OriginalName(), func.Line(),
+ std::move(newLFFArgs) };
cmExecutionStatus status(makefile);
if (!makefile.ExecuteCommand(newLFF, status) || status.GetNestedError()) {
// The error message should have already included the call stack
@@ -157,7 +156,7 @@ bool cmMacroFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments(), expandedArguments);
return expandedArguments.empty() || expandedArguments[0] == this->Args[0];
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ac3a193..14ec689 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -306,8 +306,8 @@ void cmMakefile::PrintCommandTrace(
std::string temp;
bool expand = this->GetCMakeInstance()->GetTraceExpand();
- args.reserve(lff.Arguments.size());
- for (cmListFileArgument const& arg : lff.Arguments) {
+ args.reserve(lff.Arguments().size());
+ for (cmListFileArgument const& arg : lff.Arguments()) {
if (expand) {
temp = arg.Value;
this->ExpandVariablesInString(temp);
@@ -324,11 +324,11 @@ void cmMakefile::PrintCommandTrace(
Json::StreamWriterBuilder builder;
builder["indentation"] = "";
val["file"] = full_path;
- val["line"] = static_cast<Json::Value::Int64>(lff.Line);
+ val["line"] = static_cast<Json::Value::Int64>(lff.Line());
if (deferId) {
val["defer"] = *deferId;
}
- val["cmd"] = lff.Name.Original;
+ val["cmd"] = lff.OriginalName();
val["args"] = Json::Value(Json::arrayValue);
for (std::string const& arg : args) {
val["args"].append(arg);
@@ -341,11 +341,11 @@ void cmMakefile::PrintCommandTrace(
break;
}
case cmake::TraceFormat::TRACE_HUMAN:
- msg << full_path << "(" << lff.Line << "):";
+ msg << full_path << "(" << lff.Line() << "):";
if (deferId) {
msg << "DEFERRED:" << *deferId << ":";
}
- msg << " " << lff.Name.Original << "(";
+ msg << " " << lff.OriginalName() << "(";
for (std::string const& arg : args) {
msg << arg << " ";
@@ -451,7 +451,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Lookup the command prototype.
if (cmState::Command command =
- this->GetState()->GetCommandByExactName(lff.Name.Lower)) {
+ this->GetState()->GetCommandByExactName(lff.LowerCaseName())) {
// Decide whether to invoke the command.
if (!cmSystemTools::GetFatalErrorOccured()) {
// if trace is enabled, print out invoke information
@@ -459,13 +459,13 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
this->PrintCommandTrace(lff, this->Backtrace.Top().DeferId);
}
// Try invoking the command.
- bool invokeSucceeded = command(lff.Arguments, status);
+ bool invokeSucceeded = command(lff.Arguments(), status);
bool hadNestedError = status.GetNestedError();
if (!invokeSucceeded || hadNestedError) {
if (!hadNestedError) {
// The command invocation requested that we report an error.
std::string const error =
- std::string(lff.Name.Original) + " " + status.GetError();
+ std::string(lff.OriginalName()) + " " + status.GetError();
this->IssueMessage(MessageType::FATAL_ERROR, error);
}
result = false;
@@ -477,7 +477,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
} else {
if (!cmSystemTools::GetFatalErrorOccured()) {
std::string error =
- cmStrCat("Unknown CMake command \"", lff.Name.Original, "\".");
+ cmStrCat("Unknown CMake command \"", lff.OriginalName(), "\".");
this->IssueMessage(MessageType::FATAL_ERROR, error);
result = false;
cmSystemTools::SetFatalErrorOccured();
@@ -1690,7 +1690,7 @@ void cmMakefile::Configure()
bool hasVersion = false;
// search for the right policy command
for (cmListFileFunction const& func : listFile.Functions) {
- if (func.Name.Lower == "cmake_minimum_required") {
+ if (func.LowerCaseName() == "cmake_minimum_required") {
hasVersion = true;
break;
}
@@ -1717,7 +1717,7 @@ void cmMakefile::Configure()
allowedCommands.insert("message");
isProblem = false;
for (cmListFileFunction const& func : listFile.Functions) {
- if (!cm::contains(allowedCommands, func.Name.Lower)) {
+ if (!cm::contains(allowedCommands, func.LowerCaseName())) {
isProblem = true;
break;
}
@@ -1737,7 +1737,7 @@ void cmMakefile::Configure()
bool hasProject = false;
// search for a project command
for (cmListFileFunction const& func : listFile.Functions) {
- if (func.Name.Lower == "project") {
+ if (func.LowerCaseName() == "project") {
hasProject = true;
break;
}
@@ -1754,12 +1754,12 @@ void cmMakefile::Configure()
"CMake is pretending there is a \"project(Project)\" command on "
"the first line.",
this->Backtrace);
- cmListFileFunction project;
- project.Name.Lower = "project";
- project.Arguments.emplace_back("Project", cmListFileArgument::Unquoted,
- 0);
- project.Arguments.emplace_back("__CMAKE_INJECTED_PROJECT_COMMAND__",
- cmListFileArgument::Unquoted, 0);
+ cmListFileFunction project{ "project",
+ 0,
+ { { "Project", cmListFileArgument::Unquoted,
+ 0 },
+ { "__CMAKE_INJECTED_PROJECT_COMMAND__",
+ cmListFileArgument::Unquoted, 0 } } };
listFile.Functions.insert(listFile.Functions.begin(), project);
}
}
@@ -3105,8 +3105,8 @@ cm::optional<std::string> cmMakefile::DeferGetCall(std::string const& id) const
std::string tmp;
for (DeferCommand const& dc : this->Defer->Commands) {
if (dc.Id == id) {
- tmp = dc.Command.Name.Original;
- for (cmListFileArgument const& arg : dc.Command.Arguments) {
+ tmp = dc.Command.OriginalName();
+ for (cmListFileArgument const& arg : dc.Command.Arguments()) {
tmp = cmStrCat(tmp, ';', arg.Value);
}
break;
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index 29fd440..86188db 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/Source/cmMakefileProfilingData.cxx
@@ -58,7 +58,7 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
cmsys::SystemInformation info;
Json::Value v;
v["ph"] = "B";
- v["name"] = lff.Name.Lower;
+ v["name"] = lff.LowerCaseName();
v["cat"] = "cmake";
v["ts"] = Json::Value::UInt64(
std::chrono::duration_cast<std::chrono::microseconds>(
@@ -67,9 +67,9 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
v["pid"] = static_cast<int>(info.GetProcessId());
v["tid"] = 0;
Json::Value argsValue;
- if (!lff.Arguments.empty()) {
+ if (!lff.Arguments().empty()) {
std::string args;
- for (const auto& a : lff.Arguments) {
+ for (auto const& a : lff.Arguments()) {
args += (args.empty() ? "" : " ") + a.Value;
}
argsValue["functionArgs"] = args;
diff --git a/Source/cmMakefileProfilingData.h b/Source/cmMakefileProfilingData.h
index a3f128b..a86764a 100644
--- a/Source/cmMakefileProfilingData.h
+++ b/Source/cmMakefileProfilingData.h
@@ -11,7 +11,7 @@ class StreamWriter;
}
class cmListFileContext;
-struct cmListFileFunction;
+class cmListFileFunction;
class cmMakefileProfilingData
{
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 750b0b5..7c7fbca 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -45,20 +45,21 @@ void cmVariableWatchCommandVariableAccessed(const std::string& variable,
std::string stack = *mf->GetProperty("LISTFILE_STACK");
if (!data->Command.empty()) {
- cmListFileFunction newLFF;
cmProp const currentListFile =
mf->GetDefinition("CMAKE_CURRENT_LIST_FILE");
const auto fakeLineNo =
std::numeric_limits<decltype(cmListFileArgument::Line)>::max();
- newLFF.Arguments = {
+
+ std::vector<cmListFileArgument> newLFFArgs{
{ variable, cmListFileArgument::Quoted, fakeLineNo },
{ accessString, cmListFileArgument::Quoted, fakeLineNo },
{ newValue ? newValue : "", cmListFileArgument::Quoted, fakeLineNo },
{ *currentListFile, cmListFileArgument::Quoted, fakeLineNo },
{ stack, cmListFileArgument::Quoted, fakeLineNo }
};
- newLFF.Name = data->Command;
- newLFF.Line = fakeLineNo;
+
+ cmListFileFunction newLFF{ data->Command, fakeLineNo,
+ std::move(newLFFArgs) };
cmExecutionStatus status(*makefile);
if (!makefile->ExecuteCommand(newLFF, status)) {
cmSystemTools::Error(
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 2c7a8a7..327c1c7 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -54,7 +54,7 @@ cmWhileFunctionBlocker::~cmWhileFunctionBlocker()
bool cmWhileFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile&) const
{
- return lff.Arguments.empty() || lff.Arguments == this->Args;
+ return lff.Arguments().empty() || lff.Arguments() == this->Args;
}
bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
index 524be92..8ada221 100644
--- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
+++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestArtifactsInteractive LANGUAGES C)
+project(TestArtifactsInteractive LANGUAGES NONE)
set (components Interpreter Development)
if (CMake_TEST_FindPython_NumPy)
diff --git a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
index fed963e..2164ac1 100644
--- a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
+++ b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.1)
-project(TestCustomFailureMessage.Check LANGUAGES C)
+project(TestCustomFailureMessage.Check LANGUAGES NONE)
find_package (Python3 REQUIRED COMPONENTS ${CHECK_COMPONENTS})
diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt
index e09f73a..4aa748b 100644
--- a/Tests/FindPython/ExactVersion/CMakeLists.txt
+++ b/Tests/FindPython/ExactVersion/CMakeLists.txt
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 3.1)
-project(TestExactVersion C)
+project(TestExactVersion LANGUAGES NONE)
find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development)
-if (NOT Python${Python_MAJOR_VERSION}_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+if(NOT Python${Python_MAJOR_VERSION}_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter")
+if(NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Interpreter")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development")
+if(NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Development")
endif()
if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter)
@@ -26,22 +26,22 @@ endif()
# reset artifacts and second search with exact version already founded
-unset (Python${Python_MAJOR_VERSION}_EXECUTABLE)
-unset (_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE)
+unset(Python${Python_MAJOR_VERSION}_EXECUTABLE)
+unset(_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE)
-unset (_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE)
-unset (_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE)
+unset(_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE)
+unset(_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE)
-set (Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION})
+set(Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION})
find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter Development)
-if (NOT Python${Python_MAJOR_VERSION}_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+if(NOT Python${Python_MAJOR_VERSION}_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter")
+if(NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Interpreter")
endif()
-if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development")
+if(NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Development")
endif()
if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter)
diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt
index d64fa1e..592329b 100644
--- a/Tests/FindPython/Implementation/CMakeLists.txt
+++ b/Tests/FindPython/Implementation/CMakeLists.txt
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.1)
-project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} C)
+project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} LANGUAGES NONE)
set (Python${Python_REQUESTED_VERSION}_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
find_package(Python${Python_REQUESTED_VERSION} COMPONENTS Interpreter)
if (NOT Python${Python_REQUESTED_VERSION}_FOUND OR NOT Python${Python_REQUESTED_VERSION}_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python${Python_REQUESTED_VERSION}")
endif()
if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
@@ -24,7 +24,7 @@ set (Python_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter)
if (NOT Python_FOUND OR NOT Python_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt
index 3493c29..47ca022 100644
--- a/Tests/FindPython/IronPython/CMakeLists.txt
+++ b/Tests/FindPython/IronPython/CMakeLists.txt
@@ -1,23 +1,23 @@
cmake_minimum_required(VERSION 3.1)
-project(TestIronPython C)
+project(TestIronPython LANGUAGES NONE)
set (Python_FIND_IMPLEMENTATIONS IronPython)
find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Compiler)
if (NOT Python_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
if (NOT Python_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python Interpreter")
+ message (FATAL_ERROR "Failed to find Python Interpreter")
endif()
if (NOT Python_INTERPRETER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
endif()
if (NOT Python_Compiler_FOUND)
- message (FATAL_ERROR "Fail to found Python Compiler")
+ message (FATAL_ERROR "Failed to find Python Compiler")
endif()
if (NOT Python_COMPILER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous compiler ID (${Python_COMPILER_ID})")
diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt
index 1db798c..fd9d947 100644
--- a/Tests/FindPython/IronPython2/CMakeLists.txt
+++ b/Tests/FindPython/IronPython2/CMakeLists.txt
@@ -1,23 +1,23 @@
cmake_minimum_required(VERSION 3.1)
-project(TestIronPython2 C)
+project(TestIronPython2 LANGUAGES NONE)
set (Python2_FIND_IMPLEMENTATIONS "IronPython")
find_package(Python2 COMPONENTS Interpreter Compiler)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (NOT Python2_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 Interpreter")
+ message (FATAL_ERROR "Failed to find Python 2 Interpreter")
endif()
if (NOT Python2_INTERPRETER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})")
endif()
if (NOT Python2_Compiler_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 Compiler")
+ message (FATAL_ERROR "Failed to find Python 2 Compiler")
endif()
if (NOT Python2_COMPILER_ID STREQUAL "IronPython")
message (FATAL_ERROR "Erroneous compiler ID (${Python2_COMPILER_ID})")
diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt
index b4ade8c..6539b63 100644
--- a/Tests/FindPython/PyPy/CMakeLists.txt
+++ b/Tests/FindPython/PyPy/CMakeLists.txt
@@ -1,29 +1,29 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPyPy C)
+project(TestPyPy LANGUAGES NONE)
set (Python_FIND_IMPLEMENTATIONS PyPy)
find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development)
if (NOT Python_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION}")
endif()
if (NOT Python_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy Interpreter")
+ message (FATAL_ERROR "Failed to find Python PyPy Interpreter")
endif()
if (NOT Python_INTERPRETER_ID STREQUAL "PyPy")
message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
endif()
if (NOT Python_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Module")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development.Module")
endif()
if (NOT Python_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Embed")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development.Embed")
endif()
if (NOT Python_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development")
+ message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development")
endif()
if(NOT TARGET Python::Interpreter)
diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt
index 2f0ddc9..4efea23 100644
--- a/Tests/FindPython/PyPy2/CMakeLists.txt
+++ b/Tests/FindPython/PyPy2/CMakeLists.txt
@@ -1,29 +1,29 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPyPy2 C)
+project(TestPyPy2 LANGUAGES NONE)
set (Python2_FIND_IMPLEMENTATIONS "PyPy")
find_package(Python2 COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2")
+ message (FATAL_ERROR "Failed to find Python PyPy 2")
endif()
if (NOT Python2_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Interpreter")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Interpreter")
endif()
if (NOT Python2_INTERPRETER_ID STREQUAL "PyPy")
message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})")
endif()
if (NOT Python2_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Module")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Development.Module")
endif()
if (NOT Python2_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Development.Embed")
endif()
if (NOT Python2_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 2 Development")
+ message (FATAL_ERROR "Failed to find Python PyPy 2 Development")
endif()
if(NOT TARGET Python2::Interpreter)
diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt
index 5562d57..7454a68 100644
--- a/Tests/FindPython/PyPy3/CMakeLists.txt
+++ b/Tests/FindPython/PyPy3/CMakeLists.txt
@@ -1,29 +1,29 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPyPy3 C)
+project(TestPyPy3 LANGUAGES NONE)
set (Python3_FIND_IMPLEMENTATIONS "PyPy")
find_package(Python3 COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3")
+ message (FATAL_ERROR "Failed to find Python PyPy 3")
endif()
if (NOT Python3_Interpreter_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Interpreter")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Interpreter")
endif()
if (NOT Python3_INTERPRETER_ID STREQUAL "PyPy")
message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})")
endif()
if (NOT Python3_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Module")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Development.Module")
endif()
if (NOT Python3_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Development.Embed")
endif()
if (NOT Python3_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python PyPy 3 Development")
+ message (FATAL_ERROR "Failed to find Python PyPy 3 Development")
endif()
if(NOT TARGET Python3::Interpreter)
diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt
index e8828a2..9bec22f 100644
--- a/Tests/FindPython/Python/CMakeLists.txt
+++ b/Tests/FindPython/Python/CMakeLists.txt
@@ -1,18 +1,18 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython C)
+project(TestPython LANGUAGES C)
include(CTest)
find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Development)
if (NOT Python_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
endif()
if (NOT Python_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'")
endif()
if (NOT Python_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'")
+ message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'")
endif()
if(NOT TARGET Python::Interpreter)
diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt
index 609d80f..39577b2 100644
--- a/Tests/FindPython/Python2/CMakeLists.txt
+++ b/Tests/FindPython/Python2/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython2 C)
+project(TestPython2 LANGUAGES C)
include(CTest)
@@ -11,16 +11,16 @@ endif()
find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (NOT Python2_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 'Development' component")
+ message (FATAL_ERROR "Failed to find Python 2 'Development' component")
endif()
if (NOT Python2_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 'Development.Module' component")
+ message (FATAL_ERROR "Failed to find Python 2 'Development.Module' component")
endif()
if (NOT Python2_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python 2 'Development.Embed' component")
+ message (FATAL_ERROR "Failed to find Python 2 'Development.Embed' component")
endif()
if(NOT TARGET Python2::Interpreter)
diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt
index 1cf6034..a1036ce 100644
--- a/Tests/FindPython/Python2Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython2Embedded C)
+project(TestPython2Embedded LANGUAGES C)
include(CTest)
find_package(Python2 REQUIRED COMPONENTS Development.Embed)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (Python2_Development_FOUND)
message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt
index 0bc3390..c9d46ac 100644
--- a/Tests/FindPython/Python2Module/CMakeLists.txt
+++ b/Tests/FindPython/Python2Module/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython2Module C)
+project(TestPython2Module LANGUAGES C)
include(CTest)
find_package(Python2 REQUIRED COMPONENTS Interpreter Development.Module)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
if (Python2_Development_FOUND)
message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt
index d6e5fdb..e40557d 100644
--- a/Tests/FindPython/Python3/CMakeLists.txt
+++ b/Tests/FindPython/Python3/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython3 C)
+project(TestPython3 LANGUAGES C)
include(CTest)
@@ -11,16 +11,16 @@ endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if (NOT Python3_Development_FOUND)
- message (FATAL_ERROR "Fail to found Python 3 'Development' component")
+ message (FATAL_ERROR "Failed to find Python 3 'Development' component")
endif()
if (NOT Python3_Development.Module_FOUND)
- message (FATAL_ERROR "Fail to found Python 3 'Development.Module' component")
+ message (FATAL_ERROR "Failed to find Python 3 'Development.Module' component")
endif()
if (NOT Python3_Development.Embed_FOUND)
- message (FATAL_ERROR "Fail to found Python 3 'Development.Embed' component")
+ message (FATAL_ERROR "Failed to find Python 3 'Development.Embed' component")
endif()
if(NOT TARGET Python3::Interpreter)
diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt
index 184c0b4..c45bd8c 100644
--- a/Tests/FindPython/Python3Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython3Embedded C)
+project(TestPython3Embedded LANGUAGES C)
include(CTest)
find_package(Python3 REQUIRED COMPONENTS Development.Embed)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if (Python3_Development_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt
index 676f4c8..5945962 100644
--- a/Tests/FindPython/Python3Module/CMakeLists.txt
+++ b/Tests/FindPython/Python3Module/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
-project(TestPython3Module C)
+project(TestPython3Module LANGUAGES C)
include(CTest)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if (Python3_Development_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
index 39e8ea5..6e854e3 100644
--- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 3.1)
-project(TestRequiredArtifacts LANGUAGES C)
+project(TestRequiredArtifacts LANGUAGES NONE)
include(CTest)
find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
- message (FATAL_ERROR "Fail to found Python 2")
+ message (FATAL_ERROR "Failed to find Python 2")
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
index b859ac5..036407f 100644
--- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
-project(TestRequiredArtifacts.Check LANGUAGES C)
+project(TestRequiredArtifacts.Check LANGUAGES NONE)
set (components)
if (CHECK_INTERPRETER)
@@ -29,13 +29,13 @@ endif()
if (CHECK_INTERPRETER AND NOT Python3_EXECUTABLE STREQUAL required_interpreter)
- message (FATAL_ERROR "Fail to use input variable Python3_EXECUTABLE")
+ message (FATAL_ERROR "Failed to use input variable Python3_EXECUTABLE")
endif()
if (CHECK_LIBRARY AND NOT Python3_LIBRARY_RELEASE STREQUAL required_library)
- message (FATAL_ERROR "Fail to use input variable Python3_LIBRARY")
+ message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY")
endif()
if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include)
- message (FATAL_ERROR "Fail to use input variable Python3_INCLUDE_DIR")
+ message (FATAL_ERROR "Failed to use input variable Python3_INCLUDE_DIR")
endif()
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 36daa9f..84f7362 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.1)
-project(TestSOABI C)
+project(TestSOABI LANGUAGES C)
find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
if(NOT DEFINED Python3_SOABI)
diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt
index 045a3f2..dae3282 100644
--- a/Tests/FindPython/VirtualEnv/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt
@@ -6,7 +6,7 @@ include(CTest)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
if (NOT Python3_FOUND)
- message (FATAL_ERROR "Fail to found Python 3")
+ message (FATAL_ERROR "Failed to find Python 3")
endif()
set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/py3venv")
diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
index 565095a..23d208d 100644
--- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
@@ -6,7 +6,7 @@ include(CTest)
find_program(CONDA_EXECUTABLE conda)
if (CONDA_EXECUTABLE EQUAL NOTFOUND)
- message (FATAL_ERROR "Fail to found Conda")
+ message (FATAL_ERROR "Failed to find Conda")
endif()
set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/condaenv")
diff --git a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake
index 6becc3c..2bdf913 100644
--- a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake
@@ -2,4 +2,6 @@ include(RunCMake)
run_cmake(components)
run_cmake(missing-components)
+run_cmake(version)
+run_cmake(version-exact)
run_cmake(version-range)
diff --git a/Tests/RunCMake/FindSWIG/version-exact.cmake b/Tests/RunCMake/FindSWIG/version-exact.cmake
new file mode 100644
index 0000000..ec3651f
--- /dev/null
+++ b/Tests/RunCMake/FindSWIG/version-exact.cmake
@@ -0,0 +1,17 @@
+cmake_minimum_required (VERSION 3.18...3.19)
+
+find_package (SWIG)
+if (NOT SWIG_FOUND)
+ message (FATAL_ERROR "Failed to find SWIG")
+endif()
+
+# clean-up SWIG variables
+unset (SWIG_EXECUTABLE CACHE)
+unset (SWIG_DIR CACHE)
+
+set (version ${SWIG_VERSION})
+
+find_package (SWIG ${SWIG_VERSION} EXACT)
+if (NOT SWIG_FOUND)
+ message (FATAL_ERROR "Failed to find SWIG with version ${version} EXACT")
+endif()
diff --git a/Tests/RunCMake/FindSWIG/version.cmake b/Tests/RunCMake/FindSWIG/version.cmake
new file mode 100644
index 0000000..a4f1c39
--- /dev/null
+++ b/Tests/RunCMake/FindSWIG/version.cmake
@@ -0,0 +1,6 @@
+cmake_minimum_required (VERSION 3.18...3.19)
+
+find_package (SWIG 1.0)
+if (NOT SWIG_FOUND)
+ message (FATAL_ERROR "Failed to find SWIG with version 1.0")
+endif()
diff --git a/Tests/RunCMake/execute_process/AnyCommandError-result.txt b/Tests/RunCMake/execute_process/AnyCommandError-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/execute_process/AnyCommandError-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt b/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt
new file mode 100644
index 0000000..0380562
--- /dev/null
+++ b/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .*AnyCommandError.cmake:1 \(execute_process\):
+ execute_process failed command indexes: 2, 3, 4
diff --git a/Tests/RunCMake/execute_process/AnyCommandError.cmake b/Tests/RunCMake/execute_process/AnyCommandError.cmake
new file mode 100644
index 0000000..f8ec385
--- /dev/null
+++ b/Tests/RunCMake/execute_process/AnyCommandError.cmake
@@ -0,0 +1,8 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND_ERROR_IS_FATAL ANY
+)
diff --git a/Tests/RunCMake/execute_process/CommandError-result.txt b/Tests/RunCMake/execute_process/CommandError-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/execute_process/CommandError-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/execute_process/CommandError-stderr.txt b/Tests/RunCMake/execute_process/CommandError-stderr.txt
new file mode 100644
index 0000000..c28f3a3
--- /dev/null
+++ b/Tests/RunCMake/execute_process/CommandError-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .*CommandError.cmake:1 \(execute_process\):
+ execute_process COMMAND_ERROR_IS_FATAL option can be ANY or LAST
diff --git a/Tests/RunCMake/execute_process/CommandError.cmake b/Tests/RunCMake/execute_process/CommandError.cmake
new file mode 100644
index 0000000..da58928
--- /dev/null
+++ b/Tests/RunCMake/execute_process/CommandError.cmake
@@ -0,0 +1,3 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND_ERROR_IS_FATAL ALL
+)
diff --git a/Tests/RunCMake/execute_process/LastCommandError-result.txt b/Tests/RunCMake/execute_process/LastCommandError-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/execute_process/LastCommandError-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/execute_process/LastCommandError-stderr.txt b/Tests/RunCMake/execute_process/LastCommandError-stderr.txt
new file mode 100644
index 0000000..ff191b3
--- /dev/null
+++ b/Tests/RunCMake/execute_process/LastCommandError-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .*LastCommandError.cmake:1 \(execute_process\):
+ execute_process last command failed
diff --git a/Tests/RunCMake/execute_process/LastCommandError.cmake b/Tests/RunCMake/execute_process/LastCommandError.cmake
new file mode 100644
index 0000000..6116a5c
--- /dev/null
+++ b/Tests/RunCMake/execute_process/LastCommandError.cmake
@@ -0,0 +1,8 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND_ERROR_IS_FATAL LAST
+)
diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
index 89ad6b2..f4c3d19 100644
--- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake
+++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
@@ -26,3 +26,7 @@ run_cmake_command(EchoCommand3 ${CMAKE_COMMAND}
${RunCMake_SOURCE_DIR}/EchoCommand.cmake)
run_cmake_command(EchoVariable ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/EchoVariable.cmake)
+
+run_cmake_command(AnyCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/AnyCommandError.cmake)
+run_cmake_command(LastCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandError.cmake)
+run_cmake_command(CommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/CommandError.cmake)
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index aee3338..e150223 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -169,3 +169,15 @@ add_test(NAME UseSWIG.AlternateLibraryName COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+
+
+add_test(NAME UseSWIG.SwigSrcOUTPUT_DIR COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/SwigSrcOUTPUT_DIR"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/SwigSrcOUTPUT_DIR"
+ ${build_generator_args}
+ --build-project TestSwigSrcOUTPUT_DIR
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/UseSWIG/NamespaceCsharp/CMakeLists.txt b/Tests/UseSWIG/NamespaceCsharp/CMakeLists.txt
index 39566a8..51ec1b2 100644
--- a/Tests/UseSWIG/NamespaceCsharp/CMakeLists.txt
+++ b/Tests/UseSWIG/NamespaceCsharp/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.12...3.13)
-project(TestNamsespaceCsharp CXX)
+project(TestNamespaceCsharp CXX)
include(CTest)
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/CMakeLists.txt b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/CMakeLists.txt
new file mode 100644
index 0000000..fc0cf8d
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/CMakeLists.txt
@@ -0,0 +1,61 @@
+cmake_minimum_required(VERSION 3.12...3.19)
+
+project(TestSwigSrcOUTPUT_DIR CXX)
+
+include(CTest)
+
+
+set(CMAKE_CXX_STANDARD 11)
+
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+set(UseSWIG_MODULE_VERSION 2)
+
+
+file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/Foo"
+ "${CMAKE_CURRENT_BINARY_DIR}/FooSupport"
+ "${CMAKE_CURRENT_BINARY_DIR}/FooFile"
+ "${CMAKE_CURRENT_BINARY_DIR}/Bar"
+ "${CMAKE_CURRENT_BINARY_DIR}/BarSupport"
+ "${CMAKE_CURRENT_BINARY_DIR}/BarFile")
+
+
+set_property (SOURCE foo.i PROPERTY COMPILE_OPTIONS -namespace Foo)
+set_property (SOURCE foo.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Foo")
+set_property (SOURCE foo.i PROPERTY CPLUSPLUS ON)
+
+set_property (SOURCE bar.i PROPERTY COMPILE_OPTIONS -namespace Bar)
+set_property (SOURCE bar.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Bar")
+set_property (SOURCE bar.i PROPERTY CPLUSPLUS ON)
+
+swig_add_library(outdir_test LANGUAGE csharp SOURCES foo.i bar.i cs.cpp
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/NotUsed1"
+ OUTFILE_DIR "${CMAKE_CURRENT_BINARY_DIR}/NotUsed2")
+target_include_directories(outdir_test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
+set_property(TARGET outdir_test PROPERTY USE_TARGET_INCLUDE_DIRECTORIES ON)
+
+
+get_target_property(SUPPORT_FILES_DIRS outdir_test SWIG_SUPPORT_FILES_DIRECTORY)
+
+add_test(NAME SwigSrcOUTPUT_DIR COMMAND "${CMAKE_COMMAND}" "-DBASE_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR}" "-DSUPPORT_FILES_DIRECTORY=${SUPPORT_FILES_DIRS}" -P "${CMAKE_CURRENT_SOURCE_DIR}/ValidateSupportFiles.cmake")
+
+
+
+set_property (SOURCE foo.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/FooSupport")
+set_property (SOURCE foo.i PROPERTY OUTFILE_DIR "${CMAKE_CURRENT_BINARY_DIR}/FooFile")
+
+set_property (SOURCE bar.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/BarSupport")
+set_property (SOURCE bar.i PROPERTY OUTFILE_DIR "${CMAKE_CURRENT_BINARY_DIR}/BarFile")
+
+swig_add_library(outfiledir_test LANGUAGE csharp SOURCES foo.i bar.i cs.cpp
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/NotUsed1"
+ OUTFILE_DIR "${CMAKE_CURRENT_BINARY_DIR}/NotUsed2")
+target_include_directories(outfiledir_test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
+set_property(TARGET outfiledir_test PROPERTY USE_TARGET_INCLUDE_DIRECTORIES ON)
+
+
+get_target_property(SUPPORT_FILES_DIRS outfiledir_test SWIG_SUPPORT_FILES_DIRECTORY)
+
+add_test(NAME SwigSrcOUTFILE_DIR COMMAND "${CMAKE_COMMAND}" "-DBASE_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR}" "-DSUPPORT_FILES_DIRECTORY=${SUPPORT_FILES_DIRS}" -DOUTFILE_DIR=ON -P "${CMAKE_CURRENT_SOURCE_DIR}/ValidateSupportFiles.cmake")
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/ValidateSupportFiles.cmake b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/ValidateSupportFiles.cmake
new file mode 100644
index 0000000..20240ed
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/ValidateSupportFiles.cmake
@@ -0,0 +1,17 @@
+
+foreach (support_dir IN LISTS SUPPORT_FILES_DIRECTORY)
+ file (GLOB_RECURSE files LIST_DIRECTORIES TRUE RELATIVE "${BASE_DIRECTORY}" "${support_dir}/*")
+ list (APPEND support_files ${files})
+endforeach()
+
+list(SORT support_files)
+
+if (OUTFILE_DIR)
+ set (expected_files "BarSupport/Bar.cs;BarSupport/BarPINVOKE.cs;BarSupport/Math.cs;FooSupport/Foo.cs;FooSupport/FooPINVOKE.cs;FooSupport/Math.cs")
+else()
+ set (expected_files "Bar/Bar.cs;Bar/BarPINVOKE.cs;Bar/Math.cs;Bar/barCSHARP_wrap.cxx;Foo/Foo.cs;Foo/FooPINVOKE.cs;Foo/Math.cs;Foo/fooCSHARP_wrap.cxx")
+endif()
+
+if (NOT support_files STREQUAL expected_files)
+ message (FATAL_ERROR "Support files not correctly collected.")
+endif()
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.hpp b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.hpp
new file mode 100644
index 0000000..26b707f
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.hpp
@@ -0,0 +1,15 @@
+#pragma once
+
+namespace Bar {
+
+class Math
+{
+public:
+ void add(int value);
+ int get_sum() const;
+
+private:
+ int sum_ = 0;
+};
+
+} // namespace cs
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.i b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.i
new file mode 100644
index 0000000..539f32a
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/bar.i
@@ -0,0 +1,8 @@
+%module Bar
+
+%{
+#include <bar.hpp>
+%}
+
+// %nspace cs::my_class_in_namespace;
+%include <bar.hpp>
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/cs.cpp b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/cs.cpp
new file mode 100644
index 0000000..e4aa562
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/cs.cpp
@@ -0,0 +1,29 @@
+#include <bar.hpp>
+#include <foo.hpp>
+
+namespace Foo {
+
+void Math::add(int value)
+{
+ sum_ += value;
+}
+
+int Math::get_sum() const
+{
+ return sum_;
+}
+}
+
+namespace Bar {
+
+void Math::add(int value)
+{
+ sum_ += value;
+}
+
+int Math::get_sum() const
+{
+ return sum_;
+}
+
+} // namespace cs
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.hpp b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.hpp
new file mode 100644
index 0000000..b227463
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.hpp
@@ -0,0 +1,15 @@
+#pragma once
+
+namespace Foo {
+
+class Math
+{
+public:
+ void add(int value);
+ int get_sum() const;
+
+private:
+ int sum_ = 0;
+};
+
+} // namespace cs
diff --git a/Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.i b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.i
new file mode 100644
index 0000000..5e14b04
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcOUTPUT_DIR/foo.i
@@ -0,0 +1,8 @@
+%module Foo
+
+%{
+#include <foo.hpp>
+%}
+
+// %nspace cs::my_class_in_namespace;
+%include <foo.hpp>