summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/UseSWIG-source-file-ext.rst5
-rw-r--r--Modules/BundleUtilities.cmake8
-rw-r--r--Modules/CheckIPOSupported.cmake2
-rw-r--r--Modules/FeatureSummary.cmake2
-rw-r--r--Modules/FindProtobuf.cmake2
-rw-r--r--Modules/GetPrerequisites.cmake38
-rw-r--r--Modules/GoogleTestAddTests.cmake1
-rw-r--r--Modules/UseSWIG.cmake26
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h12
-rw-r--r--Source/cmGlobalGenerator.cxx18
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h29
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx8
-rw-r--r--Source/cmGlobalVisualStudio15Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio9Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h6
-rw-r--r--Source/cmLinkedTree.h3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx11
-rw-r--r--Source/cmMessenger.cxx34
-rw-r--r--Source/cmMessenger.h40
-rw-r--r--Source/cmake.cxx31
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt3
-rw-r--r--Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake19
-rw-r--r--Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake1
-rwxr-xr-xTests/RunCMake/GetPrerequisites/script3
-rwxr-xr-xTests/RunCMake/GetPrerequisites/script.bat3
-rwxr-xr-xTests/RunCMake/GetPrerequisites/script.sh3
-rw-r--r--Tests/UseSWIG/CMakeLists.txt12
-rw-r--r--Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt28
-rw-r--r--Tests/UseSWIG/SwigSrcFileExtension/my_add.i9
-rw-r--r--Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg9
-rwxr-xr-xTests/UseSWIG/SwigSrcFileExtension/runme.py24
42 files changed, 309 insertions, 112 deletions
diff --git a/Help/release/dev/UseSWIG-source-file-ext.rst b/Help/release/dev/UseSWIG-source-file-ext.rst
new file mode 100644
index 0000000..5d11dc6
--- /dev/null
+++ b/Help/release/dev/UseSWIG-source-file-ext.rst
@@ -0,0 +1,5 @@
+UseSWIG-source-file-ext
+-----------------------
+
+* The :module:`UseSWIG` module gains capability to specify
+ ``SWIG`` source file extensions.
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 10e5510..d5c47f8 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -877,9 +877,13 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
endif()
+ # CMAKE_INSTALL_NAME_TOOL may not be set if executed in script mode
+ # Duplicated from CMakeFindBinUtils.cmake
+ find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
# Only if install_name_tool supports -delete_rpath:
#
- execute_process(COMMAND install_name_tool
+ execute_process(COMMAND ${CMAKE_INSTALL_NAME_TOOL}
OUTPUT_VARIABLE install_name_tool_usage
ERROR_VARIABLE install_name_tool_usage
)
@@ -897,7 +901,7 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
# to install_name_tool:
#
if(changes)
- set(cmd install_name_tool ${changes} "${resolved_embedded_item}")
+ set(cmd ${CMAKE_INSTALL_NAME_TOOL} ${changes} "${resolved_embedded_item}")
execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result)
if(NOT install_name_tool_result EQUAL 0)
string(REPLACE ";" "' '" msg "'${cmd}'")
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index ad8852c..0d6ad20 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -51,8 +51,6 @@ Examples
#]=======================================================================]
-include(CMakeParseArguments) # cmake_parse_arguments
-
# X_RESULT - name of the final result variable
# X_OUTPUT - name of the variable with information about error
macro(_ipo_not_supported output)
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index fbce235..4a3e83a 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -97,8 +97,6 @@ Functions
#]=======================================================================]
-include(CMakeParseArguments)
-
function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 593fff6..1758fb3 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -121,8 +121,6 @@ Example:
#]=======================================================================]
function(protobuf_generate)
- include(CMakeParseArguments)
-
set(_options APPEND_PATH DESCRIPTORS)
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR)
if(COMMAND target_sources)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 5b32f7c..fa6d75a 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -63,6 +63,9 @@ searched first when a target without any path info is given. Then
standard system locations are also searched: PATH, Framework
locations, /usr/lib...
+The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose
+output.
+
::
LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]])
@@ -644,6 +647,10 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(rpaths "")
endif()
+ if(GET_PREREQUISITES_VERBOSE)
+ set(verbose 1)
+ endif()
+
if(NOT IS_ABSOLUTE "${target}")
message("warning: target '${target}' is not absolute...")
endif()
@@ -653,6 +660,15 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
return()
endif()
+ # Check for a script by extension (.bat,.sh,...) or if the file starts with "#!" (shebang)
+ file(READ ${target} file_contents LIMIT 5)
+ if(target MATCHES "\\.(bat|c?sh|bash|ksh|cmd)$" OR file_contents MATCHES "^#!")
+ message(STATUS "GetPrequisites(${target}) : ignoring script file")
+ # Clear var
+ set(${prerequisites_var} "" PARENT_SCOPE)
+ return()
+ endif()
+
set(gp_cmd_paths ${gp_cmd_paths}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/../../VC/bin"
"$ENV{VS140COMNTOOLS}/../../VC/bin"
@@ -711,25 +727,25 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results
- if(gp_tool STREQUAL "ldd")
+ if(gp_tool MATCHES "ldd$")
set(gp_cmd_args "")
set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$")
set(gp_regex_error "not found${eol_char}$")
set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
set(gp_regex_cmp_count 1)
- elseif(gp_tool STREQUAL "otool")
+ elseif(gp_tool MATCHES "otool$")
set(gp_cmd_args "-L")
set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 3)
- elseif(gp_tool STREQUAL "dumpbin")
+ elseif(gp_tool MATCHES "dumpbin$")
set(gp_cmd_args "/dependents")
set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
- elseif(gp_tool STREQUAL "objdump")
+ elseif(gp_tool MATCHES "objdump$")
set(gp_cmd_args "-p")
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "")
@@ -752,7 +768,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
- if(gp_tool STREQUAL "dumpbin")
+ if(gp_tool MATCHES "dumpbin$")
# When running dumpbin, it also needs the "Common7/IDE" directory in the
# PATH. It will already be in the PATH if being run from a Visual Studio
# command prompt. Add it to the PATH here in case we are running from a
@@ -781,7 +797,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
#
# </setup-gp_tool-vars>
- if(gp_tool STREQUAL "ldd")
+ if(gp_tool MATCHES "ldd$")
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
set(new_ld_env "${exepath}")
foreach(dir ${dirs})
@@ -806,7 +822,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
ERROR_VARIABLE gp_ev
)
- if(gp_tool STREQUAL "dumpbin")
+ if(gp_tool MATCHES "dumpbin$")
# Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below)
string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos)
if (${gp_delayload_pos} GREATER -1)
@@ -820,7 +836,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
if(NOT gp_rv STREQUAL "0")
- if(gp_tool STREQUAL "dumpbin")
+ if(gp_tool MATCHES "dumpbin$")
# dumpbin error messages seem to go to stdout
message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}")
else()
@@ -828,7 +844,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
endif()
- if(gp_tool STREQUAL "ldd")
+ if(gp_tool MATCHES "ldd$")
set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
endif()
@@ -848,9 +864,9 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# check for install id and remove it from list, since otool -L can include a
# reference to itself
set(gp_install_id)
- if(gp_tool STREQUAL "otool")
+ if(gp_tool MATCHES "otool$")
execute_process(
- COMMAND otool -D ${target}
+ COMMAND ${gp_cmd} -D ${target}
RESULT_VARIABLE otool_rv
OUTPUT_VARIABLE gp_install_id_ov
ERROR_VARIABLE otool_ev
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index 5a4bdca..4abbbec 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -30,6 +30,7 @@ if(NOT EXISTS "${TEST_EXECUTABLE}")
endif()
execute_process(
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" --gtest_list_tests
+ WORKING_DIRECTORY "${TEST_WORKING_DIR}"
TIMEOUT ${TEST_DISCOVERY_TIMEOUT}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index a3d6d9e..18ea55c 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -75,7 +75,8 @@ Defines the following command for use with ``SWIG``:
``SOURCES``
List of sources for the library. Files with extension ``.i`` will be
identified as sources for the ``SWIG`` tool. Other files will be handled in
- the standard way.
+ the standard way. This behavior can be overriden by specifying the variable
+ ``SWIG_SOURCE_FILE_EXTENSIONS``.
.. note::
@@ -222,6 +223,15 @@ as well as ``SWIG``:
``SWIG_MODULE_<name>_EXTRA_DEPS``
Specify extra dependencies for the generated module for ``<name>``.
+
+``SWIG_SOURCE_FILE_EXTENSIONS``
+ Specify a list of source file extensions to override the default
+ behavior of considering only ``.i`` files as sources for the ``SWIG``
+ tool. For example:
+
+ .. code-block:: cmake
+
+ set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg")
#]=======================================================================]
cmake_policy(GET CMP0078 target_name_policy)
@@ -659,8 +669,20 @@ function(SWIG_ADD_LIBRARY name)
set(CMAKE_SWIG_OUTDIR "${outputdir}")
set(SWIG_OUTFILE_DIR "${outfiledir}")
+ # See if the user has specified source extensions for swig files?
+ if (NOT DEFINED SWIG_SOURCE_FILE_EXTENSIONS)
+ # Assume the default (*.i) file extension for Swig source files
+ set(SWIG_SOURCE_FILE_EXTENSIONS ".i")
+ endif()
+
+ # Generate a regex out of file extensions.
+ string(REGEX REPLACE "([$^.*+?|()-])" "\\\\\\1" swig_source_ext_regex "${SWIG_SOURCE_FILE_EXTENSIONS}")
+ list (JOIN swig_source_ext_regex "|" swig_source_ext_regex)
+ string (PREPEND swig_source_ext_regex "(")
+ string (APPEND swig_source_ext_regex ")$")
+
set(swig_dot_i_sources ${_SAM_SOURCES})
- list(FILTER swig_dot_i_sources INCLUDE REGEX "\\.i$")
+ list(FILTER swig_dot_i_sources INCLUDE REGEX ${swig_source_ext_regex})
if (NOT swig_dot_i_sources)
message(FATAL_ERROR "SWIG_ADD_LIBRARY: no SWIG interface files specified")
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 24d1e40..58df3d9 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 13)
-set(CMake_VERSION_PATCH 20181228)
+set(CMake_VERSION_PATCH 20190107)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 128a04d..f8c7644 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -28,20 +28,20 @@ public:
~cmCPackWIXGenerator();
protected:
- virtual int InitializeInternal();
+ int InitializeInternal() override;
- virtual int PackageFiles();
+ int PackageFiles() override;
- virtual const char* GetOutputExtension() { return ".msi"; }
+ const char* GetOutputExtension() override { return ".msi"; }
- virtual enum CPackSetDestdirSupport SupportsSetDestdir() const
+ enum CPackSetDestdirSupport SupportsSetDestdir() const override
{
return SETDESTDIR_UNSUPPORTED;
}
- virtual bool SupportsAbsoluteDestination() const { return false; }
+ bool SupportsAbsoluteDestination() const override { return false; }
- virtual bool SupportsComponentInstallation() const { return true; }
+ bool SupportsComponentInstallation() const override { return true; }
private:
typedef std::map<std::string, std::string> id_map_t;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 35d716c..47c53e7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -3023,11 +3023,23 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
std::string cmGlobalGenerator::EscapeJSON(const std::string& s)
{
std::string result;
+ result.reserve(s.size());
for (char i : s) {
- if (i == '"' || i == '\\') {
- result += '\\';
+ switch (i) {
+ case '"':
+ case '\\':
+ result += '\\';
+ result += i;
+ break;
+ case '\n':
+ result += "\\n";
+ break;
+ case '\t':
+ result += "\\t";
+ break;
+ default:
+ result += i;
}
- result += i;
}
return result;
}
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 13c5113..a5aff73 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -25,13 +25,13 @@ public:
}
///! create the correct local generator
- virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
+ cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override;
/// @return the name of this generator.
static std::string GetActualName() { return "Green Hills MULTI"; }
///! Get the name for this generator
- virtual std::string GetName() const { return this->GetActualName(); }
+ std::string GetName() const override { return this->GetActualName(); }
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -49,15 +49,15 @@ public:
static bool SupportsPlatform() { return true; }
// Toolset / Platform Support
- virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
- virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
+ bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override;
+ bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override;
/**
* Try to determine system information such as shared library
* extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(std::vector<std::string> const& languages,
- cmMakefile*, bool optional);
+ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
+ bool optional) override;
/*
* Determine what program to use for building the project.
*/
@@ -88,13 +88,16 @@ public:
inline bool IsOSDirRelative() { return this->OSDirRelative; }
protected:
- virtual void Generate();
- virtual void GenerateBuildCommand(
- std::vector<std::string>& makeCommand, const std::string& makeProgram,
- const std::string& projectName, const std::string& projectDir,
- const std::string& targetName, const std::string& config, bool fast,
- int jobs, bool verbose,
- std::vector<std::string> const& makeOptions = std::vector<std::string>());
+ void Generate() override;
+ void GenerateBuildCommand(std::vector<std::string>& makeCommand,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config, bool fast, int jobs,
+ bool verbose,
+ std::vector<std::string> const& makeOptions =
+ std::vector<std::string>()) override;
private:
void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts);
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 6c4a9e6..dc49ded 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -86,7 +86,7 @@ public:
}
/** Return true if building for WindowsCE */
- bool TargetsWindowsCE() const { return this->SystemIsWindowsCE; }
+ bool TargetsWindowsCE() const override { return this->SystemIsWindowsCE; }
/** Return true if building for WindowsPhone */
bool TargetsWindowsPhone() const { return this->SystemIsWindowsPhone; }
@@ -140,7 +140,7 @@ protected:
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
- const char* GetIDEVersion() override { return "10.0"; }
+ const char* GetIDEVersion() const override { return "10.0"; }
std::string const& GetMSBuildCommand();
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index e40023d..4cde874 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -198,7 +198,7 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
}
}
-bool cmGlobalVisualStudio11Generator::UseFolderProperty()
+bool cmGlobalVisualStudio11Generator::UseFolderProperty() const
{
// Intentionally skip up to the top-level class implementation.
// Folders are not supported by the Express editions in VS10 and earlier,
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index 40f02fb..5b089a4 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -43,8 +43,8 @@ protected:
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
- const char* GetIDEVersion() override { return "11.0"; }
- bool UseFolderProperty();
+ const char* GetIDEVersion() const override { return "11.0"; }
+ bool UseFolderProperty() const override;
static std::set<std::string> GetInstalledWindowsCESDKs();
/** Return true if the configuration needs to be deployed */
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index 9d6554a..ae78de7 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -48,7 +48,7 @@ protected:
// of the toolset is installed
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
- const char* GetIDEVersion() override { return "12.0"; }
+ const char* GetIDEVersion() const override { return "12.0"; }
private:
class Factory;
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 9f5bb4e..4bc430b 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -41,7 +41,7 @@ protected:
// version of the toolset.
virtual std::string GetWindows10SDKMaxVersion() const;
- const char* GetIDEVersion() override { return "14.0"; }
+ const char* GetIDEVersion() const override { return "14.0"; }
virtual bool SelectWindows10SDK(cmMakefile* mf, bool required);
// Used to verify that the Desktop toolset for the current generator is
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index 2853283..4a08352 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -29,8 +29,8 @@ class cmGlobalVisualStudio15Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const override
{
std::string genName;
const char* p = cmVS15GenName(name, genName);
@@ -52,14 +52,14 @@ public:
return 0;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const override
{
entry.Name = std::string(vs15generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2017 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const override
{
names.push_back(vs15generatorName);
names.push_back(vs15generatorName + std::string(" ARM"));
diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h
index 8ab63f1..68aa14f 100644
--- a/Source/cmGlobalVisualStudio15Generator.h
+++ b/Source/cmGlobalVisualStudio15Generator.h
@@ -39,7 +39,7 @@ protected:
bool InitializeWindows(cmMakefile* mf) override;
bool SelectWindowsStoreToolset(std::string& toolset) const override;
- const char* GetIDEVersion() override { return "15.0"; }
+ const char* GetIDEVersion() const override { return "15.0"; }
// Used to verify that the Desktop toolset for the current generator is
// installed on the machine.
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index b6e3131..b634b95 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -37,7 +37,7 @@ protected:
void WriteSLNHeader(std::ostream& fout) override;
// Folders are not supported by VS 7.1.
- virtual bool UseFolderProperty() { return false; }
+ bool UseFolderProperty() const override { return false; }
std::string ProjectConfigurationSectionName;
};
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 59e7a98..12a86f2 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -111,7 +111,6 @@ public:
protected:
void Generate() override;
- virtual const char* GetIDEVersion() = 0;
std::string const& GetDevEnvCommand();
virtual std::string FindDevEnvCommand();
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 097d7e2..ee118f1 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -78,7 +78,7 @@ void cmGlobalVisualStudio8Generator::Configure()
this->cmGlobalVisualStudio7Generator::Configure();
}
-bool cmGlobalVisualStudio8Generator::UseFolderProperty()
+bool cmGlobalVisualStudio8Generator::UseFolderProperty() const
{
return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty();
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 6f64b9c..a21c53d 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -49,7 +49,7 @@ public:
protected:
void AddExtraIDETargets() override;
- const char* GetIDEVersion() override { return "8.0"; }
+ const char* GetIDEVersion() const override { return "8.0"; }
std::string FindDevEnvCommand() override;
@@ -73,7 +73,7 @@ protected:
const char* path,
const cmGeneratorTarget* t) override;
- bool UseFolderProperty();
+ bool UseFolderProperty() const override;
std::string Name;
std::string WindowsCEVersion;
diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h
index 2aa6a91..ee17c37 100644
--- a/Source/cmGlobalVisualStudio9Generator.h
+++ b/Source/cmGlobalVisualStudio9Generator.h
@@ -37,7 +37,7 @@ public:
std::string GetUserMacrosRegKeyBase() override;
protected:
- const char* GetIDEVersion() override { return "9.0"; }
+ const char* GetIDEVersion() const override { return "9.0"; }
private:
class Factory;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 07bc9a3..c891160 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -118,7 +118,7 @@ public:
std::string ExpandCFGIntDir(const std::string& str,
const std::string& config) const override;
- void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+ void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override;
std::string GetStartupProjectName(cmLocalGenerator const* root) const;
@@ -137,7 +137,7 @@ protected:
// below 8.
virtual bool VSLinksDependencies() const { return true; }
- virtual const char* GetIDEVersion() = 0;
+ virtual const char* GetIDEVersion() const = 0;
bool ComputeTargetDepends() override;
class VSDependSet : public std::set<std::string>
@@ -163,7 +163,7 @@ protected:
private:
virtual std::string GetVSMakeProgram() = 0;
void PrintCompilerAdvice(std::ostream&, std::string const&,
- const char*) const
+ const char*) const override
{
}
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 975f052..099fb6d 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -6,7 +6,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <assert.h>
-#include <iterator>
#include <vector>
/**
@@ -33,7 +32,7 @@ class cmLinkedTree
typedef T& ReferenceType;
public:
- class iterator : public std::iterator<std::forward_iterator_tag, T>
+ class iterator
{
friend class cmLinkedTree;
cmLinkedTree* Tree;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index cb41c28..d1dcd81 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -687,6 +687,17 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::string langIncludes = std::string("$(") + lang + "_INCLUDES)";
compileCommand.replace(compileCommand.find(langIncludes),
langIncludes.size(), this->GetIncludes(lang));
+
+ const char* eliminate[] = {
+ this->Makefile->GetDefinition("CMAKE_START_TEMP_FILE"),
+ this->Makefile->GetDefinition("CMAKE_END_TEMP_FILE")
+ };
+ for (const char* el : eliminate) {
+ if (el) {
+ cmSystemTools::ReplaceString(compileCommand, el, "");
+ }
+ }
+
this->GlobalGenerator->AddCXXCompileCommand(
source.GetFullPath(), workingDirectory, compileCommand);
}
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index a81428a..880cf4b 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -4,7 +4,6 @@
#include "cmAlgorithms.h"
#include "cmDocumentationFormatter.h"
-#include "cmState.h"
#include "cmSystemTools.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -131,11 +130,6 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg)
}
}
-cmMessenger::cmMessenger(cmState* state)
- : State(state)
-{
-}
-
void cmMessenger::IssueMessage(cmake::MessageType t, const std::string& text,
const cmListFileBacktrace& backtrace) const
{
@@ -173,31 +167,3 @@ void cmMessenger::DisplayMessage(cmake::MessageType t, const std::string& text,
displayMessage(t, msg);
}
-
-bool cmMessenger::GetSuppressDevWarnings() const
-{
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- return cmSystemTools::IsOn(cacheEntryValue);
-}
-
-bool cmMessenger::GetSuppressDeprecatedWarnings() const
-{
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
- return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue);
-}
-
-bool cmMessenger::GetDevWarningsAsErrors() const
-{
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
- return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue);
-}
-
-bool cmMessenger::GetDeprecatedWarningsAsErrors() const
-{
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
- return cmSystemTools::IsOn(cacheEntryValue);
-}
diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h
index 4aafbd4..e947eaa 100644
--- a/Source/cmMessenger.h
+++ b/Source/cmMessenger.h
@@ -10,13 +10,9 @@
#include <string>
-class cmState;
-
class cmMessenger
{
public:
- cmMessenger(cmState* state);
-
void IssueMessage(
cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
@@ -24,16 +20,42 @@ public:
void DisplayMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace) const;
- bool GetSuppressDevWarnings() const;
- bool GetSuppressDeprecatedWarnings() const;
- bool GetDevWarningsAsErrors() const;
- bool GetDeprecatedWarningsAsErrors() const;
+ void SetSuppressDevWarnings(bool suppress)
+ {
+ this->SuppressDevWarnings = suppress;
+ }
+ void SetSuppressDeprecatedWarnings(bool suppress)
+ {
+ this->SuppressDeprecatedWarnings = suppress;
+ }
+ void SetDevWarningsAsErrors(bool error)
+ {
+ this->DevWarningsAsErrors = error;
+ }
+ void SetDeprecatedWarningsAsErrors(bool error)
+ {
+ this->DeprecatedWarningsAsErrors = error;
+ }
+
+ bool GetSuppressDevWarnings() const { return this->SuppressDevWarnings; }
+ bool GetSuppressDeprecatedWarnings() const
+ {
+ return this->SuppressDeprecatedWarnings;
+ }
+ bool GetDevWarningsAsErrors() const { return this->DevWarningsAsErrors; }
+ bool GetDeprecatedWarningsAsErrors() const
+ {
+ return this->DeprecatedWarningsAsErrors;
+ }
private:
bool IsMessageTypeVisible(cmake::MessageType t) const;
cmake::MessageType ConvertMessageType(cmake::MessageType t) const;
- cmState* State;
+ bool SuppressDevWarnings = false;
+ bool SuppressDeprecatedWarnings = false;
+ bool DevWarningsAsErrors = false;
+ bool DeprecatedWarningsAsErrors = false;
};
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e81d14b..1bc36cc 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -141,7 +141,7 @@ cmake::cmake(Role role)
this->State = new cmState;
this->CurrentSnapshot = this->State->CreateBaseSnapshot();
- this->Messenger = new cmMessenger(this->State);
+ this->Messenger = new cmMessenger;
#ifdef __APPLE__
struct rlimit rlp;
@@ -1300,6 +1300,23 @@ int cmake::Configure()
}
}
+ // Cache variables may have already been set by a previous invocation,
+ // so we cannot rely on command line options alone. Always ensure our
+ // messenger is in sync with the cache.
+ const char* value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
+ this->Messenger->SetSuppressDeprecatedWarnings(value &&
+ cmSystemTools::IsOff(value));
+
+ value = this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
+ this->Messenger->SetDeprecatedWarningsAsErrors(cmSystemTools::IsOn(value));
+
+ value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+ this->Messenger->SetSuppressDevWarnings(cmSystemTools::IsOn(value));
+
+ value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
+ this->Messenger->SetDevWarningsAsErrors(value &&
+ cmSystemTools::IsOff(value));
+
int ret = this->ActualConfigure();
const char* delCacheVars =
this->State->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_");
@@ -1701,6 +1718,18 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
this->State->AddCacheEntry(key, value, helpString,
cmStateEnums::CacheEntryType(type));
this->UnwatchUnusedCli(key);
+
+ if (key == "CMAKE_WARN_DEPRECATED") {
+ this->Messenger->SetSuppressDeprecatedWarnings(
+ value && cmSystemTools::IsOff(value));
+ } else if (key == "CMAKE_ERROR_DEPRECATED") {
+ this->Messenger->SetDeprecatedWarningsAsErrors(cmSystemTools::IsOn(value));
+ } else if (key == "CMAKE_SUPPRESS_DEVELOPER_WARNINGS") {
+ this->Messenger->SetSuppressDevWarnings(cmSystemTools::IsOn(value));
+ } else if (key == "CMAKE_SUPPRESS_DEVELOPER_ERRORS") {
+ this->Messenger->SetDevWarningsAsErrors(value &&
+ cmSystemTools::IsOff(value));
+ }
}
bool cmake::DoWriteGlobVerifyTarget() const
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index 204d54c..f40524f 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -56,7 +56,7 @@ add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND}
-P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake
)
-include(${CMAKE_SOURCE_DIR}/Modules/CMakeParseArguments.cmake)
+include(CMakeParseArguments)
function(add_major_test module)
cmake_parse_arguments(MAJOR_TEST "NOLANG" "VERSION_VAR" "VERSIONS" ${ARGN})
diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
new file mode 100644
index 0000000..5a353d8
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
@@ -0,0 +1,3 @@
+-- GetPrequisites\(.*script.sh\) : ignoring script file
+-- GetPrequisites\(.*script.bat\) : ignoring script file
+-- GetPrequisites\(.*script\) : ignoring script file
diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake
new file mode 100644
index 0000000..d1bc9b1
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake
@@ -0,0 +1,19 @@
+include(GetPrerequisites)
+
+function(check_script script)
+ set(prereqs "")
+ get_prerequisites(${script} prereqs 1 1 "" "")
+ if(NOT "${prereqs}" STREQUAL "")
+ message(FATAL_ERROR "Prerequisites for ${script} not empty")
+ endif()
+endfunction()
+
+# Should not throw any errors
+# Regular executable
+get_prerequisites(${CMAKE_COMMAND} cmake_prereqs 1 1 "" "")
+# Shell script
+check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh)
+# Batch script
+check_script(${CMAKE_CURRENT_LIST_DIR}/script.bat)
+# Shell script without extension
+check_script(${CMAKE_CURRENT_LIST_DIR}/script)
diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
index 3856c54..a635e38 100644
--- a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
include(RunCMake)
run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
+run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake)
diff --git a/Tests/RunCMake/GetPrerequisites/script b/Tests/RunCMake/GetPrerequisites/script
new file mode 100755
index 0000000..23bf47c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/script
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "Hello World"
diff --git a/Tests/RunCMake/GetPrerequisites/script.bat b/Tests/RunCMake/GetPrerequisites/script.bat
new file mode 100755
index 0000000..dbb0ec2
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/script.bat
@@ -0,0 +1,3 @@
+@echo off
+
+echo "Hello world"
diff --git a/Tests/RunCMake/GetPrerequisites/script.sh b/Tests/RunCMake/GetPrerequisites/script.sh
new file mode 100755
index 0000000..23bf47c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/script.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "Hello World"
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index f79cda6..434895e 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -111,3 +111,15 @@ add_test(NAME UseSWIG.ModuleName COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+
+
+add_test(NAME UseSWIG.SwigSrcFileExtension COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/SwigSrcFileExtension"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/SwigSrcFileExtension"
+ ${build_generator_args}
+ --build-project SwigSrcFileExtension
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt b/Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt
new file mode 100644
index 0000000..7eb73d4
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.1...3.14)
+
+project(SwigSrcFileExtension C)
+
+include(CTest)
+find_package(SWIG REQUIRED)
+find_package(Python COMPONENTS Interpreter Development REQUIRED)
+
+include(${SWIG_USE_FILE})
+
+# Use the newer target name preference
+set(UseSWIG_TARGET_NAME_PREFERENCE "STANDARD")
+
+# Set the custom source file extension to both .i and .swg
+set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg")
+
+# Generate a Python module out of `.i`
+swig_add_library(my_add LANGUAGE python SOURCES my_add.i)
+target_link_libraries(my_add Python::Python)
+
+# Generate a Python module out of `.swg`
+swig_add_library(my_sub LANGUAGE python SOURCES my_sub.swg)
+target_link_libraries(my_sub Python::Python)
+
+# Add a test
+add_test(NAME SwigSrcFileExtension
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}"
+ "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py")
diff --git a/Tests/UseSWIG/SwigSrcFileExtension/my_add.i b/Tests/UseSWIG/SwigSrcFileExtension/my_add.i
new file mode 100644
index 0000000..d087ab5
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcFileExtension/my_add.i
@@ -0,0 +1,9 @@
+%module my_add
+
+%{
+int add(int a, int b) {
+ return a + b;
+}
+%}
+
+int add(int a, int b);
diff --git a/Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg b/Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg
new file mode 100644
index 0000000..df34b44
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg
@@ -0,0 +1,9 @@
+%module my_sub
+
+%{
+int sub(int a, int b) {
+ return a - b;
+}
+%}
+
+int sub(int a, int b);
diff --git a/Tests/UseSWIG/SwigSrcFileExtension/runme.py b/Tests/UseSWIG/SwigSrcFileExtension/runme.py
new file mode 100755
index 0000000..290175b
--- /dev/null
+++ b/Tests/UseSWIG/SwigSrcFileExtension/runme.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import random
+
+import my_add
+import my_sub
+
+
+# These can be changed, but make sure not to overflow `int`
+a = random.randint(1, 1024)
+b = random.randint(1, 1024)
+
+if my_add.add(a, b) == a + b:
+ print ("Test 1 Passed for SWIG custom source file extension")
+else:
+ print ("Test 1 FAILED for SWIG custom source file extension")
+ exit(1)
+
+if my_sub.sub(a, b) == a - b:
+ print ("Test 2 Passed for SWIG custom source file extension")
+else:
+ print ("Test 2 FAILED for SWIG custom source file extension")
+ exit(1)