summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--Modules/FindBZip2.cmake4
-rw-r--r--Modules/FindBoost.cmake3
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake3
-rw-r--r--Modules/FindMPI.cmake2
-rw-r--r--Modules/ProcessorCount.cmake10
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx6
-rw-r--r--Source/CPack/cpack.cxx29
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx16
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx23
-rw-r--r--Source/CursesDialog/CMakeLists.txt4
-rw-r--r--Source/CursesDialog/ccmake.cxx6
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx9
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx21
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx6
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx3
-rw-r--r--Source/cmAddCustomCommandCommand.cxx12
-rw-r--r--Source/cmAddCustomTargetCommand.cxx3
-rw-r--r--Source/cmAlgorithms.h40
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.cxx3
-rw-r--r--Source/cmBuildNameCommand.cxx25
-rw-r--r--Source/cmBuildNameCommand.h16
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmComputeLinkInformation.cxx13
-rw-r--r--Source/cmConditionEvaluator.cxx3
-rw-r--r--Source/cmConfigure.cmake.h.in4
-rw-r--r--Source/cmDefinitions.cxx18
-rw-r--r--Source/cmDefinitions.h8
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx5
-rw-r--r--Source/cmExportBuildFileGenerator.cxx3
-rw-r--r--Source/cmExportCommand.cxx6
-rw-r--r--Source/cmExportInstallFileGenerator.cxx38
-rw-r--r--Source/cmExportInstallFileGenerator.h7
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmFileCopier.cxx21
-rw-r--r--Source/cmFileTimeCache.cxx6
-rw-r--r--Source/cmGeneratorExpressionNode.cxx24
-rw-r--r--Source/cmGeneratorTarget.cxx50
-rw-r--r--Source/cmGlobalGenerator.cxx13
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx12
-rw-r--r--Source/cmGraphVizWriter.cxx3
-rw-r--r--Source/cmInstallExportGenerator.cxx5
-rw-r--r--Source/cmInstallExportGenerator.h1
-rw-r--r--Source/cmInstallTargetGenerator.cxx3
-rw-r--r--Source/cmLinkItem.h5
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx9
-rw-r--r--Source/cmListCommand.cxx15
-rw-r--r--Source/cmLocalGenerator.cxx18
-rw-r--r--Source/cmLocalNinjaGenerator.cxx3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmMakefile.cxx23
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx3
-rw-r--r--Source/cmParseArgumentsCommand.cxx4
-rw-r--r--Source/cmQtAutoGen.cxx4
-rw-r--r--Source/cmQtAutoMocUic.cxx6
-rw-r--r--Source/cmServerProtocol.cxx3
-rw-r--r--Source/cmSourceGroupCommand.cxx5
-rw-r--r--Source/cmState.cxx48
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmSystemTools.cxx3
-rw-r--r--Source/cmUseMangledMesaCommand.cxx3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx9
-rw-r--r--Source/cmXCodeObject.h11
-rw-r--r--Source/cmXCodeScheme.cxx4
-rw-r--r--Source/cmake.cxx8
-rw-r--r--Source/cmcmd.cxx14
-rw-r--r--Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt2
-rw-r--r--Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp3
-rw-r--r--Tests/RunCMake/VS10Project/Dir/foo.cpp3
-rw-r--r--Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp3
-rw-r--r--Tests/RunCMake/VS10Project/Prefixed/bar.cpp3
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake30
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake35
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake25
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake16
-rw-r--r--Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt2
-rwxr-xr-xbootstrap7
84 files changed, 504 insertions, 348 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 2b7c9ae..6f96c22 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -28,7 +28,6 @@ readability-*,\
-readability-implicit-bool-cast,\
-readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\
--readability-isolate-declaration,\
-readability-magic-numbers,\
-readability-named-parameter,\
-readability-redundant-declaration,\
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 309b971..98ab72c 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -45,8 +45,8 @@ set(_BZIP2_PATHS PATHS
find_path(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include)
if (NOT BZIP2_LIBRARIES)
- find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib)
- find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+ find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 libbz2 libbzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+ find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d libbz2d libbzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 25dd397..1f9477b 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1981,7 +1981,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
endif()
else()
set(Boost_${UPPERCOMPONENT}_HEADER ON)
- message(WARNING "No header defined for ${COMPONENT}; skipping header check")
+ message(WARNING "No header defined for ${COMPONENT}; skipping header check "
+ "(note: header-only libraries have no designated component)")
endif()
#
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index 6fc2439..af15d55 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -75,7 +75,8 @@ set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
@CUDA_NVCC_FLAGS_CONFIG@
set(nvcc_flags @nvcc_flags@) # list
-set(CUDA_NVCC_INCLUDE_DIRS "@CUDA_NVCC_INCLUDE_DIRS@") # list (needs to be in quotes to handle spaces properly).
+set(CUDA_NVCC_INCLUDE_DIRS [==[@CUDA_NVCC_INCLUDE_DIRS@]==]) # list (needs to be in lua quotes to address backslashes)
+string(REPLACE "\\" "/" CUDA_NVCC_INCLUDE_DIRS "${CUDA_NVCC_INCLUDE_DIRS}")
set(CUDA_NVCC_COMPILE_DEFINITIONS [==[@CUDA_NVCC_COMPILE_DEFINITIONS@]==]) # list (needs to be in lua quotes see #16510 ).
set(format_flag "@format_flag@") # string
set(cuda_language_flag @cuda_language_flag@) # list
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index a79758f..2779032 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1702,7 +1702,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}")
unset(MPI_${LANG}_COMPILE_FLAGS)
if(MPI_${LANG}_COMPILE_OPTIONS)
- list(JOIN MPI_${LANG}_COMPILE_FLAGS " " MPI_${LANG}_COMPILE_OPTIONS)
+ list(JOIN MPI_${LANG}_COMPILE_OPTIONS " " MPI_${LANG}_COMPILE_FLAGS)
endif()
if(MPI_${LANG}_COMPILE_DEFINITIONS)
foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 8c25256..43ec889 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -168,9 +168,13 @@ function(ProcessorCount var)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE psrinfo_output)
- string(REGEX MATCH "([0-9]+) virtual processor" procs "${psrinfo_output}")
- set(count "${CMAKE_MATCH_1}")
- #message("ProcessorCount: trying psrinfo -p -v '${ProcessorCount_cmd_prvinfo}'")
+ string(REGEX MATCHALL "has [0-9]+ virtual processor" procs "${psrinfo_output}")
+ set(count "")
+ foreach(proc ${procs})
+ string(REGEX MATCH "has ([0-9]+) virtual" res ${proc})
+ math(EXPR count "${count} + ${CMAKE_MATCH_1}")
+ endforeach()
+ #message("ProcessorCount: trying '${ProcessorCount_cmd_psrinfo}' -p -v")
else()
# Sun (systems where uname -X emits "NumCPU" in its output):
find_program(ProcessorCount_cmd_uname uname)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 05e2f7b..25522b9 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 15)
-set(CMake_VERSION_PATCH 20190820)
+set(CMake_VERSION_PATCH 20190822)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 51d284f..5b01ae6 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackWIXGenerator.h"
+#include "cmAlgorithms.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmCryptoHash.h"
@@ -942,9 +943,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
shortcut.workingDirectoryId = directoryId;
shortcuts.insert(cmWIXShortcuts::START_MENU, id, shortcut);
- if (!desktopExecutables.empty() &&
- std::find(desktopExecutables.begin(), desktopExecutables.end(),
- executableName) != desktopExecutables.end()) {
+ if (cmContains(desktopExecutables, executableName)) {
shortcuts.insert(cmWIXShortcuts::DESKTOP, id, shortcut);
}
}
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 961a9d4..7ca343a 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackNSISGenerator.h"
+#include "cmAlgorithms.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
@@ -500,10 +501,7 @@ int cmCPackNSISGenerator::InitializeInternal()
<< ".lnk\"" << std::endl;
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
// if so add a desktop link
- if (!cpackPackageDesktopLinksVector.empty() &&
- std::find(cpackPackageDesktopLinksVector.begin(),
- cpackPackageDesktopLinksVector.end(),
- execName) != cpackPackageDesktopLinksVector.end()) {
+ if (cmContains(cpackPackageDesktopLinksVector, execName)) {
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
str << " CreateShortCut \"$DESKTOP\\" << linkName
<< R"(.lnk" "$INSTDIR\)" << cpackNsisExecutablesDirectory << "\\"
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 3cf0c10..5abf0ab 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -1,20 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmsys/CommandLineArguments.hxx"
-#include "cmsys/Encoding.hxx"
-#include <iostream>
-#include <map>
-#include <sstream>
-#include <stddef.h>
-#include <string>
-#include <utility>
-#include <vector>
-
-#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
-# include "cmsys/ConsoleBuf.hxx"
-#endif
-
#include "cmCPackGenerator.h"
#include "cmCPackGeneratorFactory.h"
#include "cmCPackLog.h"
@@ -29,6 +15,21 @@
#include "cmSystemTools.h"
#include "cmake.h"
+#include "cmsys/CommandLineArguments.hxx"
+#include "cmsys/Encoding.hxx"
+
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
+# include "cmsys/ConsoleBuf.hxx"
+#endif
+
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <stddef.h>
+#include <string>
+#include <utility>
+#include <vector>
+
namespace {
const char* cmDocumentationName[][2] = {
{ nullptr, " cpack - Packaging driver provided by CMake." },
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ae965ea..2d07420 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -173,8 +173,7 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
// Find any failed dependencies for this test. We assume the more common
// scenario has no failed tests, so make it the outer loop.
for (std::string const& f : *this->Failed) {
- if (this->Properties[test]->RequireSuccessDepends.find(f) !=
- this->Properties[test]->RequireSuccessDepends.end()) {
+ if (cmContains(this->Properties[test]->RequireSuccessDepends, f)) {
testRun->AddFailedDependency(f);
}
}
@@ -275,7 +274,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test)
{
// Check for locked resources
for (std::string const& i : this->Properties[test]->LockedResources) {
- if (this->LockedResources.find(i) != this->LockedResources.end()) {
+ if (cmContains(this->LockedResources, i)) {
return false;
}
}
@@ -621,9 +620,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
// In parallel test runs add previously failed tests to the front
// of the cost list and queue other tests for further sorting
for (auto const& t : this->Tests) {
- if (std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(),
- this->Properties[t.first]->Name) !=
- this->LastTestsFailed.end()) {
+ if (cmContains(this->LastTestsFailed, this->Properties[t.first]->Name)) {
// If the test failed last time, it should be run first.
this->SortedTests.push_back(t.first);
alreadySortedTests.insert(t.first);
@@ -662,7 +659,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
TestComparator(this));
for (auto const& j : sortedCopy) {
- if (alreadySortedTests.find(j) == alreadySortedTests.end()) {
+ if (!cmContains(alreadySortedTests, j)) {
this->SortedTests.push_back(j);
alreadySortedTests.insert(j);
}
@@ -694,7 +691,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList()
TestSet alreadySortedTests;
for (int test : presortedList) {
- if (alreadySortedTests.find(test) != alreadySortedTests.end()) {
+ if (cmContains(alreadySortedTests, test)) {
continue;
}
@@ -702,8 +699,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList()
GetAllTestDependencies(test, dependencies);
for (int testDependency : dependencies) {
- if (alreadySortedTests.find(testDependency) ==
- alreadySortedTests.end()) {
+ if (!cmContains(alreadySortedTests, testDependency)) {
alreadySortedTests.insert(testDependency);
this->SortedTests.push_back(testDependency);
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 797d47e..7ae0d26 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -20,6 +20,7 @@
#include "cm_memory.hxx"
+#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestMultiProcessHandler.h"
#include "cmCommand.h"
@@ -715,7 +716,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject)
cmCTestTestProperties& p = *result.Properties;
for (std::string const& l : p.Labels) {
// only use labels found in labels
- if (labels.find(l) != labels.end()) {
+ if (cmContains(labels, l)) {
labelTimes[l] +=
result.ExecutionTime.count() * result.Properties->Processors;
++labelCounts[l];
@@ -857,17 +858,14 @@ void cmCTestTestHandler::ComputeTestList()
if (this->UseUnion) {
// if it is not in the list and not in the regexp then skip
- if ((!this->TestsToRun.empty() &&
- std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) ==
- this->TestsToRun.end()) &&
+ if ((!this->TestsToRun.empty() && !cmContains(this->TestsToRun, cnt)) &&
!tp.IsInBasedOnREOptions) {
continue;
}
} else {
// is this test in the list of tests to run? If not then skip it
if ((!this->TestsToRun.empty() &&
- std::find(this->TestsToRun.begin(), this->TestsToRun.end(),
- inREcnt) == this->TestsToRun.end()) ||
+ !cmContains(this->TestsToRun, inREcnt)) ||
!tp.IsInBasedOnREOptions) {
continue;
}
@@ -896,9 +894,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed()
cnt++;
// if this test is not in our list of tests to run, then skip it.
- if ((!this->TestsToRun.empty() &&
- std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) ==
- this->TestsToRun.end())) {
+ if ((!this->TestsToRun.empty() && !cmContains(TestsToRun, cnt))) {
continue;
}
@@ -1019,8 +1015,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
sIt != setupRange.second; ++sIt) {
const std::string& setupTestName = sIt->second->Name;
tests[i].RequireSuccessDepends.insert(setupTestName);
- if (std::find(tests[i].Depends.begin(), tests[i].Depends.end(),
- setupTestName) == tests[i].Depends.end()) {
+ if (!cmContains(tests[i].Depends, setupTestName)) {
tests[i].Depends.push_back(setupTestName);
}
}
@@ -1127,8 +1122,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
const std::vector<size_t>& indices = cIt->second;
for (size_t index : indices) {
const std::string& reqTestName = tests[index].Name;
- if (std::find(p.Depends.begin(), p.Depends.end(), reqTestName) ==
- p.Depends.end()) {
+ if (!cmContains(p.Depends, reqTestName)) {
p.Depends.push_back(reqTestName);
}
}
@@ -1141,8 +1135,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
const std::vector<size_t>& indices = cIt->second;
for (size_t index : indices) {
const std::string& setupTestName = tests[index].Name;
- if (std::find(p.Depends.begin(), p.Depends.end(), setupTestName) ==
- p.Depends.end()) {
+ if (!cmContains(p.Depends, setupTestName)) {
p.Depends.push_back(setupTestName);
}
}
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index c51b0dd..270b07e 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -23,6 +23,10 @@ include_directories(${CURSES_INCLUDE_PATH})
add_executable(ccmake ${CURSES_SRCS} )
target_link_libraries(ccmake CMakeLib)
if(CMAKE_USE_SYSTEM_FORM)
+ find_path(CURSES_FORM_INCLUDE_DIR NAMES form.h HINTS ${CURSES_INCLUDE_PATH} ${CURSES_INCLUDE_PATH}/ncurses)
+ if(CURSES_FORM_INCLUDE_DIR)
+ target_include_directories(ccmake PRIVATE ${CURSES_FORM_INCLUDE_DIR})
+ endif()
target_link_libraries(ccmake
${CURSES_FORM_LIBRARY}
${CURSES_LIBRARY}
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 7caed0c..ce32898 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -56,7 +56,8 @@ void onsig(int /*unused*/)
cbreak(); /* nl- or cr not needed */
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
refresh();
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
cmCursesForm::CurrentForm->Render(1, 1, x, y);
cmCursesForm::CurrentForm->UpdateStatusBar();
@@ -127,7 +128,8 @@ int main(int argc, char const* const* argv)
signal(SIGWINCH, onsig);
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) {
endwin();
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 4e887d6..95026d5 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -38,7 +38,8 @@ cmCursesLongMessageForm::~cmCursesLongMessageForm()
void cmCursesLongMessageForm::UpdateStatusBar()
{
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
char bar[cmCursesMainForm::MAX_WIDTH];
@@ -81,7 +82,8 @@ void cmCursesLongMessageForm::UpdateStatusBar()
void cmCursesLongMessageForm::PrintKeys()
{
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) {
return;
@@ -98,7 +100,8 @@ void cmCursesLongMessageForm::PrintKeys()
void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
int /*height*/)
{
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
if (this->Form) {
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 9ac80b8..9115a3b 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -320,7 +320,8 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
void cmCursesMainForm::PrintKeys(int process /* = 0 */)
{
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
if (x < cmCursesMainForm::MIN_WIDTH || x < this->InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT) {
@@ -391,7 +392,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
// on the status bar. Designed for a width of 80 chars.
void cmCursesMainForm::UpdateStatusBar(const char* message)
{
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
// If window size is too small, display error and return
if (x < cmCursesMainForm::MIN_WIDTH || x < this->InitialWidth ||
@@ -509,7 +511,8 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog)
int cmCursesMainForm::Configure(int noconfigure)
{
- int xi, yi;
+ int xi;
+ int yi;
getmaxyx(stdscr, yi, xi);
curses_move(1, 1);
@@ -552,7 +555,8 @@ int cmCursesMainForm::Configure(int noconfigure)
if (cmSystemTools::GetErrorOccuredFlag()) {
this->OkToGenerate = false;
}
- int xx, yy;
+ int xx;
+ int yy;
getmaxyx(stdscr, yy, xx);
cmCursesLongMessageForm* msgs =
new cmCursesLongMessageForm(this->Errors,
@@ -581,7 +585,8 @@ int cmCursesMainForm::Configure(int noconfigure)
int cmCursesMainForm::Generate()
{
- int xi, yi;
+ int xi;
+ int yi;
getmaxyx(stdscr, yi, xi);
curses_move(1, 1);
@@ -610,7 +615,8 @@ int cmCursesMainForm::Generate()
}
// reset error condition
cmSystemTools::ResetErrorOccuredFlag();
- int xx, yy;
+ int xx;
+ int yy;
getmaxyx(stdscr, yy, xx);
const char* title = "Messages during last pass.";
if (cmSystemTools::GetErrorOccuredFlag()) {
@@ -707,7 +713,8 @@ void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type,
void cmCursesMainForm::HandleInput()
{
- int x = 0, y = 0;
+ int x = 0;
+ int y = 0;
if (!this->Form) {
return;
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index 5e2a329..26724e7 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -64,7 +64,8 @@ void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm,
bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
WINDOW* w)
{
- int x, y;
+ int x;
+ int y;
FORM* form = fm->GetForm();
// when not in edit mode, edit mode is entered by pressing enter or i (vim
@@ -179,7 +180,8 @@ const char* cmCursesStringWidget::GetValue()
bool cmCursesStringWidget::PrintKeys()
{
- int x, y;
+ int x;
+ int y;
getmaxyx(stdscr, y, x);
if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) {
return false;
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 78a2710..5e8636a 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -210,7 +210,8 @@ void QCMakeCacheModel::clear()
void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
{
- QSet<QCMakeProperty> newProps, newProps2;
+ QSet<QCMakeProperty> newProps;
+ QSet<QCMakeProperty> newProps2;
if (this->ShowNewProperties) {
newProps = props.toSet();
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index e502a64..11d28c2 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -33,10 +33,18 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
}
cmMakefile& mf = status.GetMakefile();
- std::string source, target, main_dependency, working, depfile, job_pool;
+ std::string source;
+ std::string target;
+ std::string main_dependency;
+ std::string working;
+ std::string depfile;
+ std::string job_pool;
std::string comment_buffer;
const char* comment = nullptr;
- std::vector<std::string> depends, outputs, output, byproducts;
+ std::vector<std::string> depends;
+ std::vector<std::string> outputs;
+ std::vector<std::string> output;
+ std::vector<std::string> byproducts;
bool verbatim = false;
bool append = false;
bool uses_terminal = false;
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index f812ab5..c14b745 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -43,7 +43,8 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
cmCustomCommandLines commandLines;
// Accumulate dependencies.
- std::vector<std::string> depends, byproducts;
+ std::vector<std::string> depends;
+ std::vector<std::string> byproducts;
std::string working_directory;
bool verbatim = false;
bool uses_terminal = false;
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index d7ea483..59aa86f 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -14,6 +14,16 @@
#include <utility>
#include <vector>
+template <std::size_t N>
+struct cmOverloadPriority : cmOverloadPriority<N - 1>
+{
+};
+
+template <>
+struct cmOverloadPriority<0>
+{
+};
+
template <typename FwdIt>
FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last)
{
@@ -30,6 +40,34 @@ void cmEraseIf(Container& cont, Predicate pred)
cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end());
}
+template <typename Range, typename Key>
+auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<2>)
+ -> decltype(range.exists(key))
+{
+ return range.exists(key);
+}
+
+template <typename Range, typename Key>
+auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<1>)
+ -> decltype(range.find(key) != range.end())
+{
+ return range.find(key) != range.end();
+}
+
+template <typename Range, typename Key>
+bool cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<0>)
+{
+ using std::begin;
+ using std::end;
+ return std::find(begin(range), end(range), key) != end(range);
+}
+
+template <typename Range, typename Key>
+bool cmContains(Range const& range, Key const& key)
+{
+ return cmContainsImpl(range, key, cmOverloadPriority<2>{});
+}
+
namespace ContainerAlgorithms {
template <typename T>
@@ -176,7 +214,7 @@ ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last)
ForwardIterator result = first;
while (first != last) {
- if (uniq.find(first) == uniq.end()) {
+ if (!cmContains(uniq, first)) {
if (result != first) {
*result = std::move(*first);
}
diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx
index 0c73ac8..7ff8584 100644
--- a/Source/cmBinUtilsMacOSMachOLinker.cxx
+++ b/Source/cmBinUtilsMacOSMachOLinker.cxx
@@ -59,7 +59,8 @@ bool cmBinUtilsMacOSMachOLinker::ScanDependencies(
bool cmBinUtilsMacOSMachOLinker::ScanDependencies(
std::string const& file, std::string const& executablePath)
{
- std::vector<std::string> libs, rpaths;
+ std::vector<std::string> libs;
+ std::vector<std::string> rpaths;
if (!this->Tool->GetFileInfo(file, libs, rpaths)) {
return false;
}
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index ddff686..df94f1d 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -5,21 +5,20 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-// cmBuildNameCommand
-bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmBuildNameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
- const char* cacheValue = this->Makefile->GetDefinition(args[0]);
+ cmMakefile& mf = status.GetMakefile();
+ const char* cacheValue = mf.GetDefinition(args[0]);
if (cacheValue) {
// do we need to correct the value?
cmsys::RegularExpression reg("[()/]");
@@ -28,14 +27,14 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
std::replace(cv.begin(), cv.end(), '/', '_');
std::replace(cv.begin(), cv.end(), '(', '_');
std::replace(cv.begin(), cv.end(), ')', '_');
- this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
- cmStateEnums::STRING);
+ mf.AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
+ cmStateEnums::STRING);
}
return true;
}
std::string buildname = "WinNT";
- if (this->Makefile->GetDefinition("UNIX")) {
+ if (mf.GetDefinition("UNIX")) {
buildname.clear();
cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname);
if (!buildname.empty()) {
@@ -47,14 +46,14 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
}
}
std::string compiler = "${CMAKE_CXX_COMPILER}";
- this->Makefile->ExpandVariablesInString(compiler);
+ mf.ExpandVariablesInString(compiler);
buildname += "-";
buildname += cmSystemTools::GetFilenameName(compiler);
std::replace(buildname.begin(), buildname.end(), '/', '_');
std::replace(buildname.begin(), buildname.end(), '(', '_');
std::replace(buildname.begin(), buildname.end(), ')', '_');
- this->Makefile->AddCacheDefinition(args[0], buildname.c_str(),
- "Name of build.", cmStateEnums::STRING);
+ mf.AddCacheDefinition(args[0], buildname.c_str(), "Name of build.",
+ cmStateEnums::STRING);
return true;
}
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index bd2d146..37a7268 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -8,21 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmBuildNameCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmBuildNameCommand>();
- }
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmBuildNameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index dd9b9a1..ead16d2 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -205,7 +205,7 @@ void GetScriptingCommands(cmState* state)
state->AddBuiltinCommand("write_file", cmWriteFileCommand);
state->AddDisallowedCommand(
- "build_name", cm::make_unique<cmBuildNameCommand>(), cmPolicies::CMP0036,
+ "build_name", cmBuildNameCommand, cmPolicies::CMP0036,
"The build_name command should not be called; see CMP0036.");
state->AddDisallowedCommand(
"use_mangled_mesa", cm::make_unique<cmUseMangledMesaCommand>(),
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 4273383..c87fc80 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmComputeLinkInformation.h"
+#include "cmAlgorithms.h"
#include "cmComputeLinkDepends.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -553,7 +554,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
std::vector<std::string> libsVec;
cmExpandList(libs, libsVec);
for (std::string const& i : libsVec) {
- if (this->ImplicitLinkLibs.find(i) == this->ImplicitLinkLibs.end()) {
+ if (!cmContains(this->ImplicitLinkLibs, i)) {
this->AddItem(i, nullptr);
}
}
@@ -998,8 +999,8 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// For compatibility with CMake 2.4 include the item's directory in
// the linker search path.
if (this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
- this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
- this->OldLinkDirMask.end()) {
+ !cmContains(this->OldLinkDirMask,
+ cmSystemTools::GetFilenamePath(item))) {
this->OldLinkDirItems.push_back(item);
}
@@ -1052,8 +1053,8 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// For compatibility with CMake 2.4 include the item's directory in
// the linker search path.
if (this->OldLinkDirMode &&
- this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
- this->OldLinkDirMask.end()) {
+ !cmContains(this->OldLinkDirMask,
+ cmSystemTools::GetFilenamePath(item))) {
this->OldLinkDirItems.push_back(item);
}
@@ -1072,7 +1073,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
// Check if this item is in an implicit link directory.
std::string dir = cmSystemTools::GetFilenamePath(item);
- if (this->ImplicitLinkDirs.find(dir) == this->ImplicitLinkDirs.end()) {
+ if (!cmContains(this->ImplicitLinkDirs, dir)) {
// Only libraries in implicit link directories are converted to
// pathless items.
return false;
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 3de3253..d72f561 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -3,7 +3,6 @@
#include "cmConditionEvaluator.h"
#include "cmsys/RegularExpression.hxx"
-#include <algorithm>
#include <functional>
#include <sstream>
#include <stdio.h>
@@ -672,7 +671,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
std::vector<std::string> list;
cmExpandList(def2, list, true);
- result = std::find(list.begin(), list.end(), def) != list.end();
+ result = cmContains(list, def);
}
this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2);
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 19b1cd4..4de1c5d 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -26,4 +26,8 @@
#define CM_FALLTHROUGH cmsys_FALLTHROUGH
+#if defined(_WIN32) && !defined(NOMINMAX)
+# define NOMINMAX
+#endif
+
#endif
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index cc38d84..e688890 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -17,7 +17,7 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
{
assert(begin != end);
{
- auto it = begin->Map.find(key);
+ auto it = begin->Map.find(cm::String::borrow(key));
if (it != begin->Map.end()) {
it->second.Used = true;
return it->second;
@@ -39,7 +39,7 @@ const std::string* cmDefinitions::Get(const std::string& key, StackIter begin,
StackIter end)
{
Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
- return def.Exists ? &def.Value : nullptr;
+ return def.Value ? def.Value.str_if_stable() : nullptr;
}
void cmDefinitions::Raise(const std::string& key, StackIter begin,
@@ -52,7 +52,7 @@ bool cmDefinitions::HasKey(const std::string& key, StackIter begin,
StackIter end)
{
for (StackIter it = begin; it != end; ++it) {
- if (it->Map.find(key) != it->Map.end()) {
+ if (it->Map.find(cm::String::borrow(key)) != it->Map.end()) {
return true;
}
}
@@ -68,11 +68,11 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end)
for (auto const& mi : it->Map) {
// Use this key if it is not already set or unset.
if (closure.Map.find(mi.first) == closure.Map.end() &&
- undefined.find(mi.first) == undefined.end()) {
- if (mi.second.Exists) {
+ undefined.find(mi.first.view()) == undefined.end()) {
+ if (mi.second.Value) {
closure.Map.insert(mi);
} else {
- undefined.emplace(mi.first);
+ undefined.emplace(mi.first.view());
}
}
}
@@ -90,8 +90,8 @@ std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
defined.reserve(defined.size() + it->Map.size());
for (auto const& mi : it->Map) {
// Use this key if it is not already set or unset.
- if (bound.emplace(mi.first).second && mi.second.Exists) {
- defined.push_back(mi.first);
+ if (bound.emplace(mi.first.view()).second && mi.second.Value) {
+ defined.push_back(*mi.first.str_if_stable());
}
}
}
@@ -116,7 +116,7 @@ std::vector<std::string> cmDefinitions::UnusedKeys() const
// Consider local definitions.
for (auto const& mi : this->Map) {
if (!mi.second.Used) {
- keys.push_back(mi.first);
+ keys.push_back(*mi.first.str_if_stable());
}
}
return keys;
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 787471a..b4d6419 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -8,7 +8,9 @@
#include "cm_string_view.hxx"
#include "cmLinkedTree.h"
+#include "cmString.hxx"
+#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
@@ -57,16 +59,14 @@ private:
Def() = default;
Def(cm::string_view value)
: Value(value)
- , Exists(true)
{
}
- std::string Value;
- bool Exists = false;
+ cm::String Value;
bool Used = false;
};
static Def NoDef;
- std::unordered_map<std::string, Def> Map;
+ std::unordered_map<cm::String, Def> Map;
static Def const& GetInternal(const std::string& key, StackIter begin,
StackIter end, bool raise);
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 22cc0bc..9b1e15e 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -2,10 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportBuildAndroidMKGenerator.h"
-#include <algorithm>
#include <sstream>
#include <utility>
+#include "cmAlgorithms.h"
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmMakefile.h"
@@ -167,8 +167,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
// Tell the NDK build system if prebuilt static libraries use C++.
if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
cmLinkImplementation const* li = target->GetLinkImplementation(config);
- if (std::find(li->Languages.begin(), li->Languages.end(), "CXX") !=
- li->Languages.end()) {
+ if (cmContains(li->Languages, "CXX")) {
os << "LOCAL_HAS_CPP := true\n";
}
}
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 33806f2..dee50ac 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -16,7 +16,6 @@
#include "cmTargetExport.h"
#include "cmake.h"
-#include <algorithm>
#include <map>
#include <set>
#include <sstream>
@@ -306,7 +305,7 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
const cmExportBuildFileGenerator* exportSet = exp.second;
std::vector<std::string> targets;
exportSet->GetTargets(targets);
- if (std::find(targets.begin(), targets.end(), name) != targets.end()) {
+ if (cmContains(targets, name)) {
exportFiles.push_back(exp.first);
ns = exportSet->GetNamespace();
}
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index a849aa2..598eafe 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -5,11 +5,11 @@
#include "cm_static_string_view.hxx"
#include "cmsys/RegularExpression.hxx"
-#include <algorithm>
#include <map>
#include <sstream>
#include <utility>
+#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
#include "cmExportBuildAndroidMKGenerator.h"
#include "cmExportBuildFileGenerator.h"
@@ -133,9 +133,7 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
}
ExportSet = it->second;
} else if (!arguments.Targets.empty() ||
- std::find(keywordsMissingValue.begin(),
- keywordsMissingValue.end(),
- "TARGETS") != keywordsMissingValue.end()) {
+ cmContains(keywordsMissingValue, "TARGETS")) {
for (std::string const& currentTarget : arguments.Targets) {
if (this->Makefile->IsAlias(currentTarget)) {
std::ostringstream e;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 4bc2d1b..7056577 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -458,10 +458,10 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
{
const std::string name = dependee->GetName();
cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
- std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
- int targetOccurrences = static_cast<int>(namespaces.size());
- if (targetOccurrences == 1) {
- std::string missingTarget = namespaces[0];
+ auto exportInfo = this->FindNamespaces(gg, name);
+ std::vector<std::string> const& exportFiles = exportInfo.first;
+ if (exportFiles.size() == 1) {
+ std::string missingTarget = exportInfo.second;
missingTarget += dependee->GetExportName();
link_libs += missingTarget;
@@ -469,14 +469,16 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
} else {
// All exported targets should be known here and should be unique.
// This is probably user-error.
- this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences);
+ this->ComplainAboutMissingTarget(depender, dependee, exportFiles);
}
}
-std::vector<std::string> cmExportInstallFileGenerator::FindNamespaces(
- cmGlobalGenerator* gg, const std::string& name)
+std::pair<std::vector<std::string>, std::string>
+cmExportInstallFileGenerator::FindNamespaces(cmGlobalGenerator* gg,
+ const std::string& name)
{
- std::vector<std::string> namespaces;
+ std::vector<std::string> exportFiles;
+ std::string ns;
const cmExportSetMap& exportSets = gg->GetExportSets();
for (auto const& expIt : exportSets) {
@@ -496,27 +498,33 @@ std::vector<std::string> cmExportInstallFileGenerator::FindNamespaces(
std::vector<cmInstallExportGenerator const*> const* installs =
exportSet->GetInstallations();
for (cmInstallExportGenerator const* install : *installs) {
- namespaces.push_back(install->GetNamespace());
+ exportFiles.push_back(install->GetDestinationFile());
+ ns = install->GetNamespace();
}
}
}
- return namespaces;
+ return std::make_pair(exportFiles, ns);
}
void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
- cmGeneratorTarget* depender, cmGeneratorTarget* dependee, int occurrences)
+ cmGeneratorTarget* depender, cmGeneratorTarget* dependee,
+ std::vector<std::string> const& exportFiles)
{
std::ostringstream e;
e << "install(EXPORT \"" << this->IEGen->GetExportSet()->GetName()
<< "\" ...) "
<< "includes target \"" << depender->GetName()
<< "\" which requires target \"" << dependee->GetName() << "\" ";
- if (occurrences == 0) {
- e << "that is not in the export set.";
+ if (exportFiles.empty()) {
+ e << "that is not in any export set.";
} else {
- e << "that is not in this export set, but " << occurrences
- << " times in others.";
+ e << "that is not in this export set, but in multiple other export sets: "
+ << cmJoin(exportFiles, ", ") << ".\n";
+ e << "An exported target cannot depend upon another target which is "
+ "exported multiple times. Consider consolidating the exports of the "
+ "\""
+ << dependee->GetName() << "\" target to a single export.";
}
cmSystemTools::Error(e.str());
}
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index cbd6507..fcd1aca 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -12,6 +12,7 @@
#include <map>
#include <set>
#include <string>
+#include <utility>
#include <vector>
class cmGeneratorTarget;
@@ -70,10 +71,10 @@ protected:
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
- int occurrences);
+ std::vector<std::string> const& exportFiles);
- std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
- const std::string& name);
+ std::pair<std::vector<std::string>, std::string> FindNamespaces(
+ cmGlobalGenerator* gg, const std::string& name);
/** Generate the relative import prefix. */
virtual void GenerateImportPrefix(std::ostream&);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4f7eaea..9867f16 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2759,7 +2759,9 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
return false;
}
- std::vector<std::string> deps, unresolvedDeps, conflictingDeps;
+ std::vector<std::string> deps;
+ std::vector<std::string> unresolvedDeps;
+ std::vector<std::string> conflictingDeps;
for (auto const& val : archive.GetResolvedPaths()) {
bool unique = true;
auto it = val.second.begin();
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 1d66050..2e54b88 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -91,7 +91,8 @@ bool cmFileCopier::SetPermissions(const std::string& toFile,
if (!cmSystemTools::SetPermissions(toFile, permissions)) {
std::ostringstream e;
- e << this->Name << " cannot set permissions on \"" << toFile << "\"";
+ e << this->Name << " cannot set permissions on \"" << toFile
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -121,7 +122,8 @@ bool cmFileCopier::ReportMissing(const std::string& fromFile)
{
// The input file does not exist and installation is not optional.
std::ostringstream e;
- e << this->Name << " cannot find \"" << fromFile << "\".";
+ e << this->Name << " cannot find \"" << fromFile
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -514,7 +516,8 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile,
if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
std::ostringstream e;
- e << this->Name << " cannot create symlink \"" << toFile << "\".";
+ e << this->Name << " cannot create symlink \"" << toFile
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -535,7 +538,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
if (!cmSystemTools::ReadSymlink(fromFile, symlinkTarget)) {
std::ostringstream e;
e << this->Name << " cannot read symlink \"" << fromFile
- << "\" to duplicate at \"" << toFile << "\".";
+ << "\" to duplicate at \"" << toFile
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -566,7 +570,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
std::ostringstream e;
e << this->Name << " cannot duplicate symlink \"" << fromFile
- << "\" at \"" << toFile << "\".";
+ << "\" at \"" << toFile
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -595,7 +600,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
if (copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) {
std::ostringstream e;
e << this->Name << " cannot copy file \"" << fromFile << "\" to \""
- << toFile << "\".";
+ << toFile << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -611,7 +616,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
if (!cmFileTimes::Copy(fromFile, toFile)) {
std::ostringstream e;
e << this->Name << " cannot set modification time on \"" << toFile
- << "\"";
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
@@ -648,7 +653,7 @@ bool cmFileCopier::InstallDirectory(const std::string& source,
if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) {
std::ostringstream e;
e << this->Name << " cannot make directory \"" << destination
- << "\": " << cmSystemTools::GetLastSystemError();
+ << "\": " << cmSystemTools::GetLastSystemError() << ".";
this->Status.SetError(e.str());
return false;
}
diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx
index 24d6bf6..0d1dae5 100644
--- a/Source/cmFileTimeCache.cxx
+++ b/Source/cmFileTimeCache.cxx
@@ -38,7 +38,8 @@ bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2,
int* result)
{
// Get the modification time for each file.
- cmFileTime ft1, ft2;
+ cmFileTime ft1;
+ cmFileTime ft2;
if (this->Load(f1, ft1) && this->Load(f2, ft2)) {
// Compare the two modification times.
*result = ft1.Compare(ft2);
@@ -52,7 +53,8 @@ bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2,
bool cmFileTimeCache::DifferS(std::string const& f1, std::string const& f2)
{
// Get the modification time for each file.
- cmFileTime ft1, ft2;
+ cmFileTime ft1;
+ cmFileTime ft2;
if (this->Load(f1, ft1) && this->Load(f2, ft2)) {
// Compare the two modification times.
return ft1.DifferS(ft2);
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 9f761ed..f181132 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -19,11 +19,11 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmString.hxx"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cm_static_string_view.hxx"
-#include "cm_string_view.hxx"
#include "cmake.h"
#include "cmsys/RegularExpression.hxx"
@@ -275,7 +275,8 @@ static const struct InListNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent* /*content*/,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
- std::vector<std::string> values, checkValues;
+ std::vector<std::string> values;
+ std::vector<std::string> checkValues;
bool check = false;
switch (context->LG->GetPolicyStatus(cmPolicies::CMP0085)) {
case cmPolicies::WARN:
@@ -306,10 +307,7 @@ static const struct InListNode : public cmGeneratorExpressionNode
break;
}
- return std::find(values.cbegin(), values.cend(), parameters.front()) ==
- values.cend()
- ? "0"
- : "1";
+ return cmContains(values, parameters.front()) ? "1" : "0";
}
} inListNode;
@@ -347,7 +345,8 @@ static const struct FilterNode : public cmGeneratorExpressionNode
return {};
}
- std::vector<std::string> values, result;
+ std::vector<std::string> values;
+ std::vector<std::string> result;
cmExpandList(parameters.front(), values, true);
std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result),
@@ -915,9 +914,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
if (const char* mapValue =
context->CurrentTarget->GetProperty(mapProp)) {
cmExpandList(cmSystemTools::UpperCase(mapValue), mappedConfigs);
- return std::find(mappedConfigs.begin(), mappedConfigs.end(),
- cmSystemTools::UpperCase(parameters.front())) !=
- mappedConfigs.end()
+ return cmContains(mappedConfigs,
+ cmSystemTools::UpperCase(parameters.front()))
? "1"
: "0";
}
@@ -1109,7 +1107,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
cmGeneratorTarget const* target = nullptr;
- std::string targetName, propertyName;
+ std::string targetName;
+ std::string propertyName;
if (parameters.size() == 2) {
targetName = parameters[0];
@@ -1510,8 +1509,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
const char* standardDefault = context->LG->GetMakefile()->GetDefinition(
"CMAKE_" + lit.first + "_STANDARD_DEFAULT");
for (std::string const& it : lit.second) {
- if (std::find(langAvailable.begin(), langAvailable.end(), it) ==
- langAvailable.end()) {
+ if (!cmContains(langAvailable, it)) {
return "0";
}
if (standardDefault && !*standardDefault) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 4dd1e5b..e62b692 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -526,7 +526,9 @@ std::string cmGeneratorTarget::GetFilePrefix(
return prefix ? prefix : std::string();
}
- std::string prefix, suffix, base;
+ std::string prefix;
+ std::string suffix;
+ std::string base;
this->GetFullNameInternal(config, artifact, prefix, base, suffix);
return prefix;
}
@@ -539,7 +541,9 @@ std::string cmGeneratorTarget::GetFileSuffix(
return suffix ? suffix : std::string();
}
- std::string prefix, suffix, base;
+ std::string prefix;
+ std::string suffix;
+ std::string base;
this->GetFullNameInternal(config, artifact, prefix, base, suffix);
return suffix;
}
@@ -1421,9 +1425,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
cmExpandList(debugProp, debugProperties);
}
- bool debugSources = !this->DebugSourcesDone &&
- std::find(debugProperties.begin(), debugProperties.end(), "SOURCES") !=
- debugProperties.end();
+ bool debugSources =
+ !this->DebugSourcesDone && cmContains(debugProperties, "SOURCES");
if (this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
this->DebugSourcesDone = true;
@@ -2647,7 +2650,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
for (cmSourceFile* sf : sources) {
const std::set<cmGeneratorTarget const*> tgts =
this->GlobalGenerator->GetFilenameTargetDepends(sf);
- if (tgts.find(this->GeneratorTarget) != tgts.end()) {
+ if (cmContains(tgts, this->GeneratorTarget)) {
std::ostringstream e;
e << "Evaluation output file\n \"" << sf->GetFullPath()
<< "\"\ndepends on the sources of a target it is used in. This "
@@ -3072,8 +3075,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
}
bool debugIncludes = !this->DebugIncludesDone &&
- std::find(debugProperties.begin(), debugProperties.end(),
- "INCLUDE_DIRECTORIES") != debugProperties.end();
+ cmContains(debugProperties, "INCLUDE_DIRECTORIES");
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugIncludesDone = true;
@@ -3183,8 +3185,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
}
bool debugOptions = !this->DebugCompileOptionsDone &&
- std::find(debugProperties.begin(), debugProperties.end(),
- "COMPILE_OPTIONS") != debugProperties.end();
+ cmContains(debugProperties, "COMPILE_OPTIONS");
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugCompileOptionsDone = true;
@@ -3230,8 +3231,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
}
bool debugFeatures = !this->DebugCompileFeaturesDone &&
- std::find(debugProperties.begin(), debugProperties.end(),
- "COMPILE_FEATURES") != debugProperties.end();
+ cmContains(debugProperties, "COMPILE_FEATURES");
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugCompileFeaturesDone = true;
@@ -3279,8 +3279,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
}
bool debugDefines = !this->DebugCompileDefinitionsDone &&
- std::find(debugProperties.begin(), debugProperties.end(),
- "COMPILE_DEFINITIONS") != debugProperties.end();
+ cmContains(debugProperties, "COMPILE_DEFINITIONS");
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugCompileDefinitionsDone = true;
@@ -3353,9 +3352,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
cmExpandList(debugProp, debugProperties);
}
- bool debugOptions = !this->DebugLinkOptionsDone &&
- std::find(debugProperties.begin(), debugProperties.end(),
- "LINK_OPTIONS") != debugProperties.end();
+ bool debugOptions =
+ !this->DebugLinkOptionsDone && cmContains(debugProperties, "LINK_OPTIONS");
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugLinkOptionsDone = true;
@@ -3612,8 +3610,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
}
bool debugDirectories = !this->DebugLinkDirectoriesDone &&
- std::find(debugProperties.begin(), debugProperties.end(),
- "LINK_DIRECTORIES") != debugProperties.end();
+ cmContains(debugProperties, "LINK_DIRECTORIES");
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugLinkDirectoriesDone = true;
@@ -4784,9 +4781,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
std::vector<std::string> headPropKeys = tgt->GetPropertyKeys();
- const bool explicitlySet =
- std::find(headPropKeys.begin(), headPropKeys.end(), p) !=
- headPropKeys.end();
+ const bool explicitlySet = cmContains(headPropKeys, p);
const bool impliedByUse = tgt->IsNullImpliedByLinkLibraries(p);
assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet));
@@ -4826,8 +4821,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
std::vector<std::string> propKeys = theTarget->GetPropertyKeys();
- const bool ifaceIsSet = std::find(propKeys.begin(), propKeys.end(),
- interfaceProperty) != propKeys.end();
+ const bool ifaceIsSet = cmContains(propKeys, interfaceProperty);
PropertyType ifacePropContent = getTypedProperty<PropertyType>(
theTarget, interfaceProperty, genexInterpreter.get());
@@ -5112,9 +5106,8 @@ void cmGeneratorTarget::ReportPropertyOrigin(
cmExpandList(debugProp, debugProperties);
}
- bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] &&
- std::find(debugProperties.begin(), debugProperties.end(), p) !=
- debugProperties.end();
+ bool debugOrigin =
+ !this->DebugCompatiblePropertiesDone[p] && cmContains(debugProperties, p);
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
this->DebugCompatiblePropertiesDone[p] = true;
@@ -6226,8 +6219,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
bool cmGeneratorTarget::IsNullImpliedByLinkLibraries(
const std::string& p) const
{
- return this->LinkImplicitNullProperties.find(p) !=
- this->LinkImplicitNullProperties.end();
+ return cmContains(this->LinkImplicitNullProperties, p);
}
void cmGeneratorTarget::ComputeLinkImplementationLibraries(
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 80fd234..c815fdb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -368,8 +368,7 @@ bool cmGlobalGenerator::IsExportedTargetsFile(
if (it == this->BuildExportSets.end()) {
return false;
}
- return this->BuildExportExportSets.find(filename) ==
- this->BuildExportExportSets.end();
+ return !cmContains(this->BuildExportExportSets, filename);
}
// Find the make program for the generator, required for try compiles
@@ -497,7 +496,7 @@ void cmGlobalGenerator::EnableLanguage(
if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
} else {
- if (this->LanguagesReady.find(lang) == this->LanguagesReady.end()) {
+ if (!cmContains(this->LanguagesReady, lang)) {
std::ostringstream e;
e << "The test project needs language " << lang
<< " which is not enabled.";
@@ -1096,8 +1095,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
{
// use LanguageToLinkerPreference to detect whether this functions has
// run before
- if (this->LanguageToLinkerPreference.find(l) !=
- this->LanguageToLinkerPreference.end()) {
+ if (cmContains(this->LanguageToLinkerPreference, l)) {
return;
}
@@ -2150,7 +2148,7 @@ void cmGlobalGenerator::AddAlias(const std::string& name,
bool cmGlobalGenerator::IsAlias(const std::string& name) const
{
- return this->AliasTargets.find(name) != this->AliasTargets.end();
+ return cmContains(this->AliasTargets, name);
}
void cmGlobalGenerator::IndexTarget(cmTarget* t)
@@ -2700,8 +2698,7 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
"clean", "edit_cache", "rebuild_cache",
"ZERO_CHECK" };
- return std::find(cm::cbegin(reservedTargets), cm::cend(reservedTargets),
- name) != cm::cend(reservedTargets);
+ return cmContains(reservedTargets, name);
}
void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 5aae546..3397e95 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalGhsMultiGenerator.h"
+#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
@@ -586,16 +587,14 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand(
/* if multiple top-projects are found in build directory
* then prefer projectName top-project.
*/
- auto p = std::find(files.begin(), files.end(), proj);
- if (p == files.end()) {
+ if (!cmContains(files, proj)) {
proj = files.at(0);
}
}
makeCommand.Add("-top", proj);
if (!targetNames.empty()) {
- if (std::find(targetNames.begin(), targetNames.end(), "clean") !=
- targetNames.end()) {
+ if (cmContains(targetNames, "clean")) {
makeCommand.Add("-clean");
} else {
for (const auto& tname : targetNames) {
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 29caa16..a457911 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -571,8 +571,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
bool cmGlobalNinjaGenerator::CheckLanguages(
std::vector<std::string> const& languages, cmMakefile* mf) const
{
- if (std::find(languages.begin(), languages.end(), "Fortran") !=
- languages.end()) {
+ if (cmContains(languages, "Fortran")) {
return this->CheckFortran(mf);
}
return true;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 5c057c6..18cf922 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -104,6 +104,9 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const
void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout)
{
+ char utf8bom[] = { char(0xEF), char(0xBB), char(0xBF) };
+ fout.write(utf8bom, 3);
+
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VS9:
fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n";
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 1882f89..8e0d0b5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -354,8 +354,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
projectArg += "proj";
makeCommand.Add(projectArg);
}
- if (std::find(targetNames.begin(), targetNames.end(), "clean") !=
- targetNames.end()) {
+ if (cmContains(targetNames, "clean")) {
makeCommand.Add("clean");
makeCommand.Add("-target", "ALL_BUILD");
} else {
@@ -903,8 +902,7 @@ void cmGlobalXCodeGenerator::AddXCodeProjBuildRule(
target->GetLocalGenerator()->GetCurrentSourceDirectory();
listfile += "/CMakeLists.txt";
cmSourceFile* srcCMakeLists = target->Makefile->GetOrCreateSource(listfile);
- if (std::find(sources.begin(), sources.end(), srcCMakeLists) ==
- sources.end()) {
+ if (!cmContains(sources, srcCMakeLists)) {
sources.push_back(srcCMakeLists);
}
}
@@ -1416,10 +1414,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf)
{
- const std::vector<std::string>& hdrExts =
- this->CMakeInstance->GetHeaderExtensions();
- return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) !=
- hdrExts.end());
+ return cmContains(this->CMakeInstance->GetHeaderExtensions(),
+ sf->GetExtension());
}
cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase(
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 7d0ef83..cae8136 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -74,7 +74,8 @@ std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget(
{
char sep = ';';
std::map<std::string, LinkLibraryScopeType> tokens;
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
const char* pInterfaceLinkLibraries =
Target->GetProperty("INTERFACE_LINK_LIBRARIES");
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index d4562de..9919ce8 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -217,3 +217,8 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
false, this->FilePermissions.c_str(), nullptr, nullptr,
nullptr, indent);
}
+
+std::string cmInstallExportGenerator::GetDestinationFile() const
+{
+ return this->Destination + '/' + this->FileName;
+}
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index c4d252c..e680066 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -41,6 +41,7 @@ public:
const std::string& GetNamespace() const { return this->Namespace; }
std::string const& GetDestination() const { return this->Destination; }
+ std::string GetDestinationFile() const;
protected:
void GenerateScript(std::ostream& os) override;
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index ed1c80a..7bc9fdf 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -688,7 +688,8 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
std::string installNameTool =
mf->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
- std::vector<std::string> oldRuntimeDirs, newRuntimeDirs;
+ std::vector<std::string> oldRuntimeDirs;
+ std::vector<std::string> newRuntimeDirs;
cli->GetRPath(oldRuntimeDirs, false);
cli->GetRPath(newRuntimeDirs, true);
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index d71ff49..2d9378b 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -5,12 +5,12 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <algorithm>
#include <map>
#include <ostream>
#include <string>
#include <vector>
+#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmSystemTools.h"
#include "cmTargetLinkLibraryType.h"
@@ -120,8 +120,7 @@ inline cmTargetLinkLibraryType CMP0003_ComputeLinkType(
// Check if any entry in the list matches this configuration.
std::string configUpper = cmSystemTools::UpperCase(config);
- if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
- debugConfigs.end()) {
+ if (cmContains(debugConfigs, configUpper)) {
return DEBUG_LibraryType;
}
// The current configuration is not a debug configuration.
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 53b68eb..96af388 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -3,12 +3,11 @@
#include "cmLinkLineDeviceComputer.h"
-#include <algorithm>
#include <set>
#include <sstream>
#include <utility>
-#include <vector>
+#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -186,14 +185,10 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
// Determine if we have any dependencies that require
// us to do a device link step
- const std::string cuda_lang("CUDA");
cmGeneratorTarget::LinkClosure const* closure =
target.GetLinkClosure(config);
- bool closureHasCUDA =
- (std::find(closure->Languages.begin(), closure->Languages.end(),
- cuda_lang) != closure->Languages.end());
- if (closureHasCUDA) {
+ if (cmContains(closure->Languages, "CUDA")) {
cmComputeLinkInformation* pcli = target.GetLinkInformation(config);
if (pcli) {
cmLinkLineDeviceComputer deviceLinkComputer(
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 4db80cd..3c41f4a 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -167,7 +167,7 @@ bool GetList(std::vector<std::string>& list, const std::string& var,
// expand the variable into a list
cmExpandList(listString, list, true);
// if no empty elements then just return
- if (std::find(list.begin(), list.end(), std::string()) == list.end()) {
+ if (!cmContains(list, std::string())) {
return true;
}
// if we have empty elements we need to check policy CMP0007
@@ -751,7 +751,8 @@ public:
}
this->Indexes.resize(size);
- auto start = this->Start, step = this->Step;
+ auto start = this->Start;
+ auto step = this->Step;
std::generate(this->Indexes.begin(), this->Indexes.end(),
[&start, step]() -> int {
auto r = start;
@@ -974,8 +975,10 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
}
}
- const std::string REGEX{ "REGEX" }, AT{ "AT" }, FOR{ "FOR" },
- OUTPUT_VARIABLE{ "OUTPUT_VARIABLE" };
+ const std::string REGEX{ "REGEX" };
+ const std::string AT{ "AT" };
+ const std::string FOR{ "FOR" };
+ const std::string OUTPUT_VARIABLE{ "OUTPUT_VARIABLE" };
// handle optional arguments
while (args.size() > index) {
@@ -1053,7 +1056,9 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
return false;
}
- int start = 0, stop = 0, step = 1;
+ int start = 0;
+ int stop = 0;
+ int step = 1;
bool valid = true;
try {
std::size_t pos;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 159791e..d3a5535 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -996,8 +996,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// directly. In this case adding -I/usr/include can hide SDK headers so we
// must still exclude it.
if ((lang == "C" || lang == "CXX" || lang == "CUDA") &&
- std::find(impDirVec.begin(), impDirVec.end(), "/usr/include") ==
- impDirVec.end() &&
+ !cmContains(impDirVec, "/usr/include") &&
std::find_if(impDirVec.begin(), impDirVec.end(),
[](std::string const& d) {
return cmHasLiteralSuffix(d, "/usr/include");
@@ -1018,15 +1017,13 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
&lang](std::string const& dir) {
return (
// Do not exclude directories that are not in an excluded set.
- ((implicitSet.find(cmSystemTools::GetRealPath(dir)) ==
- implicitSet.end()) &&
- (implicitExclude.find(dir) == implicitExclude.end()))
+ ((!cmContains(implicitSet, cmSystemTools::GetRealPath(dir))) &&
+ (!cmContains(implicitExclude, dir)))
// Do not exclude entries of the CPATH environment variable even though
// they are implicitly searched by the compiler. They are meant to be
// user-specified directories that can be re-ordered or converted to
// -isystem without breaking real compiler builtin headers.
- || ((lang == "C" || lang == "CXX") &&
- (this->EnvCPATH.find(dir) != this->EnvCPATH.end())));
+ || ((lang == "C" || lang == "CXX") && cmContains(this->EnvCPATH, dir)));
};
// Get the target-specific include directories.
@@ -1036,8 +1033,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// Support putting all the in-project include directories first if
// it is requested by the project.
if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) {
- std::string const &topSourceDir = this->GetState()->GetSourceDirectory(),
- &topBinaryDir = this->GetState()->GetBinaryDirectory();
+ std::string const& topSourceDir = this->GetState()->GetSourceDirectory();
+ std::string const& topBinaryDir = this->GetState()->GetBinaryDirectory();
for (BT<std::string> const& udr : userDirs) {
// Emit this directory only if it is a subdirectory of the
// top-level source or binary tree.
@@ -1073,8 +1070,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
if (!stripImplicitDirs) {
// Append implicit directories that were requested by the user only
for (BT<std::string> const& udr : userDirs) {
- if (implicitSet.find(cmSystemTools::GetRealPath(udr.Value)) !=
- implicitSet.end()) {
+ if (cmContains(implicitSet, cmSystemTools::GetRealPath(udr.Value))) {
emitBT(udr);
}
}
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index ec35551..220553b 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -556,7 +556,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
++j;
for (; j != i->second.end(); ++j) {
- std::vector<std::string> jDeps, depsIntersection;
+ std::vector<std::string> jDeps;
+ std::vector<std::string> depsIntersection;
this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure(*j, jDeps);
std::sort(jDeps.begin(), jDeps.end());
std::set_intersection(ccTargetDeps.begin(), ccTargetDeps.end(),
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 893e14e..6e35e0c 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1538,9 +1538,8 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
const std::string& linkLanguage = gt->GetLinkerLanguage(config.c_str());
// If HEADER_FILE_ONLY is set, we must suppress this generation in
// the project file
- fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") ||
- std::find(acs.Configs.begin(), acs.Configs.end(), ci) ==
- acs.Configs.end();
+ fc.ExcludedFromBuild =
+ sf.GetPropertyAsBool("HEADER_FILE_ONLY") || !cmContains(acs.Configs, ci);
if (fc.ExcludedFromBuild) {
needfc = true;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3c1bc38..0af32eb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1589,7 +1589,7 @@ void cmMakefile::Configure()
allowedCommands.insert("message");
isProblem = false;
for (cmListFileFunction const& func : listFile.Functions) {
- if (allowedCommands.find(func.Name.Lower) == allowedCommands.end()) {
+ if (!cmContains(allowedCommands, func.Name.Lower)) {
isProblem = true;
break;
}
@@ -4018,7 +4018,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
bool cmMakefile::IsAlias(const std::string& name) const
{
- if (this->AliasTargets.find(name) != this->AliasTargets.end()) {
+ if (cmContains(this->AliasTargets, name)) {
return true;
}
return this->GetGlobalGenerator()->IsAlias(name);
@@ -4385,8 +4385,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
std::vector<std::string> availableFeatures;
cmExpandList(features, availableFeatures);
- if (std::find(availableFeatures.begin(), availableFeatures.end(), feature) ==
- availableFeatures.end()) {
+ if (!cmContains(availableFeatures, feature)) {
std::ostringstream e;
e << "The compiler feature \"" << feature << "\" is not known to " << lang
<< " compiler\n\""
@@ -4655,31 +4654,31 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propCxx98, props);
- needCxx98 = std::find(props.begin(), props.end(), feature) != props.end();
+ needCxx98 = cmContains(props, feature);
}
if (const char* propCxx11 =
this->GetDefinition("CMAKE_CXX11_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propCxx11, props);
- needCxx11 = std::find(props.begin(), props.end(), feature) != props.end();
+ needCxx11 = cmContains(props, feature);
}
if (const char* propCxx14 =
this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propCxx14, props);
- needCxx14 = std::find(props.begin(), props.end(), feature) != props.end();
+ needCxx14 = cmContains(props, feature);
}
if (const char* propCxx17 =
this->GetDefinition("CMAKE_CXX17_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propCxx17, props);
- needCxx17 = std::find(props.begin(), props.end(), feature) != props.end();
+ needCxx17 = cmContains(props, feature);
}
if (const char* propCxx20 =
this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propCxx20, props);
- needCxx20 = std::find(props.begin(), props.end(), feature) != props.end();
+ needCxx20 = cmContains(props, feature);
}
}
@@ -4779,19 +4778,19 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature,
this->GetDefinition("CMAKE_C90_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propC90, props);
- needC90 = std::find(props.begin(), props.end(), feature) != props.end();
+ needC90 = cmContains(props, feature);
}
if (const char* propC99 =
this->GetDefinition("CMAKE_C99_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propC99, props);
- needC99 = std::find(props.begin(), props.end(), feature) != props.end();
+ needC99 = cmContains(props, feature);
}
if (const char* propC11 =
this->GetDefinition("CMAKE_C11_COMPILE_FEATURES")) {
std::vector<std::string> props;
cmExpandList(propC11, props);
- needC11 = std::find(props.begin(), props.end(), feature) != props.end();
+ needC11 = cmContains(props, feature);
}
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 4ebeb60..15c6580 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -967,7 +967,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
&gt->GetPostBuildCommands()
};
- std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
+ std::vector<std::string> preLinkCmdLines;
+ std::vector<std::string> postBuildCmdLines;
std::vector<std::string>* cmdLineLists[3] = { &preLinkCmdLines,
&preLinkCmdLines,
&postBuildCmdLines };
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 8fca4c0..4f0f92b 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -43,7 +43,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
cmNinjaBuild phonyBuild("phony");
std::vector<std::string> commands;
- cmNinjaDeps deps, util_outputs(1, utilCommandName);
+ cmNinjaDeps deps;
+ cmNinjaDeps util_outputs(1, utilCommandName);
bool uses_terminal = false;
{
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 7560765..2ca3c57 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -116,8 +116,8 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
return false;
}
- std::vector<std::string>::const_iterator argIter = args.begin(),
- argEnd = args.end();
+ std::vector<std::string>::const_iterator argIter = args.begin();
+ std::vector<std::string>::const_iterator argEnd = args.end();
bool parseFromArgV = false;
unsigned long argvStart = 0;
if (*argIter == "PARSE_ARGV") {
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 3026b33..fe04fba 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -53,9 +53,7 @@ void MergeOptions(std::vector<std::string>& baseOpts,
}
}
// Test if this is a value option and change the existing value
- if (!optName.empty() &&
- (std::find(valueOpts.begin(), valueOpts.end(), optName) !=
- valueOpts.end())) {
+ if (!optName.empty() && cmContains(valueOpts, optName)) {
const Iter existItNext(existIt + 1);
const CIter fitNext(fit + 1);
if ((existItNext != baseOpts.end()) && (fitNext != fitEnd)) {
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 2cbf113..7148fc1 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1762,7 +1762,8 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
// Headers
{
// Get file lists
- const char *keyFiles = "AM_HEADERS", *keyFlags = "AM_HEADERS_FLAGS";
+ const char* keyFiles = "AM_HEADERS";
+ const char* keyFlags = "AM_HEADERS_FLAGS";
std::vector<std::string> files = InfoGetList(keyFiles);
std::vector<std::string> flags = InfoGetList(keyFlags);
std::vector<std::string> builds;
@@ -1797,7 +1798,8 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
// Sources
{
- const char *keyFiles = "AM_SOURCES", *keyFlags = "AM_SOURCES_FLAGS";
+ const char* keyFiles = "AM_SOURCES";
+ const char* keyFlags = "AM_SOURCES_FLAGS";
std::vector<std::string> files = InfoGetList(keyFiles);
std::vector<std::string> flags = InfoGetList(keyFlags);
if (!MatchSizes(keyFiles, keyFlags, files.size(), flags.size())) {
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 8fcb710..670161d 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerProtocol.h"
+#include "cmAlgorithms.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
#include "cmGlobalGenerator.h"
@@ -433,7 +434,7 @@ cmServerResponse cmServerProtocol1::ProcessCache(
keys = allKeys;
} else {
for (auto const& i : keys) {
- if (std::find(allKeys.begin(), allKeys.end(), i) == allKeys.end()) {
+ if (!cmContains(allKeys, i)) {
return request.ReportError("Key \"" + i + "\" not found in cache.");
}
}
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 880773b..146e06d 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -2,11 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceGroupCommand.h"
-#include <algorithm>
#include <set>
#include <stddef.h>
#include <utility>
+#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmSourceGroup.h"
#include "cmStringAlgorithms.h"
@@ -140,8 +140,7 @@ cmSourceGroupCommand::getExpectedOptions() const
bool cmSourceGroupCommand::isExpectedOption(
const std::string& argument, const ExpectedOptions& expectedOptions)
{
- return std::find(expectedOptions.begin(), expectedOptions.end(), argument) !=
- expectedOptions.end();
+ return cmContains(expectedOptions, argument);
}
void cmSourceGroupCommand::parseArguments(
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 07f4dec..b6f1808 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -19,6 +19,7 @@
#include "cmGlobVerificationManager.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
@@ -432,6 +433,20 @@ void cmState::AddBuiltinCommand(std::string const& name, Command command)
this->BuiltinCommands.emplace(name, std::move(command));
}
+static bool InvokeBuiltinCommand(cmState::BuiltinCommand command,
+ std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status)
+{
+ cmMakefile& mf = status.GetMakefile();
+ std::vector<std::string> expandedArguments;
+ if (!mf.ExpandArguments(args, expandedArguments)) {
+ // There was an error expanding arguments. It was already
+ // reported, so we can skip this command without error.
+ return true;
+ }
+ return command(expandedArguments, status);
+}
+
void cmState::AddBuiltinCommand(std::string const& name,
BuiltinCommand command)
{
@@ -439,13 +454,34 @@ void cmState::AddBuiltinCommand(std::string const& name,
name,
[command](const std::vector<cmListFileArgument>& args,
cmExecutionStatus& status) -> bool {
- std::vector<std::string> expandedArguments;
- if (!status.GetMakefile().ExpandArguments(args, expandedArguments)) {
- // There was an error expanding arguments. It was already
- // reported, so we can skip this command without error.
- return true;
+ return InvokeBuiltinCommand(command, args, status);
+ });
+}
+
+void cmState::AddDisallowedCommand(std::string const& name,
+ BuiltinCommand command,
+ cmPolicies::PolicyID policy,
+ const char* message)
+{
+ this->AddBuiltinCommand(
+ name,
+ [command, policy, message](const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus& status) -> bool {
+ cmMakefile& mf = status.GetMakefile();
+ switch (mf.GetPolicyStatus(policy)) {
+ case cmPolicies::WARN:
+ mf.IssueMessage(MessageType::AUTHOR_WARNING,
+ cmPolicies::GetPolicyWarning(policy));
+ break;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ mf.IssueMessage(MessageType::FATAL_ERROR, message);
+ return true;
}
- return command(expandedArguments, status);
+ return InvokeBuiltinCommand(command, args, status);
});
}
diff --git a/Source/cmState.h b/Source/cmState.h
index 8847f3b..937ab61 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -157,6 +157,8 @@ public:
std::unique_ptr<cmCommand> command);
void AddBuiltinCommand(std::string const& name, Command command);
void AddBuiltinCommand(std::string const& name, BuiltinCommand command);
+ void AddDisallowedCommand(std::string const& name, BuiltinCommand command,
+ cmPolicies::PolicyID policy, const char* message);
void AddDisallowedCommand(std::string const& name,
std::unique_ptr<cmCommand> command,
cmPolicies::PolicyID policy, const char* message);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3461e67..caaa0a3 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2375,7 +2375,8 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
{
const char* endl = lhss;
const char* endr = rhss;
- unsigned long lhs, rhs;
+ unsigned long lhs;
+ unsigned long rhs;
while (((*endl >= '0') && (*endl <= '9')) ||
((*endr >= '0') && (*endr <= '9'))) {
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 4358194..2b553b0 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -51,7 +51,8 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args,
void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(
const std::string& source, const std::string& outdir)
{
- std::string dir, file;
+ std::string dir;
+ std::string file;
cmSystemTools::SplitProgramPath(source, dir, file);
std::string outFile = outdir;
outFile += "/";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 08378eb..8d4908d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2603,8 +2603,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string langForClCompile;
if (this->ProjectType == csproj) {
langForClCompile = "CSharp";
- } else if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) !=
- cm::cend(clLangs)) {
+ } else if (cmContains(clLangs, linkLanguage)) {
langForClCompile = linkLanguage;
} else {
std::set<std::string> languages;
@@ -3470,8 +3469,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::vector<std::string> libVec;
std::vector<std::string> vsTargetVec;
this->AddLibraries(cli, libVec, vsTargetVec, config);
- if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(),
- "CUDA") != linkClosure->Languages.end() &&
+ if (cmContains(linkClosure->Languages, "CUDA") &&
this->CudaOptions[config] != nullptr) {
switch (this->CudaOptions[config]->GetCudaRuntime()) {
case cmVisualStudioGeneratorOptions::CudaRuntimeStatic:
@@ -3758,8 +3756,7 @@ void cmVisualStudio10TargetGenerator::AddTargetsFileAndConfigPair(
{
for (TargetsFileAndConfigs& i : this->TargetsFileAndConfigsVec) {
if (cmSystemTools::ComparePath(targetsFile, i.File)) {
- if (std::find(i.Configs.begin(), i.Configs.end(), config) ==
- i.Configs.end()) {
+ if (!cmContains(i.Configs, config)) {
i.Configs.push_back(config);
}
return;
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index 51e5d36..0552676 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -12,6 +12,8 @@
#include <utility>
#include <vector>
+#include "cmAlgorithms.h"
+
class cmGeneratorTarget;
class cmXCodeObject
@@ -80,15 +82,10 @@ public:
void SetObject(cmXCodeObject* value) { this->Object = value; }
cmXCodeObject* GetObject() { return this->Object; }
void AddObject(cmXCodeObject* value) { this->List.push_back(value); }
- bool HasObject(cmXCodeObject* o) const
- {
- return !(std::find(this->List.begin(), this->List.end(), o) ==
- this->List.end());
- }
+ bool HasObject(cmXCodeObject* o) const { return cmContains(this->List, o); }
void AddUniqueObject(cmXCodeObject* value)
{
- if (std::find(this->List.begin(), this->List.end(), value) ==
- this->List.end()) {
+ if (!cmContains(this->List, value)) {
this->List.push_back(value);
}
}
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index a565a9c..112d1c1 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -393,9 +393,7 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name)
// Try to find the desired configuration by name,
// and if it's not found return first from the list
//
- if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) ==
- this->ConfigList.end() &&
- !this->ConfigList.empty()) {
+ if (!cmContains(this->ConfigList, name) && !this->ConfigList.empty()) {
return this->ConfigList[0];
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4ed17a3..794119a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -296,7 +296,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
}
- std::string var, value;
+ std::string var;
+ std::string value;
cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
if (cmState::ParseCacheEntry(entry, var, value, type)) {
// The value is transformed if it is a filepath for example, so
@@ -2092,7 +2093,8 @@ void cmake::UpdateConversionPathTable()
". CMake can not open file.");
cmSystemTools::ReportLastSystemError("CMake can not open file.");
} else {
- std::string a, b;
+ std::string a;
+ std::string b;
while (!table.eof()) {
// two entries per line
table >> a;
@@ -2754,7 +2756,7 @@ void cmake::WatchUnusedCli(const std::string& var)
{
#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
- if (this->UsedCliVariables.find(var) == this->UsedCliVariables.end()) {
+ if (!cmContains(this->UsedCliVariables, var)) {
this->UsedCliVariables[var] = false;
}
#endif
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9b8689f..9f4bdda 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -38,10 +38,8 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Process.h"
#include "cmsys/Terminal.h"
-#include <algorithm>
#include <array>
#include <iostream>
-#include <iterator>
#include <memory>
#include <sstream>
#include <stdio.h>
@@ -765,8 +763,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
if (args[1] == "time" && args.size() > 2) {
std::vector<std::string> command(args.begin() + 2, args.end());
- clock_t clock_start, clock_finish;
- time_t time_start, time_finish;
+ clock_t clock_start;
+ clock_t clock_finish;
+ time_t time_start;
+ time_t time_finish;
time(&time_start);
clock_start = clock();
@@ -1074,11 +1074,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
}
} else if (cmHasLiteralPrefix(arg, "--format=")) {
format = arg.substr(9);
- bool isKnown =
- std::find(cm::cbegin(knownFormats), cm::cend(knownFormats),
- format) != cm::cend(knownFormats);
-
- if (!isKnown) {
+ if (!cmContains(knownFormats, format)) {
cmSystemTools::Error("Unknown -E tar --format= argument: " +
format);
return 1;
diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
index f2f0f94..c663707 100644
--- a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
@@ -1 +1 @@
-CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in the export set.
+CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in any export set.
diff --git a/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp b/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp
new file mode 100644
index 0000000..3695dc9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp
@@ -0,0 +1,3 @@
+void foo()
+{
+}
diff --git a/Tests/RunCMake/VS10Project/Dir/foo.cpp b/Tests/RunCMake/VS10Project/Dir/foo.cpp
new file mode 100644
index 0000000..3695dc9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/Dir/foo.cpp
@@ -0,0 +1,3 @@
+void foo()
+{
+}
diff --git a/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp b/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp
new file mode 100644
index 0000000..3695dc9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp
@@ -0,0 +1,3 @@
+void foo()
+{
+}
diff --git a/Tests/RunCMake/VS10Project/Prefixed/bar.cpp b/Tests/RunCMake/VS10Project/Prefixed/bar.cpp
new file mode 100644
index 0000000..b72a1a5
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/Prefixed/bar.cpp
@@ -0,0 +1,3 @@
+void bar()
+{
+}
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 1cb4ce5..5ca069a 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -5,6 +5,7 @@ run_cmake(VsCSharpCompilerOpts)
run_cmake(ExplicitCMakeLists)
run_cmake(RuntimeLibrary)
run_cmake(SourceGroupCMakeLists)
+run_cmake(SourceGroupTreeCMakeLists)
run_cmake(VsConfigurationType)
run_cmake(VsTargetsFileReferences)
diff --git a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake
index c2a94bb..616f38b 100644
--- a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake
+++ b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake
@@ -4,30 +4,8 @@ if(NOT EXISTS "${vcFiltersFile}")
return()
endif()
-set(foundFileFilter 0)
-set(foundFilter 0)
file(STRINGS "${vcFiltersFile}" lines)
-foreach(line IN LISTS lines)
- if(line MATCHES "<Filter>CMakeListsSourceGroup</Filter>")
- set(rule "${CMAKE_MATCH_1}")
- if(foundFileFilter)
- set(RunCMake_TEST_FAILED "Multiple files listed with filter for CMakeListsSourceGroup.")
- return()
- endif()
- set(foundFileFilter 1)
- endif()
- if(line MATCHES "<Filter.*Include=\"CMakeListsSourceGroup\"")
- set(rule "${CMAKE_MATCH_1}")
- if(foundFilter)
- set(RunCMake_TEST_FAILED "Multiple copies of CMakeListsSourceGroup filter listed.")
- return()
- endif()
- set(foundFilter 1)
- endif()
-endforeach()
-if(NOT foundFileFilter)
- set(RunCMake_TEST_FAILED "File filter for CMakeListsSourceGroup not found.")
-endif()
-if(NOT foundFilter)
- set(RunCMake_TEST_FAILED "Filter CMakeListsSourceGroup not found.")
-endif()
+
+include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake)
+
+find_source_group("${lines}" CMakeListsSourceGroup)
diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake
new file mode 100644
index 0000000..c82a66e
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake
@@ -0,0 +1,35 @@
+function(find_source_group LINES NAME)
+ set(foundFileFilter 0)
+ set(foundFilter 0)
+ foreach(line IN LISTS LINES)
+ if(line MATCHES "<Filter>${NAME}</Filter>")
+ if(foundFileFilter)
+ set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+ set(foundFileFilter 1)
+ endif()
+ if(line MATCHES "<Filter.*Include=\"${NAME}\"")
+ if(foundFilter)
+ set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+ set(foundFilter 1)
+ endif()
+ endforeach()
+
+ if(NOT foundFileFilter)
+ set(RunCMake_TEST_FAILED "File filter for ${NAME} not found." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT foundFilter)
+ set(RunCMake_TEST_FAILED "Filter ${NAME} not found." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+
+ set(FILTER_FOUND 1 PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake
new file mode 100644
index 0000000..655120a
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake
@@ -0,0 +1,25 @@
+cmake_policy(SET CMP0011 NEW)
+
+set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupTree.vcxproj.filters")
+if(NOT EXISTS "${vcFiltersFile}")
+ set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.")
+ return()
+endif()
+
+file(STRINGS "${vcFiltersFile}" lines)
+
+include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake)
+
+set(SOURCE_GROUPS_TO_FIND
+ "Dir"
+ "Dir\\DirNested"
+ "SourcesPrefix"
+ "SourcesPrefix\\PrefixedNested"
+)
+
+foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND})
+ find_source_group("${lines}" ${GROUP_NAME})
+ if(NOT ${FILTER_FOUND})
+ return()
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake
new file mode 100644
index 0000000..83c87a9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake
@@ -0,0 +1,16 @@
+set(CMAKE_CONFIGURATION_TYPES Debug)
+
+set(SRC_FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/Dir/foo.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/Dir/DirNested/foo_nested.cpp
+)
+
+set(PREFIXED_SRC_FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed/bar.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed/PrefixedNested/bar_nested.cpp
+)
+
+add_custom_target(SourceGroupTree SOURCES ${SRC_FILES} ${PREFIXED_SRC_FILES})
+
+source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC_FILES})
+source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed PREFIX SourcesPrefix FILES ${PREFIXED_SRC_FILES})
diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt
index 6bb44ab..3204225 100644
--- a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt
+++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt
@@ -1 +1 @@
-CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in the export set.
+CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in any export set.
diff --git a/bootstrap b/bootstrap
index 4581239..eaccfc8 100755
--- a/bootstrap
+++ b/bootstrap
@@ -423,6 +423,7 @@ CMAKE_CXX_SOURCES="\
cmState \
cmStateDirectory \
cmStateSnapshot \
+ cmString \
cmStringAlgorithms \
cmStringReplaceHelper \
cmStringCommand \
@@ -1364,6 +1365,12 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insall
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
+if ${cmake_system_mingw}; then
+ cmake_report cmConfigure.h${_tmp} "#if defined(_WIN32) && !defined(NOMINMAX)"
+ cmake_report cmConfigure.h${_tmp} "# define NOMINMAX"
+ cmake_report cmConfigure.h${_tmp} "#endif"
+fi
+
# Regenerate configured headers
for h in Configure VersionConfig; do
if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then