summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/Compiler/AppleClang-C.cmake15
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake18
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake31
-rw-r--r--Modules/Compiler/Clang-C.cmake15
-rw-r--r--Modules/Compiler/Clang-CXX.cmake20
-rw-r--r--Modules/Compiler/GNU-C.cmake15
-rw-r--r--Modules/Compiler/GNU-CXX.cmake20
-rw-r--r--Modules/Compiler/Intel-C.cmake17
-rw-r--r--Modules/Compiler/Intel-CXX.cmake18
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake32
-rw-r--r--Modules/Compiler/SunPro-C.cmake15
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake18
-rw-r--r--Modules/FindGSL.cmake11
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx4
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx13
-rw-r--r--Source/CTest/cmCTestGIT.cxx4
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx4
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx8
-rw-r--r--Source/CTest/cmCTestRunTest.cxx3
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx12
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx36
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx78
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx4
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx2
-rw-r--r--Source/cmAddCustomCommandCommand.cxx2
-rw-r--r--Source/cmAddCustomTargetCommand.cxx4
-rw-r--r--Source/cmCTest.cxx19
-rw-r--r--Source/cmCacheManager.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx4
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmDependsC.cxx4
-rw-r--r--Source/cmExportFileGenerator.cxx21
-rw-r--r--Source/cmExportInstallFileGenerator.cxx3
-rw-r--r--Source/cmFindCommon.cxx2
-rw-r--r--Source/cmFindLibraryCommand.cxx2
-rw-r--r--Source/cmFindPackageCommand.cxx3
-rw-r--r--Source/cmFindPathCommand.cxx4
-rw-r--r--Source/cmGeneratorExpression.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx6
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx6
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmInstallCommand.cxx10
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx26
-rw-r--r--Source/cmMSVC60LinkLineComputer.cxx2
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmQtAutoGeneratorCommon.cxx2
-rw-r--r--Source/cmRST.cxx10
-rw-r--r--Source/cmRulePlaceholderExpander.cxx10
-rw-r--r--Source/cmSystemTools.cxx4
-rw-r--r--Source/cmTarget.cxx2
-rw-r--r--Source/cmXCodeObject.cxx4
-rw-r--r--Source/cmakexbuild.cxx5
-rw-r--r--Source/cmcmd.cxx26
-rw-r--r--Source/kwsys/Directory.cxx2
-rw-r--r--Source/kwsys/EncodingCXX.cxx8
-rw-r--r--Source/kwsys/SystemInformation.cxx43
-rw-r--r--Source/kwsys/SystemTools.cxx27
-rw-r--r--Source/kwsys/SystemTools.hxx.in4
-rw-r--r--Source/kwsys/testConsoleBuf.cxx10
-rw-r--r--Source/kwsys/testSystemTools.cxx8
-rw-r--r--Tests/CMakeCommands/target_compile_features/CMakeLists.txt70
-rw-r--r--Tests/CMakeCommands/target_compile_features/dummy.cpp5
-rw-r--r--Tests/CMakeLists.txt13
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt23
-rw-r--r--Tests/CustomCommandByproducts/ninja-check.cmake2
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake5
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake5
-rw-r--r--Utilities/Release/hythloth_release.cmake10
-rw-r--r--Utilities/Release/linux64_release.cmake1
-rwxr-xr-xbootstrap65
80 files changed, 464 insertions, 509 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index c18f541..a48adec 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -13,18 +13,3 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
endif()
__compiler_check_default_language_standard(C 4.0 99)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
- if (_result EQUAL 0)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 904d965..e5fd647 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -28,21 +28,3 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
endif()
__compiler_check_default_language_standard(CXX 4.0 98)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
- if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(17)
- endif()
- if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index cb365d6..684fd30 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -60,3 +60,34 @@ macro(__compiler_check_default_language_standard lang stdver1 std1)
endif ()
unset(__std_ver_pairs)
endmacro()
+
+# Define to allow compile features to be automatically determined
+macro(cmake_record_c_compile_features)
+ set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(11)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_C99_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(99)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_C90_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(90)
+ endif()
+endmacro()
+
+# Define to allow compile features to be automatically determined
+macro(cmake_record_cxx_compile_features)
+ set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(17)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(14)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(11)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX98_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(98)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index b94087f..b881e2b 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -18,18 +18,3 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
endif()
__compiler_check_default_language_standard(C 3.4 99 3.6 11)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if (_result EQUAL 0)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 5904efa..d3707ee 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -36,22 +36,4 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-__compiler_check_default_language_standard(CXX 3.1 98)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
- if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(17)
- endif()
- if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0 AND CMAKE_CXX11_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(CXX 2.1 98)
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 8090fa6..f072c54 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -23,18 +23,3 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
endif()
__compiler_check_default_language_standard(C 3.4 90 5.0 11)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index b221c4a..4f1f30e 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -38,22 +38,4 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-__compiler_check_default_language_standard(CXX 4.4 98 6.0 14)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(17)
- endif()
- if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(CXX 3.4 98 6.0 14)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 20e29e2..4e4af29 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -37,22 +37,7 @@ else()
endif()
-__compiler_check_default_language_standard(C 12.1 90 15.0.0 11)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
- if (_result EQUAL 0 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
- _record_compiler_features_C(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_C(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_C(90)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(C 12.0 90 15.0.0 11)
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 08d23fc..0eb9e1f 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -56,23 +56,5 @@ endif()
__compiler_check_default_language_standard(CXX 12.1 98)
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- if (_result EQUAL 0 AND
- (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0
- OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
- NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)))
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
-
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 8fcfa0f..9371301 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -1,17 +1,21 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
- # MSVC has no specific language level or flags to change it.
+include(Compiler/CMakeCommonCompilerMacros)
+
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
+ # MSVC has no specific options to set language standards, but set them as
+ # empty strings anyways so the feature test infrastructure can at least check
+ # to see if they are defined.
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "")
+
+ # There is no meaningful default for this
set(CMAKE_CXX_STANDARD_DEFAULT "")
endif()
-
-macro(cmake_record_cxx_compile_features)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
- list(APPEND CMAKE_CXX_COMPILE_FEATURES
- cxx_std_98
- cxx_std_11
- cxx_std_14
- cxx_std_17
- )
- _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
- endif()
-endmacro()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index ac88e6f..29c2f22 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -43,20 +43,5 @@ endif()
__compiler_check_default_language_standard(C 5.11 90 5.14 11)
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
- if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
-
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 4b0a21d..5cb7edc 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -43,21 +43,9 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
else()
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport4")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport4")
set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
endif()
-__compiler_check_default_language_standard(CXX 5.13 98)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(CXX 1 98)
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 76059b3..8d10b6c 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -37,9 +37,10 @@
#
# This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL
# headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may
-# optionally provide Release and Debug folders. For Unix-like systems, this
-# script will use ``$GSL_ROOT_DIR/bin/gsl-config`` (if found) to aid in the
-# discovery GSL.
+# optionally provide Release and Debug folders. If available, the libraries
+# named ``gsld``, ``gslblasd`` or ``cblasd`` are recognized as debug libraries.
+# For Unix-like systems, this script will use ``$GSL_ROOT_DIR/bin/gsl-config``
+# (if found) to aid in the discovery of GSL.
#
# Cache Variables
# ^^^^^^^^^^^^^^^
@@ -105,12 +106,12 @@ find_library( GSL_CBLAS_LIBRARY
)
# Do we also have debug versions?
find_library( GSL_LIBRARY_DEBUG
- NAMES gsl
+ NAMES gsld gsl
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Debug
)
find_library( GSL_CBLAS_LIBRARY_DEBUG
- NAMES gslcblas cblas
+ NAMES gslcblasd cblasd gslcblas cblas
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Debug
)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 63eea25..8983057 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170601)
+set(CMake_VERSION_PATCH 20170605)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 3e113d3..d8e2753 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -811,8 +811,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
for (fit = result.begin(); fit != diff; ++fit) {
localFileName =
cmSystemTools::RelativePath(InstallPrefix, fit->c_str());
- localFileName = localFileName.substr(
- localFileName.find_first_not_of('/'), std::string::npos);
+ localFileName =
+ localFileName.substr(localFileName.find_first_not_of('/'));
Components[installComponent].Files.push_back(localFileName);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
<< localFileName << "> to component <"
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index beb2d01..9697a38 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -76,7 +76,7 @@ int cmCPackNSISGenerator::PackageFiles()
}
// Strip off the component part of the path.
- fileN = fileN.substr(pos + 1, std::string::npos);
+ fileN = fileN.substr(pos + 1);
}
std::replace(fileN.begin(), fileN.end(), '/', '\\');
@@ -106,7 +106,7 @@ int cmCPackNSISGenerator::PackageFiles()
componentName = fileN.substr(0, slash);
// Strip off the component part of the path.
- fileN = fileN.substr(slash + 1, std::string::npos);
+ fileN = fileN.substr(slash + 1);
}
}
std::replace(fileN.begin(), fileN.end(), '/', '\\');
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index b6075c9..18ef05c 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -596,10 +596,10 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
// At this point we need to make this->SourceFile relative to
// the source root of the project, so cvs links will work
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
- if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) {
+ if (cm->SourceFile.find("/.../") != std::string::npos) {
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
std::string::size_type p = cm->SourceFile.find('/');
- if (p != cm->SourceFile.npos) {
+ if (p != std::string::npos) {
cm->SourceFile =
cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p);
}
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 87c532c..877cd24 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -103,6 +103,7 @@ public:
return this->PipeState;
}
int GetProcessState() { return this->PipeState; }
+
private:
int PipeState;
cmsysProcess* Process;
@@ -896,7 +897,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
cmsys::ifstream in(files[fileEntry].c_str());
cmSystemTools::GetLineFromStream(in, line);
cmSystemTools::GetLineFromStream(in, line);
- if (line.find("node-jscoverage") != line.npos) {
+ if (line.find("node-jscoverage") != std::string::npos) {
blanketFiles.push_back(files[fileEntry]);
}
}
@@ -1222,7 +1223,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find('#') != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != std::string::npos) {
vec[lineIdx] = 0;
}
}
@@ -1524,7 +1525,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find('#') != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != std::string::npos) {
vec[lineIdx] = 0;
}
}
@@ -2127,7 +2128,7 @@ bool cmCTestCoverageHandler::GetNextInt(std::string const& inputLine,
std::string::size_type start = pos;
pos = inputLine.find(',', start);
value = atoi(inputLine.substr(start, pos).c_str());
- if (pos == inputLine.npos) {
+ if (pos == std::string::npos) {
return true;
}
pos++;
@@ -2141,7 +2142,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
{
// find the first comma
std::string::size_type pos = inputLine.find(',');
- if (pos == inputLine.npos) {
+ if (pos == std::string::npos) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error parsing string : " << inputLine << "\n");
return false;
@@ -2168,7 +2169,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
return false;
}
// should be at the end now
- if (pos != inputLine.npos) {
+ if (pos != std::string::npos) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : "
<< inputLine << " last pos not npos = " << pos << "\n");
}
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 17f822d..230aedf 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -191,9 +191,9 @@ bool cmCTestGIT::UpdateByFetchAndReset()
std::string line;
while (sha1.empty() && cmSystemTools::GetLineFromStream(fin, line)) {
this->Log << "FETCH_HEAD> " << line << "\n";
- if (line.find("\tnot-for-merge\t") == line.npos) {
+ if (line.find("\tnot-for-merge\t") == std::string::npos) {
std::string::size_type pos = line.find('\t');
- if (pos != line.npos) {
+ if (pos != std::string::npos) {
sha1 = line.substr(0, pos);
}
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index fc4980b..c35f0bc 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -801,7 +801,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
bool unlimitedOutput = false;
- if (str.find("CTEST_FULL_OUTPUT") != str.npos ||
+ if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
this->CustomMaximumFailedTestOutputSize == 0) {
unlimitedOutput = true;
}
@@ -953,7 +953,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
std::string& theLine = lines[cc];
// check for command line arguments that are not escaped
// correctly by BC
- if (theLine.find("TargetArgs=") != theLine.npos) {
+ if (theLine.find("TargetArgs=") != std::string::npos) {
// skip this because BC gets it wrong and we can't parse it
} else if (!parser.ParseChunk(theLine.c_str(), theLine.size())) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index fdc16b1..2c16a0d 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -720,9 +720,13 @@ void cmCTestMultiProcessHandler::PrintTestList()
std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex()))
<< indexStr.str(),
this->Quiet);
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, p.Name << std::endl,
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " " << p.Name,
this->Quiet);
+ if (p.Disabled) {
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " (Disabled)",
+ this->Quiet);
+ }
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet);
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index fe23075..0c4269e 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -596,8 +596,7 @@ void cmCTestRunTest::ComputeArguments()
void cmCTestRunTest::DartProcessing()
{
if (!this->ProcessOutput.empty() &&
- this->ProcessOutput.find("<DartMeasurement") !=
- this->ProcessOutput.npos) {
+ this->ProcessOutput.find("<DartMeasurement") != std::string::npos) {
if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
// keep searching and replacing until none are left
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 4aceddb..8d62fa1 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -595,7 +595,7 @@ void cmCTestSubmitHandler::ParseResponse(
std::string output;
output.append(chunk.begin(), chunk.end());
- if (output.find("<cdash") != output.npos) {
+ if (output.find("<cdash") != std::string::npos) {
ResponseParser parser;
parser.Parse(output.c_str());
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index da3ae2f..674be60 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -225,7 +225,7 @@ public:
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
- */
+ */
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
@@ -247,7 +247,7 @@ inline int GetNextNumber(std::string const& in, int& val,
std::string::size_type& pos2)
{
pos2 = in.find(',', pos);
- if (pos2 != in.npos) {
+ if (pos2 != std::string::npos) {
if (pos2 - pos == 0) {
val = -1;
} else {
@@ -273,7 +273,7 @@ inline int GetNextRealNumber(std::string const& in, double& val,
std::string::size_type& pos2)
{
pos2 = in.find(',', pos);
- if (pos2 != in.npos) {
+ if (pos2 != std::string::npos) {
if (pos2 - pos == 0) {
val = -1;
} else {
@@ -1823,7 +1823,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
std::string::size_type pos;
while (cmSystemTools::GetLineFromStream(ifs, line)) {
pos = line.find(':', 0);
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
continue;
}
@@ -2027,7 +2027,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
{
if (!length || length >= output.size() ||
- output.find("CTEST_FULL_OUTPUT") != output.npos) {
+ output.find("CTEST_FULL_OUTPUT") != std::string::npos) {
return true;
}
@@ -2175,7 +2175,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
if (key == "MEASUREMENT") {
size_t pos = val.find_first_of('=');
- if (pos != val.npos) {
+ if (pos != std::string::npos) {
std::string mKey = val.substr(0, pos);
const char* mVal = val.c_str() + pos + 1;
rtit->Measurements[mKey] = mVal;
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index 54bb422..83a7b75 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -22,7 +22,7 @@ public:
virtual ~JSONParser() {}
- std::string getValue(std::string line, int type)
+ std::string getValue(std::string const& line, int type)
{
size_t begIndex;
size_t endIndex;
@@ -35,7 +35,7 @@ public:
line.substr(begIndex + 3, endIndex - (begIndex + 4));
return foundFileName;
}
- return line.substr(begIndex, line.npos);
+ return line.substr(begIndex);
}
bool ParseFile(std::string const& file)
{
@@ -51,13 +51,13 @@ public:
return false;
}
while (cmSystemTools::GetLineFromStream(in, line)) {
- if (line.find("filename") != line.npos) {
+ if (line.find("filename") != std::string::npos) {
if (foundFile) {
/*
- * Upon finding a second file name, generate a
- * vector within the total coverage to capture the
- * information in the local vector
- */
+ * Upon finding a second file name, generate a
+ * vector within the total coverage to capture the
+ * information in the local vector
+ */
FileLinesType& CoverageVector =
this->Coverage.TotalCoverage[filename];
CoverageVector = localCoverageVector;
@@ -66,19 +66,19 @@ public:
foundFile = true;
inSource = false;
filename = getValue(line, 0);
- } else if ((line.find("coverage") != line.npos) && foundFile &&
+ } else if ((line.find("coverage") != std::string::npos) && foundFile &&
inSource) {
/*
- * two types of "coverage" in the JSON structure
- *
- * The coverage result over the file or set of files
- * and the coverage for each individual line
- *
- * FoundFile and foundSource ensure that
- * only the value of the line coverage is captured
- */
+ * two types of "coverage" in the JSON structure
+ *
+ * The coverage result over the file or set of files
+ * and the coverage for each individual line
+ *
+ * FoundFile and foundSource ensure that
+ * only the value of the line coverage is captured
+ */
std::string result = getValue(line, 1);
- result = result.substr(2, result.npos);
+ result = result.substr(2);
if (result == "\"\"") {
// Empty quotation marks indicate that the
// line is not executable
@@ -87,7 +87,7 @@ public:
// Else, it contains the number of time executed
localCoverageVector.push_back(atoi(result.c_str()));
}
- } else if (line.find("source") != line.npos) {
+ } else if (line.find("source") != std::string::npos) {
inSource = true;
}
}
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 9cdd50b..4b781a6 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -42,18 +42,20 @@ public:
size_t beginPos = line.find("begin");
// Check that the begin is the first non-space string on the line
- if ((beginPos == line.find_first_not_of(' ')) && beginPos != line.npos) {
+ if ((beginPos == line.find_first_not_of(' ')) &&
+ beginPos != std::string::npos) {
beginSet.push_back("begin");
coverageVector.push_back(-1);
continue;
}
- if (line.find('{') != line.npos) {
+ if (line.find('{') != std::string::npos) {
blockComFlag = true;
- } else if (line.find('}') != line.npos) {
+ } else if (line.find('}') != std::string::npos) {
blockComFlag = false;
coverageVector.push_back(-1);
continue;
- } else if ((line.find("end;") != line.npos) && !beginSet.empty()) {
+ } else if ((line.find("end;") != std::string::npos) &&
+ !beginSet.empty()) {
beginSet.pop_back();
coverageVector.push_back(-1);
continue;
@@ -62,7 +64,7 @@ public:
// This checks for comments after lines of code, finding the
// comment symbol after the ending semicolon.
comPos = line.find("//");
- if (comPos != line.npos) {
+ if (comPos != std::string::npos) {
semiPos = line.find(';');
if (comPos < semiPos) {
lineComFlag = true;
@@ -91,20 +93,20 @@ public:
size_t pos = 0;
/*
- * This first 'while' section goes through the found HTML
- * file name and attempts to capture the source file name
- * which is set as part of the HTML file name: the name of
- * the file is found in parenthesis '()'
- *
- * See test HTML file name: UTCovTest(UTCovTest.pas).html.
- *
- * Find the text inside each pair of parenthesis and check
- * to see if it ends in '.pas'. If it can't be found,
- * exit the function.
- */
+ * This first 'while' section goes through the found HTML
+ * file name and attempts to capture the source file name
+ * which is set as part of the HTML file name: the name of
+ * the file is found in parenthesis '()'
+ *
+ * See test HTML file name: UTCovTest(UTCovTest.pas).html.
+ *
+ * Find the text inside each pair of parenthesis and check
+ * to see if it ends in '.pas'. If it can't be found,
+ * exit the function.
+ */
while (true) {
lastoffset = line.find('(', pos);
- if (lastoffset == line.npos) {
+ if (lastoffset == std::string::npos) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, endnamepos
<< "File not found " << lastoffset << std::endl,
this->Coverage.Quiet);
@@ -112,7 +114,7 @@ public:
}
endnamepos = line.find(')', lastoffset);
filename = line.substr(lastoffset + 1, (endnamepos - 1) - lastoffset);
- if (filename.find(".pas") != filename.npos) {
+ if (filename.find(".pas") != std::string::npos) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Coverage found for file: " << filename
<< std::endl,
@@ -122,9 +124,9 @@ public:
pos = lastoffset + 1;
}
/*
- * Glob through the source directory for the
- * file found above
- */
+ * Glob through the source directory for the
+ * file found above
+ */
cmsys::Glob gl;
gl.RecurseOn();
gl.RecurseThroughSymlinksOff();
@@ -133,9 +135,9 @@ public:
std::vector<std::string> const& files = gl.GetFiles();
if (files.empty()) {
/*
- * If that doesn't find any matching files
- * return a failure.
- */
+ * If that doesn't find any matching files
+ * return a failure.
+ */
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Unable to find file matching" << glob << std::endl,
this->Coverage.Quiet);
@@ -144,9 +146,9 @@ public:
FileLinesType& coverageVector = this->Coverage.TotalCoverage[files[0]];
/*
- * Initialize the file to have all code between 'begin' and
- * 'end' tags marked as executable
- */
+ * Initialize the file to have all code between 'begin' and
+ * 'end' tags marked as executable
+ */
this->initializeDelphiFile(files[0], coverageVector);
@@ -156,19 +158,19 @@ public:
}
/*
- * Now read the HTML file, looking for the lines that have an
- * "inline" in it. Then parse out the "class" value of that
- * line to determine if the line is executed or not.
- *
- * Sample HTML line:
- *
- * <tr class="covered"><td>47</td><td><pre style="display:inline;">
- * &nbsp;CheckEquals(1,2-1);</pre></td></tr>
- *
- */
+ * Now read the HTML file, looking for the lines that have an
+ * "inline" in it. Then parse out the "class" value of that
+ * line to determine if the line is executed or not.
+ *
+ * Sample HTML line:
+ *
+ * <tr class="covered"><td>47</td><td><pre style="display:inline;">
+ * &nbsp;CheckEquals(1,2-1);</pre></td></tr>
+ *
+ */
while (cmSystemTools::GetLineFromStream(in, line)) {
- if (line.find("inline") == line.npos) {
+ if (line.find("inline") == std::string::npos) {
continue;
}
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 15ef059..e4ee699 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -56,7 +56,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
int lastoffset = 0;
while (cmSystemTools::GetLineFromStream(in, line)) {
// only look at lines that have coverage data
- if (line.find("^ZZCOVERAGE") == line.npos) {
+ if (line.find("^ZZCOVERAGE") == std::string::npos) {
continue;
}
std::string filepath;
@@ -199,7 +199,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
// now parse the right hand side of the =
pos = line.find('=');
// no = found, this is an error
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
return false;
}
pos++; // move past =
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 0fa7aa5..026320a 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -1050,7 +1050,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
const char* curField = lbl->GetValue();
if (curField) {
std::string cfld = cmSystemTools::LowerCase(curField);
- if (cfld.find(str) != cfld.npos && findex != start_index) {
+ if (cfld.find(str) != std::string::npos && findex != start_index) {
break;
}
}
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index a100617..b5e7c9e 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -369,7 +369,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
// Make sure the output file name has no invalid characters.
std::string::size_type pos = o->find_first_of("#<>");
- if (pos != o->npos) {
+ if (pos != std::string::npos) {
std::ostringstream msg;
msg << "called with OUTPUT containing a \"" << (*o)[pos]
<< "\". This character is not allowed.";
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 5db6e09..87e1147 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -27,7 +27,7 @@ bool cmAddCustomTargetCommand::InitialPass(
std::string const& targetName = args[0];
// Check the target name.
- if (targetName.find_first_of("/\\") != targetName.npos) {
+ if (targetName.find_first_of("/\\") != std::string::npos) {
std::ostringstream e;
e << "called with invalid target name \"" << targetName
<< "\". Target names may not contain a slash. "
@@ -144,7 +144,7 @@ bool cmAddCustomTargetCommand::InitialPass(
}
std::string::size_type pos = targetName.find_first_of("#<>");
- if (pos != targetName.npos) {
+ if (pos != std::string::npos) {
std::ostringstream msg;
msg << "called with target name containing a \"" << targetName[pos]
<< "\". This character is not allowed.";
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f469998..e260556 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -119,10 +119,10 @@ std::string cmCTest::CleanString(const std::string& str)
{
std::string::size_type spos = str.find_first_not_of(" \n\t\r\f\v");
std::string::size_type epos = str.find_last_not_of(" \n\t\r\f\v");
- if (spos == str.npos) {
+ if (spos == std::string::npos) {
return std::string();
}
- if (epos != str.npos) {
+ if (epos != std::string::npos) {
epos = epos - spos + 1;
}
return str.substr(spos, epos);
@@ -669,12 +669,11 @@ bool cmCTest::UpdateCTestConfiguration()
continue;
}
std::string::size_type cpos = line.find_first_of(':');
- if (cpos == line.npos) {
+ if (cpos == std::string::npos) {
continue;
}
std::string key = line.substr(0, cpos);
- std::string value =
- cmCTest::CleanString(line.substr(cpos + 1, line.npos));
+ std::string value = cmCTest::CleanString(line.substr(cpos + 1));
this->CTestConfiguration[key] = value;
}
fin.close();
@@ -1241,7 +1240,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
//
const char* disallowed = "\\:*?\"<>|\n\r\t\f\v";
- if (safevalue.find_first_of(disallowed) != value.npos) {
+ if (safevalue.find_first_of(disallowed) != std::string::npos) {
std::string::size_type i = 0;
std::string::size_type n = strlen(disallowed);
char replace[2];
@@ -2349,8 +2348,8 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
cmSystemTools::RelativePath(buildDir.c_str(), fname.c_str());
// If any contains "." it is not parent directory
- bool inSrc = srcRelpath.find("..") == srcRelpath.npos;
- bool inBld = bldRelpath.find("..") == bldRelpath.npos;
+ bool inSrc = srcRelpath.find("..") == std::string::npos;
+ bool inBld = bldRelpath.find("..") == std::string::npos;
// TODO: Handle files with .. in their name
std::string* res = CM_NULLPTR;
@@ -2509,7 +2508,7 @@ void cmCTest::AddSubmitFile(Part part, const char* name)
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
{
size_t epos = overStr.find('=');
- if (epos == overStr.npos) {
+ if (epos == std::string::npos) {
cmCTestLog(this, ERROR_MESSAGE,
"CTest configuration overwrite specified in the wrong format."
<< std::endl
@@ -2518,7 +2517,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
return;
}
std::string key = overStr.substr(0, epos);
- std::string value = overStr.substr(epos + 1, overStr.npos);
+ std::string value = overStr.substr(epos + 1);
this->CTestConfigurationOverwrites[key] = value;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index f7fefca..224cf47 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -387,7 +387,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
{
// support : in key name by double quoting
const char* q =
- (key.find(':') != key.npos || key.find("//") == 0) ? "\"" : "";
+ (key.find(':') != std::string::npos || key.find("//") == 0) ? "\"" : "";
fout << q << key << q;
}
@@ -490,7 +490,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
e.Type = type;
// make sure we only use unix style paths
if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
- if (e.Value.find(';') != e.Value.npos) {
+ if (e.Value.find(';') != std::string::npos) {
std::vector<std::string> paths;
cmSystemTools::ExpandListArgument(e.Value, paths);
const char* sep = "";
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index c2ada43..b2deaaa 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1033,8 +1033,8 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// See documentation of CMP0008.
std::string generator = this->GlobalGenerator->GetName();
if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
- (generator.find("Visual Studio") != generator.npos ||
- generator.find("Xcode") != generator.npos)) {
+ (generator.find("Visual Studio") != std::string::npos ||
+ generator.find("Xcode") != std::string::npos)) {
std::string file = cmSystemTools::GetFilenameName(item);
if (!this->ExtractAnyLibraryName.find(file.c_str())) {
this->HandleBadFullItem(item, file);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index d8ddf45..c461739 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -672,7 +672,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, " \"%s\"", si->c_str());
// Add dependencies on any non-temporary sources.
- if (si->find("CMakeTmp") == si->npos) {
+ if (si->find("CMakeTmp") == std::string::npos) {
this->Makefile->AddCMakeDependFile(*si);
}
}
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 3b84516..2c464cc 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -449,11 +449,11 @@ void cmDependsC::ParseTransform(std::string const& xform)
// A transform rule is of the form SOME_MACRO(%)=value-with-%
// We can simply separate with "(%)=".
std::string::size_type pos = xform.find("(%)=");
- if (pos == xform.npos || pos == 0) {
+ if (pos == std::string::npos || pos == 0) {
return;
}
std::string name = xform.substr(0, pos);
- std::string value = xform.substr(pos + 4, xform.npos);
+ std::string value = xform.substr(pos + 4);
this->TransformRules[name] = value;
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index ae3ec3b..565b84d 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -590,16 +590,17 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
- while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos) {
+ while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) !=
+ std::string::npos) {
std::string::size_type nameStartPos =
pos + sizeof("$<TARGET_PROPERTY:") - 1;
std::string::size_type closePos = input.find('>', nameStartPos);
std::string::size_type commaPos = input.find(',', nameStartPos);
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
- if (commaPos == input.npos // Implied 'this' target
- || closePos == input.npos // Imcomplete expression.
- || closePos < commaPos // Implied 'this' target
- || nextOpenPos < commaPos) // Non-literal
+ if (commaPos == std::string::npos // Implied 'this' target
+ || closePos == std::string::npos // Imcomplete expression.
+ || closePos < commaPos // Implied 'this' target
+ || nextOpenPos < commaPos) // Non-literal
{
lastPos = nameStartPos;
continue;
@@ -617,15 +618,15 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string errorString;
pos = 0;
lastPos = pos;
- while ((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos) {
+ while ((pos = input.find("$<TARGET_NAME:", lastPos)) != std::string::npos) {
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
std::string::size_type endPos = input.find('>', nameStartPos);
- if (endPos == input.npos) {
+ if (endPos == std::string::npos) {
errorString = "$<TARGET_NAME:...> expression incomplete";
break;
}
std::string targetName = input.substr(nameStartPos, endPos - nameStartPos);
- if (targetName.find("$<") != input.npos) {
+ if (targetName.find("$<") != std::string::npos) {
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
"literal.";
break;
@@ -642,10 +643,10 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
pos = 0;
lastPos = pos;
while (errorString.empty() &&
- (pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos) {
+ (pos = input.find("$<LINK_ONLY:", lastPos)) != std::string::npos) {
std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
std::string::size_type endPos = input.find('>', nameStartPos);
- if (endPos == input.npos) {
+ if (endPos == std::string::npos) {
errorString = "$<LINK_ONLY:...> expression incomplete";
break;
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 16bd5e8..664a342 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -255,7 +255,8 @@ void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
- while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) != input.npos) {
+ while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
+ std::string::npos) {
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
lastPos = endPos;
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index e8ae20f..103e692 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -311,7 +311,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
return;
}
if (suffix[0] == '/') {
- suffix = suffix.substr(1, suffix.npos);
+ suffix = suffix.substr(1);
}
if (suffix.empty()) {
return;
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 562a9fc..a6b1a21 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -303,7 +303,7 @@ bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
// Check if a valid library suffix is somewhere in the name,
// this may happen e.g. for versioned shared libraries: libfoo.so.2
suffix += ".";
- if (name.find(suffix) != name.npos) {
+ if (name.find(suffix) != std::string::npos) {
return true;
}
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index f67f353..21ca347 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -326,7 +326,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
} else if (doing == DoingPathSuffixes) {
this->AddPathSuffix(args[i]);
} else if (doing == DoingConfigs) {
- if (args[i].find_first_of(":/\\") != args[i].npos ||
+ if (args[i].find_first_of(":/\\") != std::string::npos ||
cmSystemTools::GetFilenameLastExtension(args[i]) != ".cmake") {
std::ostringstream e;
e << "given CONFIGS option followed by invalid file name \"" << args[i]
@@ -1593,6 +1593,7 @@ class cmFileListGeneratorBase
{
public:
virtual ~cmFileListGeneratorBase() {}
+
protected:
bool Consider(std::string const& fullPath, cmFileList& listing);
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 644b025..d3541ca 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -76,14 +76,14 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
// if there is a / in the name try to find the header as a framework
// For example bar/foo.h would look for:
// bar.framework/Headers/foo.h
- if (pos != fileName.npos) {
+ if (pos != std::string::npos) {
// remove the name from the slash;
fileName = fileName.substr(pos + 1);
frameWorkName = file;
frameWorkName =
frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1);
// if the framework has a path in it then just use the filename
- if (frameWorkName.find('/') != frameWorkName.npos) {
+ if (frameWorkName.find('/') != std::string::npos) {
fileName = file;
frameWorkName = "";
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 570aa6e..00b5ff4 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -126,7 +126,7 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
std::string cmGeneratorExpression::StripEmptyListElements(
const std::string& input)
{
- if (input.find(';') == input.npos) {
+ if (input.find(';') == std::string::npos) {
return input;
}
std::string result;
@@ -161,7 +161,7 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
int nestingLevel = 0;
- while ((pos = input.find("$<", lastPos)) != input.npos) {
+ while ((pos = input.find("$<", lastPos)) != std::string::npos) {
result += input.substr(lastPos, pos - lastPos);
pos += 2;
nestingLevel = 1;
@@ -290,7 +290,7 @@ void cmGeneratorExpression::Split(const std::string& input,
{
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
- while ((pos = input.find("$<", lastPos)) != input.npos) {
+ while ((pos = input.find("$<", lastPos)) != std::string::npos) {
std::string part = input.substr(lastPos, pos - lastPos);
std::string preGenex;
if (!part.empty()) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 073bde2..9a33bec 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5148,11 +5148,11 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
// do the expansion but users link to libraries like " ${VAR} ".
std::string lib = item;
std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
- if (pos != lib.npos) {
- lib = lib.substr(pos, lib.npos);
+ if (pos != std::string::npos) {
+ lib = lib.substr(pos);
}
pos = lib.find_last_not_of(" \t\r\n");
- if (pos != lib.npos) {
+ if (pos != std::string::npos) {
lib = lib.substr(0, pos + 1);
}
if (lib != item) {
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 5915a67..c23684c 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -28,7 +28,7 @@ bool cmGetFilenameComponentCommand::InitialPass(
std::string result;
std::string filename = args[1];
- if (filename.find("[HKEY") != filename.npos) {
+ if (filename.find("[HKEY") != std::string::npos) {
// Check the registry as the target application would view it.
cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
@@ -37,10 +37,10 @@ bool cmGetFilenameComponentCommand::InitialPass(
other_view = cmSystemTools::KeyWOW64_32;
}
cmSystemTools::ExpandRegistryValues(filename, view);
- if (filename.find("/registry") != filename.npos) {
+ if (filename.find("/registry") != std::string::npos) {
std::string other = args[1];
cmSystemTools::ExpandRegistryValues(other, other_view);
- if (other.find("/registry") == other.npos) {
+ if (other.find("/registry") == std::string::npos) {
filename = other;
}
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f3eb249..67e272d 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -306,7 +306,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
// if there are spaces in the make program use short path
// but do not short path the actual program name, as
// this can cause trouble with VSExpress
- if (makeProgram.find(' ') != makeProgram.npos) {
+ if (makeProgram.find(' ') != std::string::npos) {
std::string dir;
std::string file;
cmSystemTools::SplitProgramPath(makeProgram, dir, file);
@@ -2730,7 +2730,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
}
// Get the filename.
- fname = line.substr(33, line.npos);
+ fname = line.substr(33);
// Look for a hash for this file's rule.
std::map<std::string, RuleHash>::const_iterator rhi =
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 39f5d8f..bb0b83a 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -209,7 +209,7 @@ void cmGlobalNinjaGenerator::WriteBuild(
++i) {
build += " " + EncodeIdent(EncodePath(*i), os);
if (this->ComputingUnknownDependencies) {
- this->CombinedBuildOutputs.insert(EncodePath(*i));
+ this->CombinedBuildOutputs.insert(*i);
}
}
if (!implicitOuts.empty()) {
@@ -311,7 +311,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
// we need to track every dependency that comes in, since we are trying
// to find dependencies that are side effects of build commands
for (cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) {
- this->CombinedCustomCommandExplicitDependencies.insert(EncodePath(*i));
+ this->CombinedCustomCommandExplicitDependencies.insert(*i);
}
}
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 84740ca..64616ad 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -170,7 +170,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
std::string::size_type pos;
if (cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0,
0, 0, cmSystemTools::OUTPUT_NONE) &&
- (pos = out.find(".app/"), pos != out.npos)) {
+ (pos = out.find(".app/"), pos != std::string::npos)) {
versionFile = out.substr(0, pos + 5) + "Contents/version.plist";
}
}
@@ -244,7 +244,7 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
- if (ts.find_first_of(",=") != ts.npos) {
+ if (ts.find_first_of(",=") != std::string::npos) {
std::ostringstream e;
/* clang-format off */
e <<
@@ -1400,7 +1400,7 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
std::string retFlag;
std::string::size_type lastOccurancePos = flags.rfind(flag);
bool saved = false;
- while (lastOccurancePos != flags.npos) {
+ while (lastOccurancePos != std::string::npos) {
// increment pos, we use lastOccurancePos to reduce search space on next
// inc
std::string::size_type pos = lastOccurancePos;
@@ -3423,7 +3423,7 @@ std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p)
std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
{
- if (p.find(' ') != p.npos) {
+ if (p.find(' ') != std::string::npos) {
std::string t = "\"";
t += p;
t += "\"";
@@ -3511,7 +3511,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
// Check if the flag needs quoting.
bool quoteFlag =
- flag.find_first_of("`~!@#$%^&*()+={}[]|:;\"'<>,.? ") != flag.npos;
+ flag.find_first_of("`~!@#$%^&*()+={}[]|:;\"'<>,.? ") != std::string::npos;
// We escape a flag as follows:
// - Place each flag in single quotes ''
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index cdb0279..b81f7cb 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -113,7 +113,7 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string& inc)
{
std::string::size_type b = inc.find_first_not_of(" \r");
std::string::size_type e = inc.find_last_not_of(" \r");
- if ((b != inc.npos) && (e != inc.npos)) {
+ if ((b != std::string::npos) && (e != std::string::npos)) {
inc.assign(inc, b, 1 + e - b); // copy the remaining substring
} else {
inc = "";
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 93e467c..f499924 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1210,7 +1210,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode(
// Check the file name.
std::string fname = filename.GetString();
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given invalid export file name \"" << fname << "\". "
<< "The FILE argument may not contain a path. "
@@ -1228,7 +1228,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode(
this->SetError(e.str());
return false;
}
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given export name \"" << exp.GetString() << "\". "
<< "This name cannot be safely converted to a file name. "
@@ -1302,7 +1302,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
// Check the file name.
std::string fname = filename.GetString();
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given invalid export file name \"" << fname << "\". "
<< "The FILE argument may not contain a path. "
@@ -1326,7 +1326,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
fname = exp.GetString();
fname += ".cmake";
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given export name \"" << exp.GetString() << "\". "
<< "This name cannot be safely converted to a file name. "
@@ -1391,7 +1391,7 @@ bool cmInstallCommand::MakeFilesFullPath(
}
// Make sure the file is not a directory.
- if (gpos == file.npos && cmSystemTools::FileIsDirectory(file)) {
+ if (gpos == std::string::npos && cmSystemTools::FileIsDirectory(file)) {
std::ostringstream e;
e << modeName << " given directory \"" << (*fileIt) << "\" to install.";
this->SetError(e.str());
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index e48378d..0418521 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -140,7 +140,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
std::string actualReplace = *replaceIter;
- if (actualReplace.find("${LANG}") != actualReplace.npos) {
+ if (actualReplace.find("${LANG}") != std::string::npos) {
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
}
@@ -1932,7 +1932,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// -DNAME="value" instead of -D"NAME=value" for historical reasons.
std::string::size_type eq = defineIt->find("=");
def += defineIt->substr(0, eq);
- if (eq != defineIt->npos) {
+ if (eq != std::string::npos) {
def += "=";
def += this->EscapeForShell(defineIt->c_str() + eq + 1, true);
}
@@ -2109,7 +2109,7 @@ static bool cmLocalGeneratorShortenObjectName(std::string& objName,
// its own md5 sum.
std::string::size_type pos =
objName.find('/', objName.size() - max_len + 32);
- if (pos != objName.npos) {
+ if (pos != std::string::npos) {
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
std::string md5name = md5.HashString(objName.substr(0, pos));
md5name += objName.substr(pos);
@@ -2460,7 +2460,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
// Many compilers do not support # in the value so we disable it.
- if (define.find_first_of('#') != define.npos) {
+ if (define.find_first_of('#') != std::string::npos) {
std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be "
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 959178e..9b9d22c 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -79,7 +79,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
std::string::size_type dot_pos = in.rfind('.');
if (dot_pos != std::string::npos) {
// Remove the extension first in case &base == &in.
- ext = in.substr(dot_pos, std::string::npos);
+ ext = in.substr(dot_pos);
base = in.substr(0, dot_pos);
} else {
base = in;
@@ -606,7 +606,7 @@ std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
std::string const& cmd)
{
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
- cmd.find_first_of("( )") != cmd.npos) {
+ cmd.find_first_of("( )") != std::string::npos) {
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
// lines with shell redirection operators.
@@ -852,7 +852,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
{
if (this->IsWatcomWMake() && !newFlags.empty()) {
std::string newf = newFlags;
- if (newf.find("\\\"") != newf.npos) {
+ if (newf.find("\\\"") != std::string::npos) {
cmSystemTools::ReplaceString(newf, "\\\"", "\"");
this->cmLocalGenerator::AppendFlags(flags, newf);
return;
@@ -978,11 +978,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
cmSystemTools::ReplaceString(cmd, "/./", "/");
// Convert the command to a relative path only if the current
// working directory will be the start-output directory.
- bool had_slash = cmd.find('/') != cmd.npos;
+ bool had_slash = cmd.find('/') != std::string::npos;
if (workingDir.empty()) {
cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd);
}
- bool has_slash = cmd.find('/') != cmd.npos;
+ bool has_slash = cmd.find('/') != std::string::npos;
if (had_slash && !has_slash) {
// This command was specified as a path to a file in the
// current directory. Add a leading "./" so it can run
@@ -1039,9 +1039,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// curly braces are removed. The hack can be skipped if the
// first curly brace is the last character.
std::string::size_type lcurly = cmd.find('{');
- if (lcurly != cmd.npos && lcurly < (cmd.size() - 1)) {
+ if (lcurly != std::string::npos && lcurly < (cmd.size() - 1)) {
std::string::size_type rcurly = cmd.find('}');
- if (rcurly == cmd.npos || rcurly > lcurly) {
+ if (rcurly == std::string::npos || rcurly > lcurly) {
// The first curly is a left curly. Use the hack.
std::string hack_cmd = cmd.substr(0, lcurly);
hack_cmd += "{{}";
@@ -1200,17 +1200,19 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
}
std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
- const std::string& sin, const std::string& s2)
+ std::string const& s, std::string const& s2)
{
- std::string s = sin;
std::string unmodified = s;
unmodified += s2;
// if there is no restriction on the length of make variables
// and there are no "." characters in the string, then return the
// unmodified combination.
- if ((!this->MakefileVariableSize && unmodified.find('.') == s.npos) &&
- (!this->MakefileVariableSize && unmodified.find('+') == s.npos) &&
- (!this->MakefileVariableSize && unmodified.find('-') == s.npos)) {
+ if ((!this->MakefileVariableSize &&
+ unmodified.find('.') == std::string::npos) &&
+ (!this->MakefileVariableSize &&
+ unmodified.find('+') == std::string::npos) &&
+ (!this->MakefileVariableSize &&
+ unmodified.find('-') == std::string::npos)) {
return unmodified;
}
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
index d761e7b..b5e8511 100644
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -24,7 +24,7 @@ std::string cmMSVC60LinkLineComputer::ConvertToLinkReference(
// Work-ardound command line parsing limitations in MSVC 6.0
// Search for the last space.
std::string::size_type pos = lib.rfind(' ');
- if (pos != lib.npos) {
+ if (pos != std::string::npos) {
// Find the slash after the last space, if any.
pos = lib.find('/', pos);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5af0084..51d8980 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -316,6 +316,7 @@ public:
bool noPolicyScope);
~IncludeScope();
void Quiet() { this->ReportError = false; }
+
private:
cmMakefile* Makefile;
bool NoPolicyScope;
@@ -480,6 +481,7 @@ public:
}
void Quiet() { this->ReportError = false; }
+
private:
cmMakefile* Makefile;
bool ReportError;
@@ -625,7 +627,7 @@ struct file_not_persistent
{
bool operator()(const std::string& path) const
{
- return !(path.find("CMakeTmp") == path.npos &&
+ return !(path.find("CMakeTmp") == std::string::npos &&
cmSystemTools::FileExists(path.c_str()));
}
};
@@ -1347,6 +1349,7 @@ public:
}
void Quiet() { this->ReportError = false; }
+
private:
cmMakefile* Makefile;
cmGlobalGenerator* GG;
@@ -1893,7 +1896,7 @@ cmSourceFile* cmMakefile::LinearGetSourceFileWithOutput(
out = *o;
std::string::size_type pos = out.rfind(name);
// If the output matches exactly
- if (pos != out.npos && pos == out.size() - name.size() &&
+ if (pos != std::string::npos && pos == out.size() - name.size() &&
(pos == 0 || out[pos - 1] == '/')) {
return *i;
}
@@ -2406,7 +2409,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld(
bool removeEmpty, bool replaceAt) const
{
// Fast path strings without any special characters.
- if (source.find_first_of("$@\\") == source.npos) {
+ if (source.find_first_of("$@\\") == std::string::npos) {
return cmake::LOG;
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9c0520e..1aeeb7d 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1287,6 +1287,7 @@ public:
this->CurrentString += this->NextObject;
}
void Done() { this->Strings.push_back(this->CurrentString); }
+
private:
std::string MaybeConvertToRelativePath(std::string const& obj)
{
@@ -1596,7 +1597,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
frameworkPath, linkPath);
linkLibs = frameworkPath + linkPath + linkLibs;
- if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
+ if (useResponseFile &&
+ linkLibs.find_first_not_of(' ') != std::string::npos) {
// Lookup the response file reference flag.
std::string responseFlagVar = "CMAKE_";
responseFlagVar +=
diff --git a/Source/cmQtAutoGeneratorCommon.cxx b/Source/cmQtAutoGeneratorCommon.cxx
index 1807514..3e1b58c 100644
--- a/Source/cmQtAutoGeneratorCommon.cxx
+++ b/Source/cmQtAutoGeneratorCommon.cxx
@@ -16,7 +16,7 @@ static std::string utilStripCR(std::string const& line)
{
// Strip CR characters rcc may have printed (possibly more than one!).
std::string::size_type cr = line.find('\r');
- if (cr != line.npos) {
+ if (cr != std::string::npos) {
return line.substr(0, cr);
}
return line;
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 938cad9..5364f76 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -80,7 +80,7 @@ void cmRST::ProcessModule(std::istream& is)
if (!rst.empty() && rst != "#") {
// Bracket mode: check for end bracket
std::string::size_type pos = line.find(rst);
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
this->ProcessLine(line);
} else {
if (line[0] != '#') {
@@ -98,7 +98,7 @@ void cmRST::ProcessModule(std::istream& is)
continue;
}
if (line.substr(0, 2) == "# ") {
- this->ProcessLine(line.substr(2, line.npos));
+ this->ProcessLine(line.substr(2));
continue;
}
rst = "";
@@ -156,8 +156,8 @@ void cmRST::ProcessLine(std::string const& line)
isspace(line[2]))) {
this->Reset();
this->Markup =
- (line.find_first_not_of(" \t", 2) == line.npos ? MarkupEmpty
- : MarkupNormal);
+ (line.find_first_not_of(" \t", 2) == std::string::npos ? MarkupEmpty
+ : MarkupNormal);
if (this->CMakeDirective.find(line)) {
// Output cmake domain directives and their content normally.
this->NormalLine(line);
@@ -252,7 +252,7 @@ void cmRST::OutputLine(std::string const& line_in, bool inlineMarkup)
// no explicit "(...)" then add "()" to the text.
if (this->CMakeRole.match(2) == "command" &&
this->CMakeRole.match(5).empty() &&
- text.find_first_of("()") == text.npos) {
+ text.find_first_of("()") == std::string::npos) {
text += "()";
}
this->OS << "``" << text << "``";
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index d5d2f67..a71861a 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -155,7 +155,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
// Strip the last extension off the target name.
std::string targetBase = replaceValues.Target;
std::string::size_type pos = targetBase.rfind('.');
- if (pos != targetBase.npos) {
+ if (pos != std::string::npos) {
return targetBase.substr(0, pos);
}
return targetBase;
@@ -270,7 +270,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
std::map<std::string, std::string>::iterator mapIt =
this->VariableMappings.find(variable);
if (mapIt != this->VariableMappings.end()) {
- if (variable.find("_FLAG") == variable.npos) {
+ if (variable.find("_FLAG") == std::string::npos) {
return outputConverter->ConvertToOutputForExisting(mapIt->second);
}
return mapIt->second;
@@ -284,15 +284,15 @@ void cmRulePlaceholderExpander::ExpandRuleVariables(
{
std::string::size_type start = s.find('<');
// no variables to expand
- if (start == s.npos) {
+ if (start == std::string::npos) {
return;
}
std::string::size_type pos = 0;
std::string expandedInput;
- while (start != s.npos && start < s.size() - 2) {
+ while (start != std::string::npos && start < s.size() - 2) {
std::string::size_type end = s.find('>', start);
// if we find a < with no > we are done
- if (end == s.npos) {
+ if (end == std::string::npos) {
return;
}
char c = s[start + 1];
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index dc7034e..f7192e0 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -134,6 +134,7 @@ public:
operator bool() const { return this->handle_ != INVALID_HANDLE_VALUE; }
bool operator!() const { return this->handle_ == INVALID_HANDLE_VALUE; }
operator HANDLE() const { return this->handle_; }
+
private:
HANDLE handle_;
};
@@ -2371,8 +2372,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// not being changed.
rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
rp[rp_count].Value += newRPath;
- rp[rp_count].Value +=
- se[i]->Value.substr(pos + oldRPath.length(), oldRPath.npos);
+ rp[rp_count].Value += se[i]->Value.substr(pos + oldRPath.length());
if (!rp[rp_count].Value.empty()) {
remove_rpath = false;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f675833..c95a3ca 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1476,7 +1476,7 @@ bool cmTarget::CheckImportedLibName(std::string const& prop,
return false;
}
std::string::size_type bad = value.find_first_of(":/\\;");
- if (bad != value.npos) {
+ if (bad != std::string::npos) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR, prop + " property value\n " + value +
"\nmay not contain '" + value.substr(bad, 1) + "'.");
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 3689ac4..0def8c3 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -224,11 +224,11 @@ void cmXCodeObject::PrintString(std::ostream& os, std::string String)
{
// The string needs to be quoted if it contains any characters
// considered special by the Xcode project file parser.
- bool needQuote = (String.empty() || String.find("//") != String.npos ||
+ bool needQuote = (String.empty() || String.find("//") != std::string::npos ||
String.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
- "$_./") != String.npos);
+ "$_./") != std::string::npos);
const char* quote = needQuote ? "\"" : "";
// Print the string, quoted and escaped as necessary.
diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx
index f1f4bbb..72da456 100644
--- a/Source/cmakexbuild.cxx
+++ b/Source/cmakexbuild.cxx
@@ -29,7 +29,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
std::string line;
int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
while (pipe != cmsysProcess_Pipe_None) {
- if (line.find("/bin/sh: bad interpreter: Text file busy") != line.npos) {
+ if (line.find("/bin/sh: bad interpreter: Text file busy") !=
+ std::string::npos) {
hitbug = true;
std::cerr << "Hit xcodebuild bug : " << line << "\n";
}
@@ -37,7 +38,7 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
// because it may contain bogus errors
// also remove all output with setenv in it to tone down
// the verbosity of xcodebuild
- if (!hitbug && (line.find("setenv") == line.npos)) {
+ if (!hitbug && (line.find("setenv") == std::string::npos)) {
if (pipe == cmsysProcess_Pipe_STDERR) {
std::cerr << line << "\n";
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9f2e8b7..d5b0861 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -351,8 +351,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Warn if iwyu reported anything.
- if (stdErr.find("should remove these lines:") != stdErr.npos ||
- stdErr.find("should add these lines:") != stdErr.npos) {
+ if (stdErr.find("should remove these lines:") != std::string::npos ||
+ stdErr.find("should add these lines:") != std::string::npos) {
std::cerr << "Warning: include-what-you-use reported diagnostics:\n"
<< stdErr << "\n";
}
@@ -412,7 +412,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Output the stdout from ldd -r -u to stderr
// Warn if lwyu reported anything.
- if (stdOut.find("Unused direct dependencies:") != stdOut.npos) {
+ if (stdOut.find("Unused direct dependencies:") != std::string::npos) {
std::cerr << "Warning: " << stdOut;
}
}
@@ -480,7 +480,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::cerr << "cmake -E env: unknown option '" << a << "'"
<< std::endl;
return 1;
- } else if (a.find('=') != a.npos) {
+ } else if (a.find('=') != std::string::npos) {
// Set environment variable.
cmSystemTools::PutEnv(a);
} else {
@@ -924,15 +924,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::TarCompressNone;
bool verbose = false;
int nCompress = 0;
- if (flags.find_first_of('j') != flags.npos) {
+ if (flags.find_first_of('j') != std::string::npos) {
compress = cmSystemTools::TarCompressBZip2;
++nCompress;
}
- if (flags.find_first_of('J') != flags.npos) {
+ if (flags.find_first_of('J') != std::string::npos) {
compress = cmSystemTools::TarCompressXZ;
++nCompress;
}
- if (flags.find_first_of('z') != flags.npos) {
+ if (flags.find_first_of('z') != std::string::npos) {
compress = cmSystemTools::TarCompressGZip;
++nCompress;
}
@@ -946,22 +946,22 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
"at most one flag of z, j, or J may be used");
return 1;
}
- if (flags.find_first_of('v') != flags.npos) {
+ if (flags.find_first_of('v') != std::string::npos) {
verbose = true;
}
- if (flags.find_first_of('t') != flags.npos) {
+ if (flags.find_first_of('t') != std::string::npos) {
if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) {
cmSystemTools::Error("Problem listing tar: ", outFile.c_str());
return 1;
}
- } else if (flags.find_first_of('c') != flags.npos) {
+ } else if (flags.find_first_of('c') != std::string::npos) {
if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
verbose, mtime, format)) {
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1;
}
- } else if (flags.find_first_of('x') != flags.npos) {
+ } else if (flags.find_first_of('x') != std::string::npos) {
if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) {
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
return 1;
@@ -1272,7 +1272,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
int result = 0;
while (result == 0 && cmSystemTools::GetLineFromStream(fin, command)) {
// Skip empty command lines.
- if (command.find_first_not_of(" \t") == command.npos) {
+ if (command.find_first_not_of(" \t") == std::string::npos) {
continue;
}
@@ -1420,7 +1420,7 @@ static bool RunCommand(const char* comment, std::vector<std::string>& command,
// it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as
// the banner may be mixed with some other important information.
- if (output.find("Resource Compiler Version") == output.npos || !res ||
+ if (output.find("Resource Compiler Version") == std::string::npos || !res ||
retCode) {
std::cout << output;
}
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index ca1cb18..5141d45 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -109,7 +109,7 @@ bool Directory::Load(const std::string& name)
// Make sure the slashes in the wildcard suffix are consistent with the
// rest of the path
buf = new char[n + 2 + 1];
- if (name.find('\\') != name.npos) {
+ if (name.find('\\') != std::string::npos) {
sprintf(buf, "%s\\*", name.c_str());
} else {
sprintf(buf, "%s/*", name.c_str());
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index 641c0e6..b1e54c9 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -147,11 +147,11 @@ std::wstring Encoding::ToWide(const std::string& str)
wstr += ToWide(str.c_str() + pos);
}
nullPos = str.find('\0', pos);
- if (nullPos != str.npos) {
+ if (nullPos != std::string::npos) {
pos = nullPos + 1;
wstr += wchar_t('\0');
}
- } while (nullPos != str.npos);
+ } while (nullPos != std::string::npos);
#endif
return wstr;
}
@@ -181,11 +181,11 @@ std::string Encoding::ToNarrow(const std::wstring& str)
nstr += ToNarrow(str.c_str() + pos);
}
nullPos = str.find(wchar_t('\0'), pos);
- if (nullPos != str.npos) {
+ if (nullPos != std::string::npos) {
pos = nullPos + 1;
nstr += '\0';
}
- } while (nullPos != str.npos);
+ } while (nullPos != std::string::npos);
#endif
return nstr;
}
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index bfc895e..86fdccd 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -918,7 +918,8 @@ int LoadLines(const char* fileName, std::vector<std::string>& lines)
// ****************************************************************************
template <typename T>
-int NameValue(std::vector<std::string>& lines, std::string name, T& value)
+int NameValue(std::vector<std::string> const& lines, std::string const& name,
+ T& value)
{
size_t nLines = lines.size();
for (size_t i = 0; i < nLines; ++i) {
@@ -1331,7 +1332,7 @@ std::string SymbolProperties::GetFileName(const std::string& path) const
if (!this->ReportPath) {
size_t at = file.rfind("/");
if (at != std::string::npos) {
- file = file.substr(at + 1, std::string::npos);
+ file = file.substr(at + 1);
}
}
return file;
@@ -3341,11 +3342,11 @@ std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(
std::string buffer, const char* word, size_t init)
{
size_t pos = buffer.find(word, init);
- if (pos != buffer.npos) {
+ if (pos != std::string::npos) {
this->CurrentPositionInFile = pos;
pos = buffer.find(":", pos);
size_t pos2 = buffer.find("\n", pos);
- if (pos != buffer.npos && pos2 != buffer.npos) {
+ if (pos != std::string::npos && pos2 != std::string::npos) {
// It may happen that the beginning matches, but this is still not the
// requested key.
// An example is looking for "cpu" when "cpu family" comes first. So we
@@ -3360,7 +3361,7 @@ std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(
return buffer.substr(pos + 2, pos2 - pos - 2);
}
}
- this->CurrentPositionInFile = buffer.npos;
+ this->CurrentPositionInFile = std::string::npos;
return "";
}
@@ -3387,7 +3388,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Number of logical CPUs (combination of multiple processors, multi-core
// and SMT)
size_t pos = buffer.find("processor\t");
- while (pos != buffer.npos) {
+ while (pos != std::string::npos) {
this->NumberOfLogicalCPU++;
pos = buffer.find("processor\t", pos + 1);
}
@@ -3396,7 +3397,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Count sockets.
std::set<int> PhysicalIDs;
std::string idc = this->ExtractValueFromCpuInfoFile(buffer, "physical id");
- while (this->CurrentPositionInFile != buffer.npos) {
+ while (this->CurrentPositionInFile != std::string::npos) {
int id = atoi(idc.c_str());
PhysicalIDs.insert(id);
idc = this->ExtractValueFromCpuInfoFile(buffer, "physical id",
@@ -3506,7 +3507,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->ExtractValueFromCpuInfoFile(buffer, cachename[index]);
if (!cacheSize.empty()) {
pos = cacheSize.find(" KB");
- if (pos != cacheSize.npos) {
+ if (pos != std::string::npos) {
cacheSize = cacheSize.substr(0, pos);
}
this->Features.L1CacheSize += atoi(cacheSize.c_str());
@@ -4585,10 +4586,10 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
const char* word)
{
size_t pos = this->SysCtlBuffer.find(word);
- if (pos != this->SysCtlBuffer.npos) {
+ if (pos != std::string::npos) {
pos = this->SysCtlBuffer.find(": ", pos);
size_t pos2 = this->SysCtlBuffer.find("\n", pos);
- if (pos != this->SysCtlBuffer.npos && pos2 != this->SysCtlBuffer.npos) {
+ if (pos != std::string::npos && pos2 != std::string::npos) {
return this->SysCtlBuffer.substr(pos + 2, pos2 - pos - 2);
}
}
@@ -4660,14 +4661,14 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
args.push_back("-p");
std::string command = arguments;
- size_t start = command.npos;
+ size_t start = std::string::npos;
size_t pos = command.find(' ', 0);
- while (pos != command.npos) {
+ while (pos != std::string::npos) {
bool inQuotes = false;
// Check if we are between quotes
size_t b0 = command.find('"', 0);
size_t b1 = command.find('"', b0 + 1);
- while (b0 != command.npos && b1 != command.npos && b1 > b0) {
+ while (b0 != std::string::npos && b1 != std::string::npos && b1 > b0) {
if (pos > b0 && pos < b1) {
inQuotes = true;
break;
@@ -4681,7 +4682,7 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
// Remove the quotes if any
size_t quotes = arg.find('"');
- while (quotes != arg.npos) {
+ while (quotes != std::string::npos) {
arg.erase(quotes, 1);
quotes = arg.find('"');
}
@@ -4864,11 +4865,11 @@ bool SystemInformationImplementation::QueryQNXMemory()
args.clear();
size_t pos = buffer.find("System RAM:");
- if (pos == buffer.npos)
+ if (pos == std::string::npos)
return false;
pos = buffer.find(":", pos);
size_t pos2 = buffer.find("M (", pos);
- if (pos2 == buffer.npos)
+ if (pos2 == std::string::npos)
return false;
pos++;
@@ -4922,11 +4923,11 @@ bool SystemInformationImplementation::QueryQNXProcessor()
args.clear();
size_t pos = buffer.find("Processor1:");
- if (pos == buffer.npos)
+ if (pos == std::string::npos)
return false;
size_t pos2 = buffer.find("MHz", pos);
- if (pos2 == buffer.npos)
+ if (pos2 == std::string::npos)
return false;
size_t pos3 = pos2;
@@ -4936,9 +4937,9 @@ bool SystemInformationImplementation::QueryQNXProcessor()
this->CPUSpeedInMHz = atoi(buffer.substr(pos3 + 1, pos2 - pos3 - 1).c_str());
pos2 = buffer.find(" Stepping", pos);
- if (pos2 != buffer.npos) {
+ if (pos2 != std::string::npos) {
pos2 = buffer.find(" ", pos2 + 1);
- if (pos2 != buffer.npos && pos2 < pos3) {
+ if (pos2 != std::string::npos && pos2 < pos3) {
this->ChipID.Revision =
atoi(buffer.substr(pos2 + 1, pos3 - pos2).c_str());
}
@@ -4948,7 +4949,7 @@ bool SystemInformationImplementation::QueryQNXProcessor()
do {
pos = buffer.find("\nProcessor", pos + 1);
++this->NumberOfPhysicalCPU;
- } while (pos != buffer.npos);
+ } while (pos != std::string::npos);
this->NumberOfLogicalCPU = 1;
return true;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 5ca382f..1c4fe33 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -22,6 +22,7 @@
#include KWSYS_HEADER(FStream.hxx)
#include KWSYS_HEADER(Encoding.hxx)
+#include <algorithm>
#include <fstream>
#include <iostream>
#include <set>
@@ -553,7 +554,7 @@ bool SystemTools::HasEnv(const std::string& key)
static int kwsysUnPutEnv(const std::string& env)
{
size_t pos = env.find('=');
- if (pos != env.npos) {
+ if (pos != std::string::npos) {
std::string name = env.substr(0, pos);
unsetenv(name.c_str());
} else {
@@ -569,7 +570,7 @@ static int kwsysUnPutEnv(const std::string& env)
{
int err = 0;
size_t pos = env.find('=');
- size_t const len = pos == env.npos ? env.size() : pos;
+ size_t const len = pos == std::string::npos ? env.size() : pos;
size_t const sz = len + 1;
char local_buf[256];
char* buf = sz > sizeof(local_buf) ? (char*)malloc(sz) : local_buf;
@@ -603,7 +604,7 @@ static int kwsysUnPutEnv(std::string const& env)
{
std::wstring wEnv = Encoding::ToWide(env);
size_t const pos = wEnv.find('=');
- size_t const len = pos == wEnv.npos ? wEnv.size() : pos;
+ size_t const len = pos == std::string::npos ? wEnv.size() : pos;
wEnv.resize(len + 1, L'=');
wchar_t* newEnv = _wcsdup(wEnv.c_str());
if (!newEnv) {
@@ -619,7 +620,7 @@ static int kwsysUnPutEnv(std::string const& env)
static int kwsysUnPutEnv(const std::string& env)
{
size_t pos = env.find('=');
- size_t const len = pos == env.npos ? env.size() : pos;
+ size_t const len = pos == std::string::npos ? env.size() : pos;
int in = 0;
int out = 0;
while (environ[in]) {
@@ -644,7 +645,7 @@ static int kwsysUnPutEnv(const std::string& env)
bool SystemTools::PutEnv(const std::string& env)
{
size_t pos = env.find('=');
- if (pos != env.npos) {
+ if (pos != std::string::npos) {
std::string name = env.substr(0, pos);
return setenv(name.c_str(), env.c_str() + pos + 1, 1) == 0;
} else {
@@ -1721,7 +1722,7 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len)
size_t middle = max_len / 2;
n += s.substr(0, middle);
- n += s.substr(s.size() - (max_len - middle), std::string::npos);
+ n += s.substr(s.size() - (max_len - middle));
if (max_len > 2) {
n[middle] = '.';
@@ -1850,7 +1851,7 @@ static void ConvertVMSToUnix(std::string& path)
{
std::string::size_type rootEnd = path.find(":[");
std::string::size_type pathEnd = path.find("]");
- if (rootEnd != path.npos) {
+ if (rootEnd != std::string::npos) {
std::string root = path.substr(0, rootEnd);
std::string pathPart = path.substr(rootEnd + 2, pathEnd - rootEnd - 2);
const char* pathCString = pathPart.c_str();
@@ -3708,6 +3709,16 @@ std::string SystemTools::JoinPath(
return result;
}
+void SystemTools::RemoveEmptyPathElements(std::vector<std::string>& path)
+{
+ if (path.empty()) {
+ return;
+ }
+
+ path.erase(std::remove(path.begin() + 1, path.end(), std::string("")),
+ path.end());
+}
+
bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
{
#if defined(_WIN32) || defined(__APPLE__)
@@ -4326,7 +4337,7 @@ bool SystemTools::GetPermissions(const std::string& file, mode_t& mode)
mode |= S_IFREG;
}
size_t dotPos = file.rfind('.');
- const char* ext = dotPos == file.npos ? 0 : (file.c_str() + dotPos);
+ const char* ext = dotPos == std::string::npos ? 0 : (file.c_str() + dotPos);
if (ext && (Strucmp(ext, ".exe") == 0 || Strucmp(ext, ".com") == 0 ||
Strucmp(ext, ".cmd") == 0 || Strucmp(ext, ".bat") == 0)) {
mode |= (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6));
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 0849e1d..5e091c2 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -474,6 +474,10 @@ public:
static std::string JoinPath(std::vector<std::string>::const_iterator first,
std::vector<std::string>::const_iterator last);
+ /** Removes empty components from path.
+ */
+ static void RemoveEmptyPathElements(std::vector<std::string>& path);
+
/**
* Compare a path or components of a path.
*/
diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx
index 21930f9..816a433 100644
--- a/Source/kwsys/testConsoleBuf.cxx
+++ b/Source/kwsys/testConsoleBuf.cxx
@@ -329,9 +329,8 @@ static int testPipe()
throw std::runtime_error("ReadFile#3 failed!");
}
buffer2[bytesRead] = 0;
- didFail =
- encodedTestString.compare(0, encodedTestString.npos, buffer2,
- encodedTestString.size()) == 0
+ didFail = encodedTestString.compare(0, std::string::npos, buffer2,
+ encodedTestString.size()) == 0
? 0
: 1;
}
@@ -435,9 +434,8 @@ static int testFile()
throw std::runtime_error("ReadFile#2 failed!");
}
buffer2[bytesRead] = 0;
- didFail =
- encodedTestString.compare(0, encodedTestString.npos, buffer2,
- encodedTestString.size()) == 0
+ didFail = encodedTestString.compare(0, std::string::npos, buffer2,
+ encodedTestString.size()) == 0
? 0
: 1;
}
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 900894c..e6fbf6c 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -54,7 +54,8 @@ static const char* toUnixPaths[][2] = {
{ 0, 0 }
};
-static bool CheckConvertToUnixSlashes(std::string input, std::string output)
+static bool CheckConvertToUnixSlashes(std::string const& input,
+ std::string const& output)
{
std::string result = input;
kwsys::SystemTools::ConvertToUnixSlashes(result);
@@ -71,8 +72,9 @@ static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\",
{ " {} ", "{}", "#", " #{#} " },
{ 0, 0, 0, 0 } };
-static bool CheckEscapeChars(std::string input, const char* chars_to_escape,
- char escape_char, std::string output)
+static bool CheckEscapeChars(std::string const& input,
+ const char* chars_to_escape, char escape_char,
+ std::string const& output)
{
std::string result = kwsys::SystemTools::EscapeChars(
input.c_str(), chars_to_escape, escape_char);
diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
index 555a08f..5096a58 100644
--- a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
@@ -1,45 +1,65 @@
cmake_minimum_required(VERSION 3.0)
+cmake_policy(SET CMP0057 NEW)
project(target_compile_features)
-if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_dummy.cpp"
- "int main(int,char**) { return 0; }\n"
- )
- add_executable(target_compile_features "${CMAKE_CURRENT_BINARY_DIR}/test_dummy.cpp")
- return()
-endif()
-
set(CMAKE_VERBOSE_MAKEFILE ON)
-if (CMAKE_C_COMPILE_FEATURES)
- add_executable(target_compile_features main.c)
- target_compile_features(target_compile_features
+if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES)
+ add_executable(c_target_compile_features_specific main.c)
+ target_compile_features(c_target_compile_features_specific
PRIVATE c_restrict
)
- add_library(lib_restrict lib_restrict.c)
- target_compile_features(lib_restrict
+ add_library(c_lib_restrict_specific lib_restrict.c)
+ target_compile_features(c_lib_restrict_specific
PUBLIC c_restrict
)
- add_executable(restrict_user restrict_user.c)
- target_link_libraries(restrict_user lib_restrict)
+ add_executable(c_restrict_user_specific restrict_user.c)
+ target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)
endif()
-if (CMAKE_CXX_COMPILE_FEATURES AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;")
- if (CMAKE_C_COMPILE_FEATURES)
- set(target_suffix _cxx)
- endif()
- add_executable(target_compile_features${target_suffix} main.cpp)
- target_compile_features(target_compile_features${target_suffix}
+if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES)
+ add_executable(c_target_compile_features_meta main.c)
+ target_compile_features(c_target_compile_features_meta
+ PRIVATE c_std_99
+ )
+
+ add_library(c_lib_restrict_meta lib_restrict.c)
+ target_compile_features(c_lib_restrict_meta
+ PUBLIC c_std_99
+ )
+
+ add_executable(c_restrict_user_meta restrict_user.c)
+ target_link_libraries(c_restrict_user_meta c_lib_restrict_meta)
+endif()
+
+if (cxx_auto_type IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ add_executable(cxx_target_compile_features_specific main.cpp)
+ target_compile_features(cxx_target_compile_features_specific
PRIVATE cxx_auto_type
)
- add_library(lib_auto_type lib_auto_type.cpp)
- target_compile_features(lib_auto_type
+ add_library(cxx_lib_auto_type_specific lib_auto_type.cpp)
+ target_compile_features(cxx_lib_auto_type_specific
PUBLIC cxx_auto_type
)
- add_executable(lib_user lib_user.cpp)
- target_link_libraries(lib_user lib_auto_type)
+ add_executable(cxx_lib_user_specific lib_user.cpp)
+ target_link_libraries(cxx_lib_user_specific cxx_lib_auto_type_specific)
+endif()
+
+if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ add_executable(cxx_target_compile_features_meta main.cpp)
+ target_compile_features(cxx_target_compile_features_meta
+ PRIVATE cxx_std_11
+ )
+
+ add_library(cxx_lib_auto_type_meta lib_auto_type.cpp)
+ target_compile_features(cxx_lib_auto_type_meta
+ PUBLIC cxx_std_11
+ )
+
+ add_executable(cxx_lib_user_meta lib_user.cpp)
+ target_link_libraries(cxx_lib_user_meta cxx_lib_auto_type_meta)
endif()
diff --git a/Tests/CMakeCommands/target_compile_features/dummy.cpp b/Tests/CMakeCommands/target_compile_features/dummy.cpp
deleted file mode 100644
index e9ad257..0000000
--- a/Tests/CMakeCommands/target_compile_features/dummy.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 21fe641..d138f58 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1,6 +1,9 @@
# a macro for tests that have a simple format where the name matches the
# directory and project
-macro(ADD_TEST_MACRO NAME COMMAND)
+macro(ADD_TEST_MACRO NAME)
+ if(${ARGC} GREATER 1)
+ set(_test_command --test-command ${ARGN})
+ endif()
string(REPLACE "." "/" dir "${NAME}")
string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
add_test(NAME "${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}"
@@ -13,7 +16,8 @@ macro(ADD_TEST_MACRO NAME COMMAND)
${${NAME}_CTEST_OPTIONS}
--build-options ${build_options}
${${NAME}_BUILD_OPTIONS}
- --test-command ${COMMAND} ${ARGN})
+ ${_test_command})
+ unset(_test_command)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
endmacro()
@@ -271,7 +275,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(SystemInformation SystemInformation)
ADD_TEST_MACRO(MathTest MathTest)
ADD_TEST_MACRO(CompileFeatures CompileFeatures)
- ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
+ ADD_TEST_MACRO(CMakeCommands.target_compile_features)
if(CMake_TEST_RESOURCES)
ADD_TEST_MACRO(VSResource VSResource)
@@ -3110,6 +3114,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif ()
endif ()
+ if(CMake_TEST_EXTERNAL_CMAKE)
+ set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
+ endif()
if("${CMAKE_GENERATOR}" MATCHES Xcode)
set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
endif()
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index bb18543..4a5558d 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -1,10 +1,11 @@
cmake_minimum_required(VERSION 3.1)
+cmake_policy(SET CMP0057 NEW)
project(CompileFeatures)
macro(run_test feature lang)
- if (";${CMAKE_${lang}_COMPILE_FEATURES};" MATCHES ${feature})
+ if (${feature} IN_LIST CMAKE_${lang}_COMPILE_FEATURES)
add_library(test_${feature} OBJECT ${feature})
set_property(TARGET test_${feature}
PROPERTY COMPILE_FEATURES "${feature}"
@@ -15,12 +16,13 @@ macro(run_test feature lang)
endmacro()
get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
-list(REMOVE_ITEM c_features c_std_90 c_std_99 c_std_11)
+list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
foreach(feature ${c_features})
run_test(${feature} C)
endforeach()
+
get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
-list(REMOVE_ITEM cxx_features cxx_std_98 cxx_std_11 cxx_std_14 cxx_std_17)
+list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
foreach(feature ${cxx_features})
run_test(${feature} CXX)
endforeach()
@@ -171,12 +173,20 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
endif()
endif()
+if (CMAKE_C_COMPILE_FEATURES)
+ set(C_expected_features ${CMAKE_C_COMPILE_FEATURES})
+ list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
+endif()
+if (CMAKE_CXX_COMPILE_FEATURES)
+ set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES})
+ list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
+endif ()
set(C_ext c)
set(C_standard_flag 11)
set(CXX_ext cpp)
set(CXX_standard_flag 14)
foreach(lang CXX C)
- if (CMAKE_${lang}_COMPILE_FEATURES)
+ if (${lang}_expected_features)
foreach(feature ${${lang}_non_features})
message("Testing feature : ${feature}")
try_compile(${feature}_works
@@ -198,7 +208,7 @@ foreach(lang CXX C)
endif()
endforeach()
-if (CMAKE_C_COMPILE_FEATURES)
+if (C_expected_features)
if (CMAKE_C_STANDARD_DEFAULT)
string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx)
if (std_flag_idx EQUAL -1)
@@ -280,7 +290,8 @@ if (CMAKE_CXX_COMPILE_FEATURES)
endif ()
# always add a target "CompileFeatures"
-if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;")
+if ((NOT CXX_expected_features) OR
+ (NOT cxx_auto_type IN_LIST CXX_expected_features))
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
"int main(int,char**) { return 0; }\n"
)
diff --git a/Tests/CustomCommandByproducts/ninja-check.cmake b/Tests/CustomCommandByproducts/ninja-check.cmake
index 2fc3cc2..a7beb3d 100644
--- a/Tests/CustomCommandByproducts/ninja-check.cmake
+++ b/Tests/CustomCommandByproducts/ninja-check.cmake
@@ -4,7 +4,7 @@ if("${build_ninja}" MATCHES [====[
# Tell Ninja that they may appear as side effects of build rules
# otherwise ordered by order-only dependencies.
-((build [^:]*: phony [^\n]*
+((build [^:]*: phony[^\n]*
)*)# ========]====])
set(phony "${CMAKE_MATCH_1}")
if(NOT phony)
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 2657aeb..52d4613 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -48,7 +48,14 @@ macro(set_defines target true_defs false_defs)
)
endmacro()
+# Only run the compiler detection header test for compilers with
+# detailed features tables, not just meta-features
+
if (CMAKE_C_COMPILE_FEATURES)
+ set(C_expected_features ${CMAKE_C_COMPILE_FEATURES})
+ list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
+endif()
+if (C_expected_features)
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_C_COMPILER_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_C_COMPILER_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_C_COMPILER_VERSION}")
@@ -85,7 +92,11 @@ if (CMAKE_C_COMPILE_FEATURES)
endif()
endif()
-if (NOT CMAKE_CXX_COMPILE_FEATURES)
+if (CMAKE_CXX_COMPILE_FEATURES)
+ set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES})
+ list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
+endif()
+if (NOT CXX_expected_features)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
"int main(int,char**) { return 0; }\n"
)
diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
index 2d14a9e..b24a680 100644
--- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
+++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
@@ -6,9 +6,10 @@ add_library(empty3 INTERFACE)
target_compile_features(empty3 INTERFACE cxx_std_11)
target_link_libraries(empty1
- # When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the
+ # When starting, $<COMPILE_FEATURES:cxx_std_11> is '0', so 'freeze' the
# CXX_STANDARD at 98 during computation.
- $<$<COMPILE_FEATURES:cxx_auto_type>:empty2>
+ $<$<COMPILE_FEATURES:cxx_std_11>:empty2>
+
# This would add cxx_std_11, but that would require CXX_STANDARD = 11,
# which is not allowed after freeze. Report an error.
empty3
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 8dc627d..5a70da2 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
+cmake_policy(SET CMP0057 NEW)
include(RunCMake)
run_cmake(NotAFeature)
@@ -28,13 +29,13 @@ endif()
if (NOT CXX_FEATURES)
run_cmake(NoSupportedCxxFeatures)
run_cmake(NoSupportedCxxFeaturesGenex)
-else()
+elseif (cxx_std_98 IN_LIST CXX_FEATURES AND cxx_std_11 IN_LIST CXX_FEATURES)
if(CXX_STANDARD_DEFAULT EQUAL 98)
run_cmake(LinkImplementationFeatureCycle)
endif()
run_cmake(LinkImplementationFeatureCycleSolved)
- if (";${CXX_FEATURES};" MATCHES ";cxx_final;")
+ if (cxx_final IN_LIST CXX_FEATURES)
set(RunCMake_TEST_OPTIONS "-DHAVE_FINAL=1")
endif()
run_cmake(NonValidTarget1)
diff --git a/Utilities/Release/hythloth_release.cmake b/Utilities/Release/hythloth_release.cmake
deleted file mode 100644
index d2f4ba5..0000000
--- a/Utilities/Release/hythloth_release.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-set(PROCESSORS 2)
-set(HOST hythloth)
-set(MAKE_PROGRAM "make")
-set(MAKE "${MAKE_PROGRAM} -j2")
-set(INITIAL_CACHE "
-CMAKE_BUILD_TYPE:STRING=Release
-CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-")
-get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
-include(${path}/release_cmake.cmake)
diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake
index feba2a5..3d8ddba 100644
--- a/Utilities/Release/linux64_release.cmake
+++ b/Utilities/Release/linux64_release.cmake
@@ -35,6 +35,7 @@ OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2j/lib/libssl.a
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3
CPACK_SYSTEM_NAME:STRING=Linux-x86_64
BUILD_QtDialog:BOOL:=TRUE
+CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CMake_ENABLE_SERVER_MODE:BOOL=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
CMake_INSTALL_DEPENDENCIES:BOOL=ON
diff --git a/bootstrap b/bootstrap
index daf405e..84285a8 100755
--- a/bootstrap
+++ b/bootstrap
@@ -6,6 +6,17 @@ die() {
echo "$@" 1>&2 ; exit 1
}
+# Compile flag extraction function.
+cmake_extract_standard_flags()
+{
+ cd "${cmake_source_dir}/Modules/Compiler/"
+ for file in ${1:-*}-${2}.cmake; do
+ cat "${file}" \
+ | sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
+ | tr ';' ' '
+ done
+}
+
# Version number extraction function.
cmake_version_component()
{
@@ -954,6 +965,17 @@ for a in ${cmake_c_compilers}; do
cmake_c_compiler="${a}"
fi
done
+for std in 11 99 90; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \
+ "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
+ cmake_c_flags="${cmake_c_flags} ${flag}"
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then
@@ -988,6 +1010,10 @@ echo '
# include <iostream.h>
#endif
+#if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
+#error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics."
+#endif
+
class NeedCXX
{
public:
@@ -1015,6 +1041,17 @@ for a in ${cmake_cxx_compilers}; do
fi
done
done
+for std in 14 11 98; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \
+ "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
+ cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then
@@ -1162,34 +1199,6 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
fi
-if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
- # Are we SolarisStudio?
-
- TMPFILE=`cmake_tmp_file`
- echo '
- #if defined(__SUNPRO_CC)
- #include <iostream>
- int main() { std::cout << "This is SolarisStudio" << std::endl; return 0;}
- #endif
- ' > ${TMPFILE}.cxx
- cmake_cxx_compiler_is_solarisstudio=0
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} " "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
- cmake_cxx_compiler_is_solarisstudio=1
- fi
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- echo "${cmake_cxx_compiler} is SolarisStudio compiler"
- else
- echo "${cmake_cxx_compiler} is not SolarisStudio compiler"
- fi
- rm -f "${TMPFILE}.cxx"
-
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- cmake_cxx_flags="${cmake_cxx_flags} -library=stlport4"
- fi
-fi
-
-
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0