diff options
-rw-r--r-- | Help/release/dev/mingw-find-no-dll.rst | 6 | ||||
-rw-r--r-- | Modules/CMakeASM_MASMInformation.cmake | 6 | ||||
-rw-r--r-- | Modules/FindGTK2.cmake | 117 | ||||
-rw-r--r-- | Modules/FindMPI.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows-GNU.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 91 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.h | 4 |
9 files changed, 115 insertions, 122 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/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/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); |