summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/mingw-find-no-dll.rst6
-rw-r--r--Modules/CMakeASM_MASMInformation.cmake6
-rw-r--r--Modules/FindGTK2.cmake117
-rw-r--r--Modules/FindMPI.cmake7
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake26
-rw-r--r--Modules/Platform/Windows-Clang.cmake2
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmInstallCommand.cxx50
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx16
-rw-r--r--Source/cmInstallDirectoryGenerator.h21
-rw-r--r--Source/cmInstallExportGenerator.cxx14
-rw-r--r--Source/cmInstallExportGenerator.h20
-rw-r--r--Source/cmInstallFilesCommand.cxx8
-rw-r--r--Source/cmInstallFilesGenerator.cxx15
-rw-r--r--Source/cmInstallFilesGenerator.h18
-rw-r--r--Source/cmInstallGenerator.cxx15
-rw-r--r--Source/cmInstallGenerator.h14
-rw-r--r--Source/cmInstallProgramsCommand.cxx8
-rw-r--r--Source/cmInstallScriptGenerator.cxx12
-rw-r--r--Source/cmInstallScriptGenerator.h9
-rw-r--r--Source/cmInstallSubdirectoryGenerator.cxx9
-rw-r--r--Source/cmInstallSubdirectoryGenerator.h6
-rw-r--r--Source/cmInstallTargetGenerator.cxx8
-rw-r--r--Source/cmInstallTargetGenerator.h20
-rw-r--r--Source/cmLocalGenerator.cxx22
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx91
-rw-r--r--Source/cmLocalVisualStudio7Generator.h4
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmScriptGenerator.h2
-rw-r--r--Tests/CMakeTests/FileDownloadTest.cmake.in4
31 files changed, 284 insertions, 272 deletions
diff --git a/Help/release/dev/mingw-find-no-dll.rst b/Help/release/dev/mingw-find-no-dll.rst
new file mode 100644
index 0000000..84e7431
--- /dev/null
+++ b/Help/release/dev/mingw-find-no-dll.rst
@@ -0,0 +1,6 @@
+mingw-find-no-dll
+-----------------
+
+* When using MinGW tools, the :command:`find_library` command no longer
+ finds ``.dll`` files by default. Instead it expects ``.dll.a`` import
+ libraries to be available.
diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake
index a38c114..9f7e934 100644
--- a/Modules/CMakeASM_MASMInformation.cmake
+++ b/Modules/CMakeASM_MASMInformation.cmake
@@ -10,5 +10,11 @@ set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
+# The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
+
include(CMakeASMInformation)
set(ASM_DIALECT)
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 9117321..565763d 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -5,96 +5,83 @@
FindGTK2
--------
-Find the GTK2 widget libraries and several of its
-other optional components like ``gtkmm``, ``glade``, and ``glademm``.
-
-NOTE: If you intend to use version checking, CMake 2.6.2 or later is
-
-::
-
- required.
-
-
+Find the GTK2 widget libraries and several of its other optional components
+like ``gtkmm``, ``glade``, and ``glademm``.
Specify one or more of the following components as you call this find
module. See example below.
-::
-
- gtk
- gtkmm
- glade
- glademm
-
+* ``gtk``
+* ``gtkmm``
+* ``glade``
+* ``glademm``
+Result Variables
+^^^^^^^^^^^^^^^^
The following variables will be defined for your use
-::
-
- GTK2_FOUND - Were all of your specified components found?
- GTK2_INCLUDE_DIRS - All include directories
- GTK2_LIBRARIES - All libraries
- GTK2_TARGETS - All imported targets
- GTK2_DEFINITIONS - Additional compiler flags
-
-
-
-::
-
- GTK2_VERSION - The version of GTK2 found (x.y.z)
- GTK2_MAJOR_VERSION - The major version of GTK2
- GTK2_MINOR_VERSION - The minor version of GTK2
- GTK2_PATCH_VERSION - The patch version of GTK2
-
-
+``GTK2_FOUND``
+ Were all of your specified components found?
+``GTK2_INCLUDE_DIRS``
+ All include directories
+``GTK2_LIBRARIES``
+ All libraries
+``GTK2_TARGETS``
+ All imported targets
+``GTK2_DEFINITIONS``
+ Additional compiler flags
+``GTK2_VERSION``
+ The version of GTK2 found (x.y.z)
+``GTK2_MAJOR_VERSION``
+ The major version of GTK2
+``GTK2_MINOR_VERSION``
+ The minor version of GTK2
+``GTK2_PATCH_VERSION``
+ The patch version of GTK2
+
+Input Variables
+^^^^^^^^^^^^^^^
Optional variables you can define prior to calling this module:
-::
-
- GTK2_DEBUG - Enables verbose debugging of the module
- GTK2_ADDITIONAL_SUFFIXES - Allows defining additional directories to
- search for include files
-
-
-
-================= Example Usage:
-
-::
-
- Call find_package() once, here are some examples to pick from:
-
-
+``GTK2_DEBUG``
+ Enables verbose debugging of the module
+``GTK2_ADDITIONAL_SUFFIXES``
+ Allows defining additional directories to search for include files
-::
+Example Usage
+^^^^^^^^^^^^^
- Require GTK 2.6 or later
- find_package(GTK2 2.6 REQUIRED gtk)
+Call :command:`find_package` once. Here are some examples to pick from:
+Require GTK 2.6 or later:
+.. code-block:: cmake
-::
+ find_package(GTK2 2.6 REQUIRED gtk)
- Require GTK 2.10 or later and Glade
- find_package(GTK2 2.10 REQUIRED gtk glade)
+Require GTK 2.10 or later and Glade:
+.. code-block:: cmake
+ find_package(GTK2 2.10 REQUIRED gtk glade)
-::
+Search for GTK/GTKMM 2.8 or later:
- Search for GTK/GTKMM 2.8 or later
- find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
+.. code-block:: cmake
+ find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
+Use the results:
-::
+.. code-block:: cmake
- if(GTK2_FOUND)
- include_directories(${GTK2_INCLUDE_DIRS})
- add_executable(mygui mygui.cc)
- target_link_libraries(mygui ${GTK2_LIBRARIES})
- endif()
+ if(GTK2_FOUND)
+ include_directories(${GTK2_INCLUDE_DIRS})
+ add_executable(mygui mygui.cc)
+ target_link_libraries(mygui ${GTK2_LIBRARIES})
+ endif()
#]=======================================================================]
# Version 1.6 (CMake 3.0)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index f79ee63..cb52056 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1060,9 +1060,6 @@ macro(_MPI_assemble_libraries LANG)
endmacro()
macro(_MPI_split_include_dirs LANG)
- if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
- return()
- endif()
# Backwards compatibility: Search INCLUDE_PATH if given.
if(MPI_${LANG}_INCLUDE_PATH)
list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}")
@@ -1475,7 +1472,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
endif()
endif()
- _MPI_split_include_dirs(${LANG})
+ if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
+ _MPI_split_include_dirs(${LANG})
+ endif()
_MPI_assemble_libraries(${LANG})
_MPI_adjust_compile_definitions(${LANG})
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 0e1429d..04687b9 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -288,9 +288,16 @@ if(MSVC)
"${MSVC_CRT_DIR}/msvcp${v}.dll"
)
if(NOT vs VERSION_LESS 14)
- if(EXISTS "${MSVC_CRT_DIR}/vcruntime${v}_1.dll")
- list(APPEND __install__libs "${MSVC_CRT_DIR}/vcruntime${v}_1.dll")
- endif()
+ foreach(crt
+ "${MSVC_CRT_DIR}/msvcp${v}_1.dll"
+ "${MSVC_CRT_DIR}/msvcp${v}_2.dll"
+ "${MSVC_CRT_DIR}/msvcp${v}_codecvt_ids.dll"
+ "${MSVC_CRT_DIR}/vcruntime${v}_1.dll"
+ )
+ if(EXISTS "${crt}")
+ list(APPEND __install__libs "${crt}")
+ endif()
+ endforeach()
list(APPEND __install__libs
"${MSVC_CRT_DIR}/vcruntime${v}.dll"
"${MSVC_CRT_DIR}/concrt${v}.dll"
@@ -309,9 +316,16 @@ if(MSVC)
"${MSVC_CRT_DIR}/msvcp${v}d.dll"
)
if(NOT vs VERSION_LESS 14)
- if(EXISTS "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll")
- list(APPEND __install__libs "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll")
- endif()
+ foreach(crt
+ "${MSVC_CRT_DIR}/msvcp${v}_1d.dll"
+ "${MSVC_CRT_DIR}/msvcp${v}_2d.dll"
+ "${MSVC_CRT_DIR}/msvcp${v}d_codecvt_ids.dll"
+ "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll"
+ )
+ if(EXISTS "${crt}")
+ list(APPEND __install__libs "${crt}")
+ endif()
+ endforeach()
list(APPEND __install__libs
"${MSVC_CRT_DIR}/vcruntime${v}d.dll"
"${MSVC_CRT_DIR}/concrt${v}d.dll"
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 02864c6..c17cf6d 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -24,7 +24,7 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1)
set (CMAKE_LINK_DEF_FILE_FLAG "-Xlinker /DEF:")
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 235d9ce..38a8cf4 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -25,7 +25,7 @@ endif()
if(MINGW)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32")
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e56692b..a2976ab 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 16)
-set(CMake_VERSION_PATCH 20200121)
+set(CMake_VERSION_PATCH 20200122)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 54b85cd..c67358f 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -93,13 +93,12 @@ std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(target.GetMakefile());
target.SetHaveInstallRule(true);
- const char* component = namelink ? args.GetNamelinkComponent().c_str()
- : args.GetComponent().c_str();
+ const std::string& component =
+ namelink ? args.GetNamelinkComponent() : args.GetComponent();
auto g = cm::make_unique<cmInstallTargetGenerator>(
- target.GetName(), destination.c_str(), impLib,
- args.GetPermissions().c_str(), args.GetConfigurations(), component,
- message, args.GetExcludeFromAll(), args.GetOptional() || forceOpt,
- backtrace);
+ target.GetName(), destination, impLib, args.GetPermissions(),
+ args.GetConfigurations(), component, message, args.GetExcludeFromAll(),
+ args.GetOptional() || forceOpt, backtrace);
target.AddInstallGenerator(g.get());
return g;
}
@@ -122,9 +121,9 @@ std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(mf);
return cm::make_unique<cmInstallFilesGenerator>(
- absFiles, destination.c_str(), programs, args.GetPermissions().c_str(),
- args.GetConfigurations(), args.GetComponent().c_str(), message,
- args.GetExcludeFromAll(), args.GetRename().c_str(), args.GetOptional());
+ absFiles, destination, programs, args.GetPermissions(),
+ args.GetConfigurations(), args.GetComponent(), message,
+ args.GetExcludeFromAll(), args.GetRename(), args.GetOptional());
}
std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
@@ -197,14 +196,14 @@ bool HandleScriptMode(std::vector<std::string> const& args,
return false;
}
helper.Makefile->AddInstallGenerator(
- cm::make_unique<cmInstallScriptGenerator>(
- script.c_str(), false, component.c_str(), exclude_from_all));
+ cm::make_unique<cmInstallScriptGenerator>(script, false, component,
+ exclude_from_all));
} else if (doing_code) {
doing_code = false;
std::string const& code = arg;
helper.Makefile->AddInstallGenerator(
- cm::make_unique<cmInstallScriptGenerator>(
- code.c_str(), true, component.c_str(), exclude_from_all));
+ cm::make_unique<cmInstallScriptGenerator>(code, true, component,
+ exclude_from_all));
}
}
@@ -943,7 +942,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
bool exclude_from_all = false;
bool message_never = false;
std::vector<std::string> dirs;
- const char* destination = nullptr;
+ const std::string* destination = nullptr;
std::string permissions_file;
std::string permissions_dir;
std::vector<std::string> configurations;
@@ -1102,7 +1101,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
} else if (doing == DoingConfigurations) {
configurations.push_back(args[i]);
} else if (doing == DoingDestination) {
- destination = args[i].c_str();
+ destination = &args[i];
doing = DoingNone;
} else if (doing == DoingType) {
if (allowedTypes.count(args[i]) == 0) {
@@ -1188,7 +1187,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
return false;
}
destinationStr = helper.GetDestinationForType(nullptr, type);
- destination = destinationStr.c_str();
+ destination = &destinationStr;
} else if (!type.empty()) {
status.SetError(cmStrCat(args[0],
" given both TYPE and DESTINATION "
@@ -1202,9 +1201,8 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
// Create the directory install generator.
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallDirectoryGenerator>(
- dirs, destination, permissions_file.c_str(), permissions_dir.c_str(),
- configurations, component.c_str(), message, exclude_from_all,
- literal_args.c_str(), optional));
+ dirs, *destination, permissions_file, permissions_dir, configurations,
+ component, message, exclude_from_all, literal_args, optional));
// Tell the global generator about any installation component names
// specified.
@@ -1294,10 +1292,9 @@ bool HandleExportAndroidMKMode(std::vector<std::string> const& args,
// Create the export install generator.
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallExportGenerator>(
- &exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(),
- ica.GetConfigurations(), ica.GetComponent().c_str(), message,
- ica.GetExcludeFromAll(), fname.c_str(), name_space.c_str(), exportOld,
- true));
+ &exportSet, ica.GetDestination(), ica.GetPermissions(),
+ ica.GetConfigurations(), ica.GetComponent(), message,
+ ica.GetExcludeFromAll(), fname, name_space, exportOld, true));
return true;
#else
@@ -1408,10 +1405,9 @@ bool HandleExportMode(std::vector<std::string> const& args,
// Create the export install generator.
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallExportGenerator>(
- &exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(),
- ica.GetConfigurations(), ica.GetComponent().c_str(), message,
- ica.GetExcludeFromAll(), fname.c_str(), name_space.c_str(), exportOld,
- false));
+ &exportSet, ica.GetDestination(), ica.GetPermissions(),
+ ica.GetConfigurations(), ica.GetComponent(), message,
+ ica.GetExcludeFromAll(), fname, name_space, exportOld, false));
return true;
}
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 259c7f7..175e7cf 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallDirectoryGenerator.h"
+#include <utility>
+
#include "cmGeneratorExpression.h"
#include "cmInstallType.h"
#include "cmLocalGenerator.h"
@@ -10,18 +12,18 @@
#include "cmSystemTools.h"
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
- std::vector<std::string> const& dirs, const char* dest,
- const char* file_permissions, const char* dir_permissions,
- std::vector<std::string> const& configurations, const char* component,
- MessageLevel message, bool exclude_from_all, const char* literal_args,
+ std::vector<std::string> const& dirs, std::string const& dest,
+ std::string file_permissions, std::string dir_permissions,
+ std::vector<std::string> const& configurations, std::string const& component,
+ MessageLevel message, bool exclude_from_all, std::string literal_args,
bool optional)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
, LocalGenerator(nullptr)
, Directories(dirs)
- , FilePermissions(file_permissions)
- , DirPermissions(dir_permissions)
- , LiteralArguments(literal_args)
+ , FilePermissions(std::move(file_permissions))
+ , DirPermissions(std::move(dir_permissions))
+ , LiteralArguments(std::move(literal_args))
, Optional(optional)
{
// We need per-config actions if destination have generator expressions.
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 84c0694..bec89df 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -21,12 +21,13 @@ class cmInstallDirectoryGenerator : public cmInstallGenerator
{
public:
cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
- const char* dest, const char* file_permissions,
- const char* dir_permissions,
+ std::string const& dest,
+ std::string file_permissions,
+ std::string dir_permissions,
std::vector<std::string> const& configurations,
- const char* component, MessageLevel message,
- bool exclude_from_all, const char* literal_args,
- bool optional = false);
+ std::string const& component,
+ MessageLevel message, bool exclude_from_all,
+ std::string literal_args, bool optional = false);
~cmInstallDirectoryGenerator() override;
bool Compute(cmLocalGenerator* lg) override;
@@ -41,11 +42,11 @@ protected:
Indent indent,
std::vector<std::string> const& dirs);
cmLocalGenerator* LocalGenerator;
- std::vector<std::string> Directories;
- std::string FilePermissions;
- std::string DirPermissions;
- std::string LiteralArguments;
- bool Optional;
+ std::vector<std::string> const Directories;
+ std::string const FilePermissions;
+ std::string const DirPermissions;
+ std::string const LiteralArguments;
+ bool const Optional;
};
#endif
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index cba68be..2c53a28 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -18,16 +18,16 @@
#include "cmSystemTools.h"
cmInstallExportGenerator::cmInstallExportGenerator(
- cmExportSet* exportSet, const char* destination,
- const char* file_permissions, std::vector<std::string> const& configurations,
- const char* component, MessageLevel message, bool exclude_from_all,
- const char* filename, const char* name_space, bool exportOld, bool android)
+ cmExportSet* exportSet, std::string const& destination,
+ std::string file_permissions, std::vector<std::string> const& configurations,
+ std::string const& component, MessageLevel message, bool exclude_from_all,
+ std::string filename, std::string name_space, bool exportOld, bool android)
: cmInstallGenerator(destination, configurations, component, message,
exclude_from_all)
, ExportSet(exportSet)
- , FilePermissions(file_permissions)
- , FileName(filename)
- , Namespace(name_space)
+ , FilePermissions(std::move(file_permissions))
+ , FileName(std::move(filename))
+ , Namespace(std::move(name_space))
, ExportOld(exportOld)
, LocalGenerator(nullptr)
{
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index f44127e..cf28b35 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -23,12 +23,12 @@ class cmLocalGenerator;
class cmInstallExportGenerator : public cmInstallGenerator
{
public:
- cmInstallExportGenerator(cmExportSet* exportSet, const char* dest,
- const char* file_permissions,
+ cmInstallExportGenerator(cmExportSet* exportSet, std::string const& dest,
+ std::string file_permissions,
const std::vector<std::string>& configurations,
- const char* component, MessageLevel message,
- bool exclude_from_all, const char* filename,
- const char* name_space, bool exportOld,
+ std::string const& component, MessageLevel message,
+ bool exclude_from_all, std::string filename,
+ std::string name_space, bool exportOld,
bool android);
~cmInstallExportGenerator() override;
@@ -52,11 +52,11 @@ protected:
void ComputeTempDir();
size_t GetMaxConfigLength() const;
- cmExportSet* ExportSet;
- std::string FilePermissions;
- std::string FileName;
- std::string Namespace;
- bool ExportOld;
+ cmExportSet* const ExportSet;
+ std::string const FilePermissions;
+ std::string const FileName;
+ std::string const Namespace;
+ bool const ExportOld;
cmLocalGenerator* LocalGenerator;
std::string TempDir;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index bfc7359..3c59f01 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -115,8 +115,8 @@ static void CreateInstallGenerator(cmMakefile& makefile,
}
// Use a file install generator.
- const char* no_permissions = "";
- const char* no_rename = "";
+ const std::string no_permissions;
+ const std::string no_rename;
bool no_exclude_from_all = false;
std::string no_component =
makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
@@ -124,8 +124,8 @@ static void CreateInstallGenerator(cmMakefile& makefile,
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(&makefile);
makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>(
- files, destination.c_str(), false, no_permissions, no_configurations,
- no_component.c_str(), message, no_exclude_from_all, no_rename));
+ files, destination, false, no_permissions, no_configurations, no_component,
+ message, no_exclude_from_all, no_rename));
}
/**
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index f5b69a5..ad2f84e 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesGenerator.h"
+#include <utility>
+
#include "cmGeneratorExpression.h"
#include "cmInstallType.h"
#include "cmStringAlgorithms.h"
@@ -9,16 +11,17 @@
class cmLocalGenerator;
cmInstallFilesGenerator::cmInstallFilesGenerator(
- std::vector<std::string> const& files, const char* dest, bool programs,
- const char* file_permissions, std::vector<std::string> const& configurations,
- const char* component, MessageLevel message, bool exclude_from_all,
- const char* rename, bool optional)
+ std::vector<std::string> const& files, std::string const& dest,
+ bool programs, std::string file_permissions,
+ std::vector<std::string> const& configurations, std::string const& component,
+ MessageLevel message, bool exclude_from_all, std::string rename,
+ bool optional)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
, LocalGenerator(nullptr)
, Files(files)
- , FilePermissions(file_permissions)
- , Rename(rename)
+ , FilePermissions(std::move(file_permissions))
+ , Rename(std::move(rename))
, Programs(programs)
, Optional(optional)
{
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index a680037..8266603 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -21,11 +21,11 @@ class cmInstallFilesGenerator : public cmInstallGenerator
{
public:
cmInstallFilesGenerator(std::vector<std::string> const& files,
- const char* dest, bool programs,
- const char* file_permissions,
+ std::string const& dest, bool programs,
+ std::string file_permissions,
std::vector<std::string> const& configurations,
- const char* component, MessageLevel message,
- bool exclude_from_all, const char* rename,
+ std::string const& component, MessageLevel message,
+ bool exclude_from_all, std::string rename,
bool optional = false);
~cmInstallFilesGenerator() override;
@@ -42,11 +42,11 @@ protected:
std::vector<std::string> const& files);
cmLocalGenerator* LocalGenerator;
- std::vector<std::string> Files;
- std::string FilePermissions;
- std::string Rename;
- bool Programs;
- bool Optional;
+ std::vector<std::string> const Files;
+ std::string const FilePermissions;
+ std::string const Rename;
+ bool const Programs;
+ bool const Optional;
};
#endif
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index ec17361..0665895 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -3,16 +3,17 @@
#include "cmInstallGenerator.h"
#include <ostream>
+#include <utility>
#include "cmMakefile.h"
#include "cmSystemTools.h"
cmInstallGenerator::cmInstallGenerator(
- const char* destination, std::vector<std::string> const& configurations,
- const char* component, MessageLevel message, bool exclude_from_all)
+ std::string destination, std::vector<std::string> const& configurations,
+ std::string component, MessageLevel message, bool exclude_from_all)
: cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations)
- , Destination(destination ? destination : "")
- , Component(component ? component : "")
+ , Destination(std::move(destination))
+ , Component(std::move(component))
, Message(message)
, ExcludeFromAll(exclude_from_all)
{
@@ -139,8 +140,8 @@ void cmInstallGenerator::AddInstallRule(
os << ")\n";
}
-std::string cmInstallGenerator::CreateComponentTest(const char* component,
- bool exclude_from_all)
+std::string cmInstallGenerator::CreateComponentTest(
+ const std::string& component, bool exclude_from_all)
{
std::string result = R"("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "x)";
result += component;
@@ -158,7 +159,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
// Begin this block of installation.
std::string component_test =
- this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
+ this->CreateComponentTest(this->Component, this->ExcludeFromAll);
os << indent << "if(" << component_test << ")\n";
// Generate the script possibly with per-configuration code.
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 024027d..d786d24 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -30,9 +30,9 @@ public:
MessageNever
};
- cmInstallGenerator(const char* destination,
+ cmInstallGenerator(std::string destination,
std::vector<std::string> const& configurations,
- const char* component, MessageLevel message,
+ std::string component, MessageLevel message,
bool exclude_from_all);
~cmInstallGenerator() override;
@@ -65,14 +65,14 @@ public:
protected:
void GenerateScript(std::ostream& os) override;
- std::string CreateComponentTest(const char* component,
+ std::string CreateComponentTest(const std::string& component,
bool exclude_from_all);
// Information shared by most generator types.
- std::string Destination;
- std::string Component;
- MessageLevel Message;
- bool ExcludeFromAll;
+ std::string const Destination;
+ std::string const Component;
+ MessageLevel const Message;
+ bool const ExcludeFromAll;
};
#endif
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 2fd9bad..be07fd4 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -89,8 +89,8 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
}
// Use a file install generator.
- const char* no_permissions = "";
- const char* no_rename = "";
+ const std::string no_permissions;
+ const std::string no_rename;
bool no_exclude_from_all = false;
std::string no_component =
makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
@@ -98,8 +98,8 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(&makefile);
makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>(
- files, destination.c_str(), true, no_permissions, no_configurations,
- no_component.c_str(), message, no_exclude_from_all, no_rename));
+ files, destination, true, no_permissions, no_configurations, no_component,
+ message, no_exclude_from_all, no_rename));
}
/**
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index ea29455..7cdf3b4 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -3,6 +3,7 @@
#include "cmInstallScriptGenerator.h"
#include <ostream>
+#include <utility>
#include <vector>
#include "cmGeneratorExpression.h"
@@ -11,13 +12,12 @@
#include "cmPolicies.h"
#include "cmScriptGenerator.h"
-cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
- bool code,
- const char* component,
- bool exclude_from_all)
- : cmInstallGenerator(nullptr, std::vector<std::string>(), component,
+cmInstallScriptGenerator::cmInstallScriptGenerator(
+ std::string script, bool code, std::string const& component,
+ bool exclude_from_all)
+ : cmInstallGenerator("", std::vector<std::string>(), component,
MessageDefault, exclude_from_all)
- , Script(script)
+ , Script(std::move(script))
, Code(code)
, AllowGenex(false)
{
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index 7efa321..0a9c4ba 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -19,8 +19,9 @@ class cmLocalGenerator;
class cmInstallScriptGenerator : public cmInstallGenerator
{
public:
- cmInstallScriptGenerator(const char* script, bool code,
- const char* component, bool exclude_from_all);
+ cmInstallScriptGenerator(std::string script, bool code,
+ std::string const& component,
+ bool exclude_from_all);
~cmInstallScriptGenerator() override;
bool Compute(cmLocalGenerator* lg) override;
@@ -32,8 +33,8 @@ protected:
void AddScriptInstallRule(std::ostream& os, Indent indent,
std::string const& script);
- std::string Script;
- bool Code;
+ std::string const Script;
+ bool const Code;
cmLocalGenerator* LocalGenerator;
bool AllowGenex;
};
diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx
index 5405b7c..12bc92b 100644
--- a/Source/cmInstallSubdirectoryGenerator.cxx
+++ b/Source/cmInstallSubdirectoryGenerator.cxx
@@ -4,6 +4,7 @@
#include <memory>
#include <sstream>
+#include <utility>
#include <vector>
#include "cmLocalGenerator.h"
@@ -13,11 +14,11 @@
#include "cmSystemTools.h"
cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator(
- cmMakefile* makefile, const char* binaryDirectory, bool excludeFromAll)
- : cmInstallGenerator(nullptr, std::vector<std::string>(), nullptr,
- MessageDefault, excludeFromAll)
+ cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll)
+ : cmInstallGenerator("", std::vector<std::string>(), "", MessageDefault,
+ excludeFromAll)
, Makefile(makefile)
- , BinaryDirectory(binaryDirectory)
+ , BinaryDirectory(std::move(binaryDirectory))
{
}
diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h
index b99bdd5..f9cd0f1 100644
--- a/Source/cmInstallSubdirectoryGenerator.h
+++ b/Source/cmInstallSubdirectoryGenerator.h
@@ -20,7 +20,7 @@ class cmInstallSubdirectoryGenerator : public cmInstallGenerator
{
public:
cmInstallSubdirectoryGenerator(cmMakefile* makefile,
- const char* binaryDirectory,
+ std::string binaryDirectory,
bool excludeFromAll);
~cmInstallSubdirectoryGenerator() override;
@@ -33,8 +33,8 @@ public:
protected:
void GenerateScript(std::ostream& os) override;
- cmMakefile* Makefile;
- std::string BinaryDirectory;
+ cmMakefile* const Makefile;
+ std::string const BinaryDirectory;
cmLocalGenerator* LocalGenerator;
};
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 69c9b7e..e05daa8 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -25,15 +25,15 @@
#include "cmake.h"
cmInstallTargetGenerator::cmInstallTargetGenerator(
- std::string targetName, const char* dest, bool implib,
- const char* file_permissions, std::vector<std::string> const& configurations,
- const char* component, MessageLevel message, bool exclude_from_all,
+ std::string targetName, std::string const& dest, bool implib,
+ std::string file_permissions, std::vector<std::string> const& configurations,
+ std::string const& component, MessageLevel message, bool exclude_from_all,
bool optional, cmListFileBacktrace backtrace)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
, TargetName(std::move(targetName))
, Target(nullptr)
- , FilePermissions(file_permissions)
+ , FilePermissions(std::move(file_permissions))
, ImportLibrary(implib)
, Optional(optional)
, Backtrace(std::move(backtrace))
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 8730454..e21001f 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -23,11 +23,11 @@ class cmInstallTargetGenerator : public cmInstallGenerator
{
public:
cmInstallTargetGenerator(
- std::string targetName, const char* dest, bool implib,
- const char* file_permissions,
- std::vector<std::string> const& configurations, const char* component,
- MessageLevel message, bool exclude_from_all, bool optional,
- cmListFileBacktrace backtrace = cmListFileBacktrace());
+ std::string targetName, std::string const& dest, bool implib,
+ std::string file_permissions,
+ std::vector<std::string> const& configurations,
+ std::string const& component, MessageLevel message, bool exclude_from_all,
+ bool optional, cmListFileBacktrace backtrace = cmListFileBacktrace());
~cmInstallTargetGenerator() override;
/** Select the policy for installing shared library linkable name
@@ -106,13 +106,13 @@ protected:
const std::string& toDestDirPath);
void IssueCMP0095Warning(const std::string& unescapedRpath);
- std::string TargetName;
+ std::string const TargetName;
cmGeneratorTarget* Target;
- std::string FilePermissions;
+ std::string const FilePermissions;
NamelinkModeType NamelinkMode;
- bool ImportLibrary;
- bool Optional;
- cmListFileBacktrace Backtrace;
+ bool const ImportLibrary;
+ bool const Optional;
+ cmListFileBacktrace const Backtrace;
};
#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ed857e5..d1a3454 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3004,7 +3004,7 @@ class cmInstallTargetGeneratorLocal : public cmInstallTargetGenerator
{
public:
cmInstallTargetGeneratorLocal(cmLocalGenerator* lg, std::string const& t,
- const char* dest, bool implib)
+ std::string const& dest, bool implib)
: cmInstallTargetGenerator(
t, dest, implib, "", std::vector<std::string>(), "Unspecified",
cmInstallGenerator::SelectMessageLevel(lg->GetMakefile()), false,
@@ -3028,7 +3028,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Include the user-specified pre-install script for this target.
if (const char* preinstall = l->GetProperty("PRE_INSTALL_SCRIPT")) {
- cmInstallScriptGenerator g(preinstall, false, nullptr, false);
+ cmInstallScriptGenerator g(preinstall, false, "", false);
g.Generate(os, config, configurationTypes);
}
@@ -3049,8 +3049,8 @@ void cmLocalGenerator::GenerateTargetInstallRules(
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
// Use a target install generator.
- cmInstallTargetGeneratorLocal g(this, l->GetName(),
- destination.c_str(), false);
+ cmInstallTargetGeneratorLocal g(this, l->GetName(), destination,
+ false);
g.Generate(os, config, configurationTypes);
} break;
case cmStateEnums::SHARED_LIBRARY: {
@@ -3058,19 +3058,19 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Special code to handle DLL. Install the import library
// to the normal destination and the DLL to the runtime
// destination.
- cmInstallTargetGeneratorLocal g1(this, l->GetName(),
- destination.c_str(), true);
+ cmInstallTargetGeneratorLocal g1(this, l->GetName(), destination,
+ true);
g1.Generate(os, config, configurationTypes);
// We also skip over the leading slash given by the user.
destination = l->Target->GetRuntimeInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination);
- cmInstallTargetGeneratorLocal g2(this, l->GetName(),
- destination.c_str(), false);
+ cmInstallTargetGeneratorLocal g2(this, l->GetName(), destination,
+ false);
g2.Generate(os, config, configurationTypes);
#else
// Use a target install generator.
- cmInstallTargetGeneratorLocal g(this, l->GetName(),
- destination.c_str(), false);
+ cmInstallTargetGeneratorLocal g(this, l->GetName(), destination,
+ false);
g.Generate(os, config, configurationTypes);
#endif
} break;
@@ -3081,7 +3081,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Include the user-specified post-install script for this target.
if (const char* postinstall = l->GetProperty("POST_INSTALL_SCRIPT")) {
- cmInstallScriptGenerator g(postinstall, false, nullptr, false);
+ cmInstallScriptGenerator g(postinstall, false, "", false);
g.Generate(os, config, configurationTypes);
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 55a9a72..1a6b7b2 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -146,7 +146,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
// out of date.
std::string stampName =
cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles");
- cmSystemTools::MakeDirectory(stampName.c_str());
+ cmSystemTools::MakeDirectory(stampName);
stampName += "/generate.stamp";
cmsys::ofstream stamp(stampName.c_str());
stamp << "# CMake generation timestamp file for this directory.\n";
@@ -257,12 +257,11 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
"--check-stamp-file", stampName });
std::string comment = cmStrCat("Building Custom Rule ", makefileIn);
const char* no_working_directory = nullptr;
- std::string fullpathStampName =
- cmSystemTools::CollapseFullPath(stampName.c_str());
+ std::string fullpathStampName = cmSystemTools::CollapseFullPath(stampName);
this->AddCustomCommandToOutput(fullpathStampName, listFiles, makefileIn,
commandLines, comment.c_str(),
no_working_directory, true, false);
- if (cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str())) {
+ if (cmSourceFile* file = this->Makefile->GetSource(makefileIn)) {
// Finalize the source file path now since we're adding this after
// the generator validated all project-named sources.
file->ResolveFullPath();
@@ -279,7 +278,7 @@ void cmLocalVisualStudio7Generator::WriteConfigurations(
{
fout << "\t<Configurations>\n";
for (std::string const& config : configs) {
- this->WriteConfiguration(fout, config.c_str(), libName, target);
+ this->WriteConfiguration(fout, config, libName, target);
}
fout << "\t</Configurations>\n";
}
@@ -580,7 +579,7 @@ public:
this->Stream << this->LG->EscapeForXML("\n");
}
std::string script = this->LG->ConstructScript(ccg);
- this->Stream << this->LG->EscapeForXML(script.c_str());
+ this->Stream << this->LG->EscapeForXML(script);
}
private:
@@ -733,13 +732,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
: target->GetDirectory(configName);
/* clang-format off */
fout << "\t\t\tOutputDirectory=\""
- << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n";
+ << this->ConvertToXMLOutputPathSingle(outDir) << "\"\n";
/* clang-format on */
}
/* clang-format off */
fout << "\t\t\tIntermediateDirectory=\""
- << this->ConvertToXMLOutputPath(intermediateDir.c_str())
+ << this->ConvertToXMLOutputPath(intermediateDir)
<< "\"\n"
<< "\t\t\tConfigurationType=\"" << configType << "\"\n"
<< "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n"
@@ -788,8 +787,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
} else {
modDir = ".";
}
- fout << "\t\t\t\tModulePath=\""
- << this->ConvertToXMLOutputPath(modDir.c_str())
+ fout << "\t\t\t\tModulePath=\"" << this->ConvertToXMLOutputPath(modDir)
<< "\\$(ConfigurationName)\"\n";
}
targetOptions.OutputAdditionalIncludeDirectories(
@@ -802,7 +800,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
std::string pdb = target->GetCompilePDBPath(configName);
if (!pdb.empty()) {
fout << "\t\t\t\tProgramDataBaseFileName=\""
- << this->ConvertToXMLOutputPathSingle(pdb.c_str()) << "\"\n";
+ << this->ConvertToXMLOutputPathSingle(pdb) << "\"\n";
}
}
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
@@ -879,7 +877,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
fout << "\n\t\t\t\tAdditionalManifestFiles=\"";
for (cmSourceFile const* manifest : manifest_srcs) {
std::string m = manifest->GetFullPath();
- fout << this->ConvertToXMLOutputPath(m.c_str()) << ";";
+ fout << this->ConvertToXMLOutputPath(m) << ";";
}
fout << "\"";
}
@@ -946,7 +944,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
std::string configTypeUpper = cmSystemTools::UpperCase(configName);
std::string linkFlagsConfig = cmStrCat("LINK_FLAGS_", configTypeUpper);
- targetLinkFlags = target->GetProperty(linkFlagsConfig.c_str());
+ targetLinkFlags = target->GetProperty(linkFlagsConfig);
if (targetLinkFlags) {
extraLinkOptions += " ";
extraLinkOptions += targetLinkFlags;
@@ -985,7 +983,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"" << tool << "\"\n";
fout << "\t\t\t\tOutputFile=\""
- << this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n";
+ << this->ConvertToXMLOutputPathSingle(libpath) << "\"/>\n";
break;
}
case cmStateEnums::STATIC_LIBRARY: {
@@ -1015,7 +1013,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
}
fout << "\t\t\t\tOutputFile=\""
- << this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n";
+ << this->ConvertToXMLOutputPathSingle(libpath) << "\"/>\n";
break;
}
case cmStateEnums::SHARED_LIBRARY:
@@ -1057,7 +1055,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
temp =
cmStrCat(target->GetDirectory(configName), '/', targetNames.Output);
fout << "\t\t\t\tOutputFile=\""
- << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
+ << this->ConvertToXMLOutputPathSingle(temp) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
linkOptions.OutputFlagMap(fout, 4);
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
@@ -1066,7 +1064,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
temp =
cmStrCat(target->GetPDBDirectory(configName), '/', targetNames.PDB);
fout << "\t\t\t\tProgramDatabaseFile=\""
- << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
+ << this->ConvertToXMLOutputPathSingle(temp) << "\"\n";
if (targetOptions.IsDebug()) {
fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n";
}
@@ -1078,7 +1076,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
}
std::string stackVar = cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE");
- const char* stackVal = this->Makefile->GetDefinition(stackVar.c_str());
+ const char* stackVal = this->Makefile->GetDefinition(stackVar);
if (stackVal) {
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n";
}
@@ -1086,7 +1084,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact),
'/', targetNames.ImportLibrary);
fout << "\t\t\t\tImportLibrary=\""
- << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"";
+ << this->ConvertToXMLOutputPathSingle(temp) << "\"";
if (this->FortranProject) {
fout << "\n\t\t\t\tLinkDLL=\"true\"";
}
@@ -1132,14 +1130,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
temp =
cmStrCat(target->GetDirectory(configName), '/', targetNames.Output);
fout << "\t\t\t\tOutputFile=\""
- << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
+ << this->ConvertToXMLOutputPathSingle(temp) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
linkOptions.OutputFlagMap(fout, 4);
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories());
fout << "\"\n";
std::string path = this->ConvertToXMLOutputPathSingle(
- target->GetPDBDirectory(configName).c_str());
+ target->GetPDBDirectory(configName));
fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/"
<< targetNames.PDB << "\"\n";
if (targetOptions.IsDebug()) {
@@ -1167,7 +1165,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< "\"\n";
}
std::string stackVar = cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE");
- const char* stackVal = this->Makefile->GetDefinition(stackVar.c_str());
+ const char* stackVal = this->Makefile->GetDefinition(stackVar);
if (stackVal) {
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"";
}
@@ -1175,7 +1173,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact),
'/', targetNames.ImportLibrary);
fout << "\t\t\t\tImportLibrary=\""
- << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
+ << this->ConvertToXMLOutputPathSingle(temp) << "\"/>\n";
break;
}
case cmStateEnums::UTILITY:
@@ -1256,8 +1254,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
for (auto const& lib : libs) {
if (lib.IsPath) {
std::string rel =
- lg->MaybeConvertToRelativePath(currentBinDir, lib.Value.c_str());
- fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
+ lg->MaybeConvertToRelativePath(currentBinDir, lib.Value);
+ fout << lg->ConvertToXMLOutputPath(rel) << " ";
} else if (!lib.Target ||
lib.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
fout << lib.Value << " ";
@@ -1282,7 +1280,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
if (!obj->GetObjectLibrary().empty()) {
std::string const& objFile = obj->GetFullPath();
std::string rel = lg->MaybeConvertToRelativePath(currentBinDir, objFile);
- fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
+ fout << sep << lg->ConvertToXMLOutputPath(rel);
sep = " ";
}
}
@@ -1303,9 +1301,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
}
// Switch to a relative path specification if it is shorter.
- if (cmSystemTools::FileIsFullPath(dir.c_str())) {
- std::string rel =
- this->MaybeConvertToRelativePath(currentBinDir, dir.c_str());
+ if (cmSystemTools::FileIsFullPath(dir)) {
+ std::string rel = this->MaybeConvertToRelativePath(currentBinDir, dir);
if (rel.size() < dir.size()) {
dir = rel;
}
@@ -1314,9 +1311,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// First search a configuration-specific subdirectory and then the
// original directory.
fout << comma
- << this->ConvertToXMLOutputPath(
- (dir + "/$(ConfigurationName)").c_str())
- << "," << this->ConvertToXMLOutputPath(dir.c_str());
+ << this->ConvertToXMLOutputPath(dir + "/$(ConfigurationName)") << ","
+ << this->ConvertToXMLOutputPath(dir);
comma = ",";
}
}
@@ -1518,13 +1514,13 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
for (std::vector<std::string>::iterator j = depends.begin();
j != depends.end(); ++j) {
fc.AdditionalDeps += sep;
- fc.AdditionalDeps += lg->ConvertToXMLOutputPath(j->c_str());
+ fc.AdditionalDeps += lg->ConvertToXMLOutputPath(*j);
sep = ";";
needfc = true;
}
}
- const std::string& linkLanguage = gt->GetLinkerLanguage(config.c_str());
+ const std::string& linkLanguage = gt->GetLinkerLanguage(config);
// If HEADER_FILE_ONLY is set, we must suppress this generation in
// the project file
fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") ||
@@ -1629,7 +1625,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
FCInfo fcinfo(this, target, acs, configs);
fout << "\t\t\t<File\n";
- std::string d = this->ConvertToXMLOutputPathSingle(source.c_str());
+ std::string d = this->ConvertToXMLOutputPathSingle(source);
// Tell MS-Dev what the source is. If the compiler knows how to
// build it, then it will.
fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
@@ -1759,21 +1755,21 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << compileTool << "\"\n"
<< "\t\t\t\t\tAdditionalOptions=\""
- << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n";
+ << this->EscapeForXML(fc.CompileFlags) << "\"/>\n";
}
std::string comment = this->ConstructComment(ccg);
std::string script = this->ConstructScript(ccg);
if (this->FortranProject) {
- cmSystemTools::ReplaceString(script, "$(Configuration)", config.c_str());
+ cmSystemTools::ReplaceString(script, "$(Configuration)", config);
}
/* clang-format off */
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
- << this->EscapeForXML(comment.c_str()) << "\"\n"
+ << this->EscapeForXML(comment) << "\"\n"
<< "\t\t\t\t\tCommandLine=\""
- << this->EscapeForXML(script.c_str()) << "\"\n"
+ << this->EscapeForXML(script) << "\"\n"
<< "\t\t\t\t\tAdditionalDependencies=\"";
/* clang-format on */
if (ccg.GetDepends().empty()) {
@@ -1789,8 +1785,8 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
for (std::string const& d : ccg.GetDepends()) {
// Get the real name of the dependency in case it is a CMake target.
std::string dep;
- if (this->GetRealDependency(d.c_str(), config.c_str(), dep)) {
- fout << this->ConvertToXMLOutputPath(dep.c_str()) << ";";
+ if (this->GetRealDependency(d, config, dep)) {
+ fout << this->ConvertToXMLOutputPath(dep) << ";";
}
}
}
@@ -1802,7 +1798,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
// Write a rule for the output generated by this command.
const char* sep = "";
for (std::string const& output : ccg.GetOutputs()) {
- fout << sep << this->ConvertToXMLOutputPathSingle(output.c_str());
+ fout << sep << this->ConvertToXMLOutputPathSingle(output);
sep = ";";
}
}
@@ -1948,7 +1944,7 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
this->WriteProjectSCC(fout, target);
/* clang-format off */
fout<< "\tKeyword=\"" << keyword << "\">\n"
- << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n"
+ << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n"
<< "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
<< "\t</Platforms>\n";
@@ -1983,7 +1979,7 @@ void cmLocalVisualStudio7Generator::WriteProjectStart(
keyword = "Win32Proj";
}
fout << "\tName=\"" << projLabel << "\"\n";
- fout << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\"\n";
+ fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n";
this->WriteProjectSCC(fout, target);
if (const char* targetFrameworkVersion =
target->GetProperty("VS_DOTNET_TARGET_FRAMEWORK_VERSION")) {
@@ -2037,7 +2033,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
}
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(
- const char* path)
+ const std::string& path)
{
std::string ret =
this->ConvertToOutputFormat(path, cmOutputConverter::SHELL);
@@ -2049,7 +2045,7 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(
}
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(
- const char* path)
+ const std::string& path)
{
std::string ret =
this->ConvertToOutputFormat(path, cmOutputConverter::SHELL);
@@ -2130,8 +2126,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE");
// save the GUID in the cache
this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry(
- guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID",
- cmStateEnums::INTERNAL);
+ guidStoreName, parser.GUID.c_str(), "Stored GUID", cmStateEnums::INTERNAL);
}
std::string cmLocalVisualStudio7Generator::GetTargetDirectory(
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 22a5f9a..745766c 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -101,8 +101,8 @@ private:
void WriteConfiguration(std::ostream& fout, const std::string& configName,
const std::string& libName, cmGeneratorTarget* tgt);
std::string EscapeForXML(const std::string& s);
- std::string ConvertToXMLOutputPath(const char* path);
- std::string ConvertToXMLOutputPathSingle(const char* path);
+ std::string ConvertToXMLOutputPath(const std::string& path);
+ std::string ConvertToXMLOutputPathSingle(const std::string& path);
void OutputTargetRules(std::ostream& fout, const std::string& configName,
cmGeneratorTarget* target,
const std::string& libName);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index dc741d3..668a27d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1748,7 +1748,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
}
this->AddInstallGenerator(cm::make_unique<cmInstallSubdirectoryGenerator>(
- subMf, binPath.c_str(), excludeFromAll));
+ subMf, binPath, excludeFromAll));
}
const std::string& cmMakefile::GetCurrentSourceDirectory() const
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index c8bb1ab..7d676c9 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -71,7 +71,7 @@ protected:
std::string CreateConfigTest(const std::string& config);
std::string CreateConfigTest(std::vector<std::string> const& configs);
- std::string CreateComponentTest(const char* component);
+ std::string CreateComponentTest(const std::string& component);
// Information shared by most generator types.
std::string RuntimeConfigVariable;
diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in
index 5bd3803..76c0000 100644
--- a/Tests/CMakeTests/FileDownloadTest.cmake.in
+++ b/Tests/CMakeTests/FileDownloadTest.cmake.in
@@ -138,9 +138,9 @@ message(STATUS "${status}")
message(STATUS "FileDownload:11")
file(DOWNLOAD
- badhostname.png
+ badhostname.invalid
${dir}/file11.png
- TIMEOUT ${timeout}
+ TIMEOUT 30
STATUS status
)
message(STATUS "${status}")