summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CTestCustom.cmake.in6
-rw-r--r--Help/generator/KDevelop3.rst25
-rw-r--r--Help/manual/cmake-generators.7.rst1
-rw-r--r--Help/manual/cmake-properties.7.rst2
-rw-r--r--Help/manual/cmake-server.7.rst8
-rw-r--r--Help/prop_sf/COMPILE_OPTIONS.rst17
-rw-r--r--Help/prop_sf/INCLUDE_DIRECTORIES.rst18
-rw-r--r--Help/release/dev/RemoveKDevelop3.rst4
-rw-r--r--Help/release/dev/src-new-properties-COMPILE_OPTIONS-and-INCLUDE_DIRECTORIES.rst10
-rw-r--r--Help/variable/CMAKE_EXTRA_GENERATOR.rst2
-rw-r--r--Modules/CMakeFindKDevelop3.cmake13
-rw-r--r--Modules/Compiler/Cray-C.cmake3
-rw-r--r--Modules/Compiler/Cray-CXX.cmake3
-rw-r--r--Modules/Compiler/Cray-Fortran.cmake7
-rw-r--r--Modules/Compiler/Cray.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv.cmake1
-rw-r--r--Modules/Compiler/XL.cmake2
-rw-r--r--Source/CMakeLists.txt5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/QtDialog/QCMake.cxx9
-rw-r--r--Source/cmAddExecutableCommand.cxx2
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h2
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx2
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx2
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx53
-rw-r--r--Source/cmExtraSublimeTextGenerator.h3
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx4
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx589
-rw-r--r--Source/cmGlobalKdevelopGenerator.h81
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx17
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmIDEOptions.cxx42
-rw-r--r--Source/cmIDEOptions.h12
-rw-r--r--Source/cmLocalGenerator.cxx107
-rw-r--r--Source/cmLocalGenerator.h40
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h5
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx104
-rw-r--r--Source/cmLocalXCodeGenerator.cxx6
-rw-r--r--Source/cmLocalXCodeGenerator.h2
-rw-r--r--Source/cmMakefile.cxx43
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx41
-rw-r--r--Source/cmNinjaTargetGenerator.cxx53
-rw-r--r--Source/cmNinjaTargetGenerator.h3
-rw-r--r--Source/cmServerProtocol.cxx53
-rw-r--r--Source/cmStateSnapshot.cxx6
-rw-r--r--Source/cmSystemTools.cxx8
-rw-r--r--Source/cmUtils.hxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx135
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h5
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx83
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h4
-rw-r--r--Source/cmake.cxx22
-rw-r--r--Source/kwsys/CMakeLists.txt46
-rw-r--r--Source/kwsys/CommandLineArguments.cxx22
-rw-r--r--Source/kwsys/Configure.hxx.in7
-rw-r--r--Source/kwsys/Directory.cxx2
-rw-r--r--Source/kwsys/DynamicLoader.cxx2
-rw-r--r--Source/kwsys/EncodingCXX.cxx12
-rw-r--r--Source/kwsys/Glob.cxx10
-rw-r--r--Source/kwsys/ProcessUNIX.c2
-rw-r--r--Source/kwsys/RegularExpression.cxx126
-rw-r--r--Source/kwsys/RegularExpression.hxx.in2
-rw-r--r--Source/kwsys/SharedForward.h.in2
-rw-r--r--Source/kwsys/SystemInformation.cxx141
-rw-r--r--Source/kwsys/SystemInformation.hxx.in4
-rw-r--r--Source/kwsys/SystemTools.cxx37
-rw-r--r--Source/kwsys/SystemTools.hxx.in2
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx4
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx6
-rw-r--r--Source/kwsys/testEncoding.cxx4
-rw-r--r--Source/kwsys/testSystemTools.cxx17
-rw-r--r--Tests/CMakeLists.txt6
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt54
-rw-r--r--Tests/GeneratorExpression/srcgenex.c.in (renamed from Tests/GeneratorExpression/srcgenex_defs.c)2
-rw-r--r--Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c12
-rw-r--r--Tests/GeneratorExpression/srcgenex_flags.c12
-rw-r--r--Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c12
-rw-r--r--Tests/GeneratorExpression/srcgenex_includes.c.in12
-rw-r--r--Tests/GeneratorExpression/srcgenex_includes.h.in7
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake4
-rw-r--r--Tests/RunCMake/Make/IncludeRegexSubdir.cmake3
-rw-r--r--Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/Make/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/SourceProperties/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt1
-rw-r--r--Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt4
-rw-r--r--Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake4
-rw-r--r--Tests/RunCMake/SourceProperties/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/SourceProperties/empty.c5
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt8
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt8
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake2
-rw-r--r--Tests/Server/cmakelib.py2
-rw-r--r--Tests/SourceFileIncludeDirProperty/CMakeLists.txt15
-rw-r--r--Tests/SourceFileIncludeDirProperty/main.c7
-rw-r--r--Tests/SourceFileIncludeDirProperty/source/header.h2
-rw-r--r--Tests/SourceFileIncludeDirProperty/target/header.h2
105 files changed, 1086 insertions, 1253 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 0e4e9fe..eb8b630 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -102,12 +102,6 @@ if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")
)
endif ()
-if(NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop")
- list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
- "Kdevelop"
- )
-endif ()
-
list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
# Exclude kwsys files from coverage results. They are reported
# (with better coverage results) on kwsys dashboards...
diff --git a/Help/generator/KDevelop3.rst b/Help/generator/KDevelop3.rst
deleted file mode 100644
index eaa218b..0000000
--- a/Help/generator/KDevelop3.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-KDevelop3
----------
-
-Generates KDevelop 3 project files.
-
-Project files for KDevelop 3 will be created in the top directory and
-in every subdirectory which features a CMakeLists.txt file containing
-a PROJECT() call. If you change the settings using KDevelop cmake
-will try its best to keep your changes when regenerating the project
-files. Additionally a hierarchy of UNIX makefiles is generated into
-the build tree. Any standard UNIX-style make program can build the
-project through the default make target. A "make install" target is
-also provided.
-
-This "extra" generator may be specified as:
-
-``KDevelop3 - Unix Makefiles``
- Generate with :generator:`Unix Makefiles`.
-
-``KDevelop3``
- Generate with :generator:`Unix Makefiles`.
-
- For historical reasons this extra generator may be specified
- directly as the main generator and it will be used as the
- extra generator with :generator:`Unix Makefiles` automatically.
diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst
index a37c65b..0287767 100644
--- a/Help/manual/cmake-generators.7.rst
+++ b/Help/manual/cmake-generators.7.rst
@@ -108,6 +108,5 @@ The following extra generators are known to CMake.
/generator/CodeBlocks
/generator/CodeLite
/generator/Eclipse CDT4
- /generator/KDevelop3
/generator/Kate
/generator/Sublime Text 2
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 88b39d4..00a932f 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -370,10 +370,12 @@ Properties on Source Files
/prop_sf/AUTORCC_OPTIONS
/prop_sf/COMPILE_DEFINITIONS
/prop_sf/COMPILE_FLAGS
+ /prop_sf/COMPILE_OPTIONS
/prop_sf/EXTERNAL_OBJECT
/prop_sf/Fortran_FORMAT
/prop_sf/GENERATED
/prop_sf/HEADER_FILE_ONLY
+ /prop_sf/INCLUDE_DIRECTORIES
/prop_sf/KEEP_EXTENSION
/prop_sf/LABELS
/prop_sf/LANGUAGE
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index 1ddcb1b..0fed0b1 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -277,10 +277,6 @@ Giving the "major" version of the requested protocol version will make the serve
use the latest minor version of that protocol. Use this if you do not explicitly
need to depend on a specific minor version.
-If the build directory already contains a CMake cache, it is sufficient to set
-the "buildDirectory" attribute. To create a fresh build directory, additional
-attributes are required depending on the protocol version.
-
Protocol version 1.0 requires the following attributes to be set:
* "sourceDirectory" with a path to the sources
@@ -290,6 +286,10 @@ Protocol version 1.0 requires the following attributes to be set:
* "platform" with the generator platform (if supported by the generator)
* "toolset" with the generator toolset (if supported by the generator)
+Protocol version 1.2 makes all but the build directory optional, provided
+there is a valid cache in the build directory that contains all the other
+information already.
+
Example::
[== "CMake Server" ==[
diff --git a/Help/prop_sf/COMPILE_OPTIONS.rst b/Help/prop_sf/COMPILE_OPTIONS.rst
new file mode 100644
index 0000000..157c0b0
--- /dev/null
+++ b/Help/prop_sf/COMPILE_OPTIONS.rst
@@ -0,0 +1,17 @@
+COMPILE_OPTIONS
+---------------
+
+List of additional options to pass to the compiler.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+and will be added to the list of compile flags when this
+source file builds. Use :prop_sf:`COMPILE_DEFINITIONS` to pass
+additional preprocessor definitions and :prop_sf:`INCLUDE_DIRECTORIES` to pass
+additional include directories.
+
+Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. However, :generator:`Xcode`
+does not support per-config per-source settings, so expressions
+that depend on the build configuration are not allowed with that
+generator.
diff --git a/Help/prop_sf/INCLUDE_DIRECTORIES.rst b/Help/prop_sf/INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..55780e5
--- /dev/null
+++ b/Help/prop_sf/INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,18 @@
+INCLUDE_DIRECTORIES
+-------------------
+
+List of preprocessor include file search directories.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of paths
+and will be added to the list of include directories when this
+source file builds. These directories will take precedence over directories
+defined at target level except for :generator:`Xcode` generator due to technical
+limitations.
+
+Relative paths should not be added to this property directly.
+
+Contents of ``INCLUDE_DIRECTORIES`` may use "generator expressions" with
+the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. However, :generator:`Xcode` does not support
+per-config per-source settings, so expressions that depend on the build
+configuration are not allowed with that generator.
diff --git a/Help/release/dev/RemoveKDevelop3.rst b/Help/release/dev/RemoveKDevelop3.rst
new file mode 100644
index 0000000..805ad26
--- /dev/null
+++ b/Help/release/dev/RemoveKDevelop3.rst
@@ -0,0 +1,4 @@
+RemoveKDevelop3
+---------------
+
+* The ``KDevelop3`` generator has been removed.
diff --git a/Help/release/dev/src-new-properties-COMPILE_OPTIONS-and-INCLUDE_DIRECTORIES.rst b/Help/release/dev/src-new-properties-COMPILE_OPTIONS-and-INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..d06c109
--- /dev/null
+++ b/Help/release/dev/src-new-properties-COMPILE_OPTIONS-and-INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,10 @@
+src-new-properties-COMPILE_OPTIONS-and-INCLUDE_DIRECTORIES
+----------------------------------------------------------
+
+* Source file learns new properties:
+
+ * A :prop_sf:`COMPILE_OPTIONS` source file property was added to manage list
+ of options to pass to the compiler.
+
+ * An :prop_sf:`INCLUDE_DIRECTORIES` source file property was added to specify
+ list of preprocessor include file search directories.
diff --git a/Help/variable/CMAKE_EXTRA_GENERATOR.rst b/Help/variable/CMAKE_EXTRA_GENERATOR.rst
index 4d513e4..2c92323 100644
--- a/Help/variable/CMAKE_EXTRA_GENERATOR.rst
+++ b/Help/variable/CMAKE_EXTRA_GENERATOR.rst
@@ -4,7 +4,7 @@ CMAKE_EXTRA_GENERATOR
The extra generator used to build the project. See
:manual:`cmake-generators(7)`.
-When using the Eclipse, CodeBlocks or KDevelop generators, CMake
+When using the Eclipse, CodeBlocks, CodeLite, Kate or Sublime generators, CMake
generates Makefiles (:variable:`CMAKE_GENERATOR`) and additionally project
files for the respective IDE. This IDE project file generator is stored in
``CMAKE_EXTRA_GENERATOR`` (e.g. ``Eclipse CDT4``).
diff --git a/Modules/CMakeFindKDevelop3.cmake b/Modules/CMakeFindKDevelop3.cmake
deleted file mode 100644
index 488acf7..0000000
--- a/Modules/CMakeFindKDevelop3.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-
-# This file is included in CMakeSystemSpecificInformation.cmake if
-# the KDevelop3 extra generator has been selected.
-
-find_program(CMAKE_KDEVELOP3_EXECUTABLE NAMES kdevelop DOC "The KDevelop3 executable")
-
-if(CMAKE_KDEVELOP3_EXECUTABLE)
- set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_KDEVELOP3_EXECUTABLE} <PROJECT_FILE>" )
-endif()
-
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index 87ce20f..d34154c 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -2,8 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Cray)
-
-set(CMAKE_C_VERBOSE_FLAG "-v")
+__compiler_cray(C)
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index 8506c094..a1899e6 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -2,8 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Cray)
-
-set(CMAKE_CXX_VERBOSE_FLAG "-v")
+__compiler_cray(C)
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake
index 5d81bb0..dbf28e3 100644
--- a/Modules/Compiler/Cray-Fortran.cmake
+++ b/Modules/Compiler/Cray-Fortran.cmake
@@ -1,4 +1,9 @@
-set(CMAKE_Fortran_VERBOSE_FLAG "-v")
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Compiler/Cray)
+__compiler_cray(Fortran)
+
set(CMAKE_Fortran_MODOUT_FLAG -em)
set(CMAKE_Fortran_MODDIR_FLAG -J)
set(CMAKE_Fortran_MODDIR_DEFAULT .)
diff --git a/Modules/Compiler/Cray.cmake b/Modules/Compiler/Cray.cmake
index 8fe8eeb..c214afc 100644
--- a/Modules/Compiler/Cray.cmake
+++ b/Modules/Compiler/Cray.cmake
@@ -8,3 +8,10 @@ endif()
set(__COMPILER_CRAY 1)
include(Compiler/CMakeCommonCompilerMacros)
+
+macro(__compiler_cray lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC -h PIC)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE -h PIC)
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-h PIC")
+endmacro()
diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake
index 3feea1c..05e3fc7 100644
--- a/Modules/Compiler/CrayPrgEnv.cmake
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -62,7 +62,6 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd)
# Flags for the Cray wrappers
set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
- set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 4783785..e527a04 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -20,6 +20,8 @@ macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
+ set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-qoptfile=")
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-qoptfile=")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index cd1287c..c680fd2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -607,11 +607,6 @@ set(SRCS
SET_PROPERTY(SOURCE cmProcessOutput.cxx APPEND PROPERTY COMPILE_DEFINITIONS
KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})
-# Kdevelop only works on UNIX and not windows
-if(UNIX)
- set(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx)
-endif()
-
# Xcode only works on Apple
if(APPLE)
set(SRCS ${SRCS}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index bab642b..27b7cd3 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 10)
-set(CMake_VERSION_PATCH 20180124)
+set(CMake_VERSION_PATCH 20180125)
#set(CMake_VERSION_RC 1)
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 7e94a27..a84429b 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -39,15 +39,6 @@ QCMake::QCMake(QObject* p)
std::vector<cmake::GeneratorInfo>::const_iterator it;
for (it = generators.begin(); it != generators.end(); ++it) {
- // Skip the generator "KDevelop3", since there is also
- // "KDevelop3 - Unix Makefiles", which is the full and official name.
- // The short name is actually only still there since this was the name
- // in CMake 2.4, to keep "command line argument compatibility", but
- // this is not necessary in the GUI.
- if (it->name == "KDevelop3") {
- continue;
- }
-
this->AvailableGenerators.push_back(*it);
}
}
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index b9e200a..2e95032 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -164,7 +164,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> srclists(s, args.end());
cmTarget* tgt =
- this->Makefile->AddExecutable(exename.c_str(), srclists, excludeFromAll);
+ this->Makefile->AddExecutable(exename, srclists, excludeFromAll);
if (use_win32) {
tgt->SetProperty("WIN32_EXECUTABLE", "ON");
}
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index 7f332a8..5cc6442 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -17,7 +17,7 @@ class cmMakefile;
* cmExternalMakefileProjectGenerator is a base class for generators
* for "external makefile based projects", i.e. IDE projects which work
* an already existing makefiles.
- * See cmGlobalKdevelopGenerator as an example.
+ * See cmExtraEclipseCDT4Generator as an example.
* After the makefiles have been generated by one of the Makefile
* generators, the Generate() method is called and this generator
* can iterate over the local generators and/or projects to produce the
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 31c8bca..e4bec7f 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -416,7 +416,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// C/C++ source files,
// replacing the file name extension with ".h" and checks whether such a
// file exists. If it does, it is inserted into the map of files.
- // A very similar version of that code exists also in the kdevelop
+ // A very similar version of that code exists also in the CodeLite
// project generator.
for (std::string const& fileName : cFiles) {
std::string headerBasename = cmSystemTools::GetFilenamePath(fileName);
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index fad0723..a37348d 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -300,7 +300,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles(
// files to the project. It does that by iterating over all source files,
// replacing the file name extension with ".h" and checks whether such a
// file exists. If it does, it is inserted into the map of files.
- // A very similar version of that code exists also in the kdevelop
+ // A very similar version of that code exists also in the CodeBlocks
// project generator.
for (auto const& sit : cFiles) {
std::string headerBasename = cmSystemTools::GetFilenamePath(sit.first);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index a200385..1fc0828 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -498,7 +498,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
// Add the file to the list of sources.
std::string const& source = sf->GetFullPath();
cmSourceGroup* sourceGroup =
- makefile->FindSourceGroup(source.c_str(), sourceGroups);
+ makefile->FindSourceGroup(source, sourceGroups);
sourceGroup->AssignSource(sf);
}
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index c7197f2..a89c187 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -257,6 +257,8 @@ void cmExtraSublimeTextGenerator::AppendTarget(
std::string flagsString =
this->ComputeFlagsForObject(sourceFile, lg, target);
std::string definesString = this->ComputeDefines(sourceFile, lg, target);
+ std::string includesString =
+ this->ComputeIncludes(sourceFile, lg, target);
flags.clear();
cmsys::RegularExpression flagRegex;
// Regular expression to extract compiler flags from a string
@@ -264,7 +266,8 @@ void cmExtraSublimeTextGenerator::AppendTarget(
const char* regexString =
"(^|[ ])-[DIOUWfgs][^= ]+(=\\\"[^\"]+\\\"|=[^\"][^ ]+)?";
flagRegex.compile(regexString);
- std::string workString = flagsString + " " + definesString;
+ std::string workString =
+ flagsString + " " + definesString + " " + includesString;
while (flagRegex.find(workString)) {
std::string::size_type start = flagRegex.start();
if (workString[start] == ' ') {
@@ -351,23 +354,21 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
lg->GetTargetCompileFlags(gtgt, config, language, flags);
- // Add include directory flags.
- {
- std::vector<std::string> includes;
- lg->GetIncludeDirectories(includes, gtgt, language, config);
- std::string includeFlags = lg->GetIncludeFlags(includes, gtgt, language,
- true); // full include paths
- lg->AppendFlags(flags, includeFlags);
- }
-
// Add source file specific flags.
+ cmGeneratorExpressionInterpreter genexInterpreter(lg, gtgt, config,
+ gtgt->GetName(), language);
+
const std::string COMPILE_FLAGS("COMPILE_FLAGS");
if (const char* cflags = source->GetProperty(COMPILE_FLAGS)) {
- cmGeneratorExpressionInterpreter genexInterpreter(
- lg, gtgt, config, gtgt->GetName(), language);
lg->AppendFlags(flags, genexInterpreter.Evaluate(cflags, COMPILE_FLAGS));
}
+ const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ if (const char* coptions = source->GetProperty(COMPILE_OPTIONS)) {
+ lg->AppendCompileOptions(
+ flags, genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS));
+ }
+
return flags;
}
@@ -410,6 +411,34 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
return definesString;
}
+std::string cmExtraSublimeTextGenerator::ComputeIncludes(
+ cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* target)
+
+{
+ std::vector<std::string> includes;
+ cmMakefile* makefile = lg->GetMakefile();
+ const std::string& language = source->GetLanguage();
+ const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ cmGeneratorExpressionInterpreter genexInterpreter(
+ lg, target, config, target->GetName(), language);
+
+ // Add include directories for this source file
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincludes = source->GetProperty(INCLUDE_DIRECTORIES)) {
+ lg->AppendIncludeDirectories(
+ includes, genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES),
+ *source);
+ }
+
+ // Add include directory flags.
+ lg->GetIncludeDirectories(includes, target, language, config);
+
+ std::string includesString =
+ lg->GetIncludeFlags(includes, target, language, true, false, config);
+
+ return includesString;
+}
+
bool cmExtraSublimeTextGenerator::Open(const std::string& bindir,
const std::string& projectName,
bool dryRun)
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 57ba1cf..bc158f6 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -65,6 +65,9 @@ private:
std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
cmGeneratorTarget* gtgt);
+ std::string ComputeIncludes(cmSourceFile* source, cmLocalGenerator* lg,
+ cmGeneratorTarget* gtgt);
+
bool Open(const std::string& bindir, const std::string& projectName,
bool dryRun) override;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index b3e3393..d459436 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -486,7 +486,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
for (std::vector<cmSourceFile*>::const_iterator si = objectSources.begin();
si != objectSources.end(); ++si) {
std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups());
- char const* sourceFullPath = (*si)->GetFullPath().c_str();
+ std::string const& sourceFullPath = (*si)->GetFullPath();
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
std::string sgPath = sourceGroup->GetFullName();
@@ -604,7 +604,7 @@ std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
dir_max += "/";
std::vector<cmSourceGroup> sourceGroups(
localGhsMultiGenerator->GetMakefile()->GetSourceGroups());
- char const* const sourceFullPath = sourceFile->GetFullPath().c_str();
+ std::string const& sourceFullPath = sourceFile->GetFullPath();
cmSourceGroup* sourceGroup =
localGhsMultiGenerator->GetMakefile()->FindSourceGroup(sourceFullPath,
sourceGroups);
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
deleted file mode 100644
index 80aadb9..0000000
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ /dev/null
@@ -1,589 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmGlobalKdevelopGenerator.h"
-
-#include "cmGeneratedFileStream.h"
-#include "cmGeneratorTarget.h"
-#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
-#include "cmSourceFile.h"
-#include "cmStateTypes.h"
-#include "cmSystemTools.h"
-#include "cmTarget.h"
-#include "cmXMLWriter.h"
-#include "cmake.h"
-
-#include "cmsys/Directory.hxx"
-#include "cmsys/FStream.hxx"
-#include <set>
-#include <string.h>
-#include <utility>
-
-cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
- : cmExternalMakefileProjectGenerator()
-{
-}
-
-cmExternalMakefileProjectGeneratorFactory*
-cmGlobalKdevelopGenerator::GetFactory()
-{
- static cmExternalMakefileProjectGeneratorSimpleFactory<
- cmGlobalKdevelopGenerator>
- factory("KDevelop3", "Generates KDevelop 3 project files.");
-
- if (factory.GetSupportedGlobalGenerators().empty()) {
- factory.AddSupportedGlobalGenerator("Unix Makefiles");
-#ifdef CMAKE_USE_NINJA
- factory.AddSupportedGlobalGenerator("Ninja");
-#endif
-
- factory.Aliases.push_back("KDevelop3");
- }
-
- return &factory;
-}
-
-void cmGlobalKdevelopGenerator::Generate()
-{
- // for each sub project in the project create
- // a kdevelop project
- for (auto const& it : this->GlobalGenerator->GetProjectMap()) {
- std::string outputDir = it.second[0]->GetCurrentBinaryDirectory();
- std::string projectDir = it.second[0]->GetSourceDirectory();
- std::string projectName = it.second[0]->GetProjectName();
- std::string cmakeFilePattern("CMakeLists.txt;*.cmake;");
- std::string fileToOpen;
- const std::vector<cmLocalGenerator*>& lgs = it.second;
- // create the project.kdevelop.filelist file
- if (!this->CreateFilelistFile(lgs, outputDir, projectDir, projectName,
- cmakeFilePattern, fileToOpen)) {
- cmSystemTools::Error("Can not create filelist file");
- return;
- }
- // try to find the name of an executable so we have something to
- // run from kdevelop for now just pick the first executable found
- std::string executable;
- for (cmLocalGenerator* lg : lgs) {
- std::vector<cmGeneratorTarget*> const& targets =
- lg->GetGeneratorTargets();
- for (cmGeneratorTarget* target : targets) {
- if (target->GetType() == cmStateEnums::EXECUTABLE) {
- executable = target->GetLocation("");
- break;
- }
- }
- if (!executable.empty()) {
- break;
- }
- }
-
- // now create a project file
- this->CreateProjectFile(outputDir, projectDir, projectName, executable,
- cmakeFilePattern, fileToOpen);
- }
-}
-
-bool cmGlobalKdevelopGenerator::CreateFilelistFile(
- const std::vector<cmLocalGenerator*>& lgs, const std::string& outputDir,
- const std::string& projectDirIn, const std::string& projectname,
- std::string& cmakeFilePattern, std::string& fileToOpen)
-{
- std::string projectDir = projectDirIn + "/";
- std::string filename = outputDir + "/" + projectname + ".kdevelop.filelist";
-
- std::set<std::string> files;
- std::string tmp;
-
- std::vector<std::string> const& hdrExts =
- this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
-
- for (cmLocalGenerator* lg : lgs) {
- cmMakefile* makefile = lg->GetMakefile();
- const std::vector<std::string>& listFiles = makefile->GetListFiles();
- for (std::string const& listFile : listFiles) {
- tmp = listFile;
- cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
- // make sure the file is part of this source tree
- if ((tmp[0] != '/') &&
- (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
- nullptr)) {
- files.insert(tmp);
- tmp = cmSystemTools::GetFilenameName(tmp);
- // add all files which don't match the default
- // */CMakeLists.txt;*cmake; to the file pattern
- if ((tmp != "CMakeLists.txt") &&
- (strstr(tmp.c_str(), ".cmake") == nullptr)) {
- cmakeFilePattern += tmp + ";";
- }
- }
- }
-
- // get all sources
- const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
- for (cmGeneratorTarget* gt : targets) {
- std::vector<cmSourceFile*> sources;
- gt->GetSourceFiles(sources, gt->Target->GetMakefile()->GetSafeDefinition(
- "CMAKE_BUILD_TYPE"));
- for (cmSourceFile* sf : sources) {
- tmp = sf->GetFullPath();
- std::string headerBasename = cmSystemTools::GetFilenamePath(tmp);
- headerBasename += "/";
- headerBasename += cmSystemTools::GetFilenameWithoutExtension(tmp);
-
- cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
-
- if ((tmp[0] != '/') &&
- (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
- nullptr) &&
- (cmSystemTools::GetFilenameExtension(tmp) != ".moc")) {
- files.insert(tmp);
-
- // check if there's a matching header around
- for (std::string const& hdrExt : hdrExts) {
- std::string hname = headerBasename;
- hname += ".";
- hname += hdrExt;
- if (cmSystemTools::FileExists(hname.c_str())) {
- cmSystemTools::ReplaceString(hname, projectDir.c_str(), "");
- files.insert(hname);
- break;
- }
- }
- }
- }
- for (std::string const& listFile : listFiles) {
- tmp = listFile;
- cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
- if ((tmp[0] != '/') &&
- (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
- nullptr)) {
- files.insert(tmp);
- }
- }
- }
- }
-
- // check if the output file already exists and read it
- // insert all files which exist into the set of files
- cmsys::ifstream oldFilelist(filename.c_str());
- if (oldFilelist) {
- while (cmSystemTools::GetLineFromStream(oldFilelist, tmp)) {
- if (tmp[0] == '/') {
- continue;
- }
- std::string completePath = projectDir + tmp;
- if (cmSystemTools::FileExists(completePath.c_str())) {
- files.insert(tmp);
- }
- }
- oldFilelist.close();
- }
-
- // now write the new filename
- cmGeneratedFileStream fout(filename.c_str());
- if (!fout) {
- return false;
- }
-
- fileToOpen = "";
- for (std::string const& file : files) {
- // get the full path to the file
- tmp = cmSystemTools::CollapseFullPath(file, projectDir.c_str());
- // just select the first source file
- if (fileToOpen.empty()) {
- std::string ext = cmSystemTools::GetFilenameExtension(tmp);
- if ((ext == ".c") || (ext == ".cc") || (ext == ".cpp") ||
- (ext == ".cxx") || (ext == ".C") || (ext == ".h") ||
- (ext == ".hpp")) {
- fileToOpen = tmp;
- }
- }
- // make it relative to the project dir
- cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
- // only put relative paths
- if (!tmp.empty() && tmp[0] != '/') {
- fout << tmp << "\n";
- }
- }
- return true;
-}
-
-/* create the project file, if it already exists, merge it with the
-existing one, otherwise create a new one */
-void cmGlobalKdevelopGenerator::CreateProjectFile(
- const std::string& outputDir, const std::string& projectDir,
- const std::string& projectname, const std::string& executable,
- const std::string& cmakeFilePattern, const std::string& fileToOpen)
-{
- this->Blacklist.clear();
-
- std::string filename = outputDir + "/";
- filename += projectname + ".kdevelop";
- std::string sessionFilename = outputDir + "/";
- sessionFilename += projectname + ".kdevses";
-
- if (cmSystemTools::FileExists(filename.c_str())) {
- this->MergeProjectFiles(outputDir, projectDir, filename, executable,
- cmakeFilePattern, fileToOpen, sessionFilename);
- } else {
- // add all subdirectories which are cmake build directories to the
- // kdevelop blacklist so they are not monitored for added or removed files
- // since this is handled by adding files to the cmake files
- cmsys::Directory d;
- if (d.Load(projectDir)) {
- size_t numf = d.GetNumberOfFiles();
- for (unsigned int i = 0; i < numf; i++) {
- std::string nextFile = d.GetFile(i);
- if ((nextFile != ".") && (nextFile != "..")) {
- std::string tmp = projectDir;
- tmp += "/";
- tmp += nextFile;
- if (cmSystemTools::FileIsDirectory(tmp)) {
- tmp += "/CMakeCache.txt";
- if ((nextFile == "CMakeFiles") ||
- (cmSystemTools::FileExists(tmp.c_str()))) {
- this->Blacklist.push_back(nextFile);
- }
- }
- }
- }
- }
- this->CreateNewProjectFile(outputDir, projectDir, filename, executable,
- cmakeFilePattern, fileToOpen, sessionFilename);
- }
-}
-
-void cmGlobalKdevelopGenerator::MergeProjectFiles(
- const std::string& outputDir, const std::string& projectDir,
- const std::string& filename, const std::string& executable,
- const std::string& cmakeFilePattern, const std::string& fileToOpen,
- const std::string& sessionFilename)
-{
- cmsys::ifstream oldProjectFile(filename.c_str());
- if (!oldProjectFile) {
- this->CreateNewProjectFile(outputDir, projectDir, filename, executable,
- cmakeFilePattern, fileToOpen, sessionFilename);
- return;
- }
-
- /* Read the existing project file (line by line), copy all lines
- into the new project file, except the ones which can be reliably
- set from contents of the CMakeLists.txt */
- std::string tmp;
- std::vector<std::string> lines;
- while (cmSystemTools::GetLineFromStream(oldProjectFile, tmp)) {
- lines.push_back(tmp);
- }
- oldProjectFile.close();
-
- cmGeneratedFileStream fout(filename.c_str());
- if (!fout) {
- return;
- }
-
- for (std::string const& l : lines) {
- const char* line = l.c_str();
- // skip these tags as they are always replaced
- if ((strstr(line, "<projectdirectory>") != nullptr) ||
- (strstr(line, "<projectmanagement>") != nullptr) ||
- (strstr(line, "<absoluteprojectpath>") != nullptr) ||
- (strstr(line, "<filelistdirectory>") != nullptr) ||
- (strstr(line, "<buildtool>") != nullptr) ||
- (strstr(line, "<builddir>") != nullptr)) {
- continue;
- }
-
- // output the line from the file if it is not one of the above tags
- fout << l << "\n";
- // if this is the <general> tag output the stuff that goes in the
- // general tag
- if (strstr(line, "<general>")) {
- fout << " <projectmanagement>KDevCustomProject</projectmanagement>\n";
- fout << " <projectdirectory>" << projectDir
- << "</projectdirectory>\n"; // this one is important
- fout << " <absoluteprojectpath>true</absoluteprojectpath>\n";
- // and this one
- }
- // inside kdevcustomproject the <filelistdirectory> must be put
- if (strstr(line, "<kdevcustomproject>")) {
- fout << " <filelistdirectory>" << outputDir
- << "</filelistdirectory>\n";
- }
- // buildtool and builddir go inside <build>
- if (strstr(line, "<build>")) {
- fout << " <buildtool>make</buildtool>\n";
- fout << " <builddir>" << outputDir << "</builddir>\n";
- }
- }
-}
-
-void cmGlobalKdevelopGenerator::CreateNewProjectFile(
- const std::string& outputDir, const std::string& projectDir,
- const std::string& filename, const std::string& executable,
- const std::string& cmakeFilePattern, const std::string& fileToOpen,
- const std::string& sessionFilename)
-{
- cmGeneratedFileStream fout(filename.c_str());
- if (!fout) {
- return;
- }
- cmXMLWriter xml(fout);
-
- // check for a version control system
- bool hasSvn = cmSystemTools::FileExists((projectDir + "/.svn").c_str());
- bool hasCvs = cmSystemTools::FileExists((projectDir + "/CVS").c_str());
-
- bool enableCxx = (this->GlobalGenerator->GetLanguageEnabled("C") ||
- this->GlobalGenerator->GetLanguageEnabled("CXX"));
- bool enableFortran = this->GlobalGenerator->GetLanguageEnabled("Fortran");
- std::string primaryLanguage = "C++";
- if (enableFortran && !enableCxx) {
- primaryLanguage = "Fortran77";
- }
-
- xml.StartDocument();
- xml.StartElement("kdevelop");
- xml.StartElement("general");
-
- xml.Element("author", "");
- xml.Element("email", "");
- xml.Element("version", "$VERSION$");
- xml.Element("projectmanagement", "KDevCustomProject");
- xml.Element("primarylanguage", primaryLanguage);
- xml.Element("ignoreparts");
- xml.Element("projectdirectory", projectDir); // this one is important
- xml.Element("absoluteprojectpath", "true"); // and this one
-
- // setup additional languages
- xml.StartElement("secondaryLanguages");
- if (enableFortran && enableCxx) {
- xml.Element("language", "Fortran");
- }
- if (enableCxx) {
- xml.Element("language", "C");
- }
- xml.EndElement();
-
- if (hasSvn) {
- xml.Element("versioncontrol", "kdevsubversion");
- } else if (hasCvs) {
- xml.Element("versioncontrol", "kdevcvsservice");
- }
-
- xml.EndElement(); // general
- xml.StartElement("kdevcustomproject");
-
- xml.Element("filelistdirectory", outputDir);
-
- xml.StartElement("run");
- xml.Element("mainprogram", executable);
- xml.Element("directoryradio", "custom");
- xml.Element("customdirectory", outputDir);
- xml.Element("programargs", "");
- xml.Element("terminal", "false");
- xml.Element("autocompile", "true");
- xml.Element("envvars");
- xml.EndElement();
-
- xml.StartElement("build");
- xml.Element("buildtool", "make"); // this one is important
- xml.Element("builddir", outputDir); // and this one
- xml.EndElement();
-
- xml.StartElement("make");
- xml.Element("abortonerror", "false");
- xml.Element("numberofjobs", 1);
- xml.Element("dontact", "false");
- xml.Element("makebin", this->GlobalGenerator->GetLocalGenerators()[0]
- ->GetMakefile()
- ->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"));
- xml.Element("selectedenvironment", "default");
-
- xml.StartElement("environments");
- xml.StartElement("default");
-
- xml.StartElement("envvar");
- xml.Attribute("value", 1);
- xml.Attribute("name", "VERBOSE");
- xml.EndElement();
-
- xml.StartElement("envvar");
- xml.Attribute("value", 1);
- xml.Attribute("name", "CMAKE_NO_VERBOSE");
- xml.EndElement();
-
- xml.EndElement(); // default
- xml.EndElement(); // environments
- xml.EndElement(); // make
-
- xml.StartElement("blacklist");
- for (std::string const& dir : this->Blacklist) {
- xml.Element("path", dir);
- }
- xml.EndElement();
-
- xml.EndElement(); // kdevcustomproject
-
- xml.StartElement("kdevfilecreate");
- xml.Element("filetypes");
- xml.StartElement("useglobaltypes");
-
- xml.StartElement("type");
- xml.Attribute("ext", "ui");
- xml.EndElement();
-
- xml.StartElement("type");
- xml.Attribute("ext", "cpp");
- xml.EndElement();
-
- xml.StartElement("type");
- xml.Attribute("ext", "h");
- xml.EndElement();
-
- xml.EndElement(); // useglobaltypes
- xml.EndElement(); // kdevfilecreate
-
- xml.StartElement("kdevdoctreeview");
- xml.StartElement("projectdoc");
- xml.Element("userdocDir", "html/");
- xml.Element("apidocDir", "html/");
- xml.EndElement(); // projectdoc
- xml.Element("ignoreqt_xml");
- xml.Element("ignoredoxygen");
- xml.Element("ignorekdocs");
- xml.Element("ignoretocs");
- xml.Element("ignoredevhelp");
- xml.EndElement(); // kdevdoctreeview;
-
- if (enableCxx) {
- xml.StartElement("cppsupportpart");
- xml.StartElement("filetemplates");
- xml.Element("interfacesuffix", ".h");
- xml.Element("implementationsuffix", ".cpp");
- xml.EndElement(); // filetemplates
- xml.EndElement(); // cppsupportpart
-
- xml.StartElement("kdevcppsupport");
- xml.StartElement("codecompletion");
- xml.Element("includeGlobalFunctions", "true");
- xml.Element("includeTypes", "true");
- xml.Element("includeEnums", "true");
- xml.Element("includeTypedefs", "false");
- xml.Element("automaticCodeCompletion", "true");
- xml.Element("automaticArgumentsHint", "true");
- xml.Element("automaticHeaderCompletion", "true");
- xml.Element("codeCompletionDelay", 250);
- xml.Element("argumentsHintDelay", 400);
- xml.Element("headerCompletionDelay", 250);
- xml.EndElement(); // codecompletion
- xml.Element("references");
- xml.EndElement(); // kdevcppsupport;
- }
-
- if (enableFortran) {
- xml.StartElement("kdevfortransupport");
- xml.StartElement("ftnchek");
- xml.Element("division", "false");
- xml.Element("extern", "false");
- xml.Element("declare", "false");
- xml.Element("pure", "false");
- xml.Element("argumentsall", "false");
- xml.Element("commonall", "false");
- xml.Element("truncationall", "false");
- xml.Element("usageall", "false");
- xml.Element("f77all", "false");
- xml.Element("portabilityall", "false");
- xml.Element("argumentsonly");
- xml.Element("commononly");
- xml.Element("truncationonly");
- xml.Element("usageonly");
- xml.Element("f77only");
- xml.Element("portabilityonly");
- xml.EndElement(); // ftnchek
- xml.EndElement(); // kdevfortransupport;
- }
-
- // set up file groups. maybe this can be used with the CMake SOURCE_GROUP()
- // command
- xml.StartElement("kdevfileview");
- xml.StartElement("groups");
-
- xml.StartElement("group");
- xml.Attribute("pattern", cmakeFilePattern);
- xml.Attribute("name", "CMake");
- xml.EndElement();
-
- if (enableCxx) {
- xml.StartElement("group");
- xml.Attribute("pattern", "*.h;*.hxx;*.hpp");
- xml.Attribute("name", "Header");
- xml.EndElement();
-
- xml.StartElement("group");
- xml.Attribute("pattern", "*.c");
- xml.Attribute("name", "C Sources");
- xml.EndElement();
-
- xml.StartElement("group");
- xml.Attribute("pattern", "*.cpp;*.C;*.cxx;*.cc");
- xml.Attribute("name", "C++ Sources");
- xml.EndElement();
- }
-
- if (enableFortran) {
- xml.StartElement("group");
- xml.Attribute("pattern",
- "*.f;*.F;*.f77;*.F77;*.f90;*.F90;*.for;*.f95;*.F95");
- xml.Attribute("name", "Fortran Sources");
- xml.EndElement();
- }
-
- xml.StartElement("group");
- xml.Attribute("pattern", "*.ui");
- xml.Attribute("name", "Qt Designer files");
- xml.EndElement();
-
- xml.Element("hidenonprojectfiles", "true");
- xml.EndElement(); // groups
-
- xml.StartElement("tree");
- xml.Element("hidepatterns", "*.o,*.lo,CVS,*~,cmake*");
- xml.Element("hidenonprojectfiles", "true");
- xml.EndElement(); // tree
-
- xml.EndElement(); // kdevfileview
- xml.EndElement(); // kdevelop;
- xml.EndDocument();
-
- if (sessionFilename.empty()) {
- return;
- }
-
- // and a session file, so that kdevelop opens a file if it opens the
- // project the first time
- cmGeneratedFileStream devses(sessionFilename.c_str());
- if (!devses) {
- return;
- }
- cmXMLWriter sesxml(devses);
- sesxml.StartDocument("UTF-8");
- sesxml.Doctype("KDevPrjSession");
- sesxml.StartElement("KDevPrjSession");
-
- sesxml.StartElement("DocsAndViews");
- sesxml.Attribute("NumberOfDocuments", 1);
-
- sesxml.StartElement("Doc0");
- sesxml.Attribute("NumberOfViews", 1);
- sesxml.Attribute("URL", "file://" + fileToOpen);
-
- sesxml.StartElement("View0");
- sesxml.Attribute("line", 0);
- sesxml.Attribute("Type", "Source");
- sesxml.EndElement(); // View0
-
- sesxml.EndElement(); // Doc0
- sesxml.EndElement(); // DocsAndViews
- sesxml.EndElement(); // KDevPrjSession;
-}
diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h
deleted file mode 100644
index d6c43f3..0000000
--- a/Source/cmGlobalKdevelopGenerator.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalKdevelopGenerator_h
-#define cmGlobalKdevelopGenerator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmExternalMakefileProjectGenerator.h"
-
-#include <string>
-#include <vector>
-
-class cmLocalGenerator;
-
-/** \class cmGlobalKdevelopGenerator
- * \brief Write Unix Makefiles accompanied by KDevelop3 project files.
- *
- * cmGlobalKdevelopGenerator produces a project file for KDevelop 3 (KDevelop
- * > 3.1.1). The project is based on the "Custom Makefile based C/C++"
- * project of KDevelop. Such a project consists of Unix Makefiles in the
- * build directory together with a \<your_project\>.kdevelop project file,
- * which contains the project settings and a \<your_project\>.kdevelop.filelist
- * file, which lists the source files relative to the kdevelop project
- * directory. The kdevelop project directory is the base source directory.
- */
-class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator
-{
-public:
- cmGlobalKdevelopGenerator();
-
- static cmExternalMakefileProjectGeneratorFactory* GetFactory();
-
- void Generate() override;
-
-private:
- /*** Create the foo.kdevelop.filelist file, return false if it doesn't
- succeed. If the file already exists the contents will be merged.
- */
- bool CreateFilelistFile(const std::vector<cmLocalGenerator*>& lgs,
- const std::string& outputDir,
- const std::string& projectDirIn,
- const std::string& projectname,
- std::string& cmakeFilePattern,
- std::string& fileToOpen);
-
- /** Create the foo.kdevelop file. This one calls MergeProjectFiles()
- if it already exists, otherwise createNewProjectFile() The project
- files will be created in \a outputDir (in the build tree), the
- kdevelop project dir will be set to \a projectDir (in the source
- tree). \a cmakeFilePattern consists of a lists of all cmake
- listfiles used by this CMakeLists.txt */
- void CreateProjectFile(const std::string& outputDir,
- const std::string& projectDir,
- const std::string& projectname,
- const std::string& executable,
- const std::string& cmakeFilePattern,
- const std::string& fileToOpen);
-
- /*** Reads the old foo.kdevelop line by line and only replaces the
- "important" lines
- */
- void MergeProjectFiles(const std::string& outputDir,
- const std::string& projectDir,
- const std::string& filename,
- const std::string& executable,
- const std::string& cmakeFilePattern,
- const std::string& fileToOpen,
- const std::string& sessionFilename);
- ///! Creates a new foo.kdevelop and a new foo.kdevses file
- void CreateNewProjectFile(const std::string& outputDir,
- const std::string& projectDir,
- const std::string& filename,
- const std::string& executable,
- const std::string& cmakeFilePattern,
- const std::string& fileToOpen,
- const std::string& sessionFilename);
-
- std::vector<std::string> Blacklist;
-};
-
-#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index bd51f60..9db21d8 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -743,6 +743,11 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
if (const char* cflags = sf->GetProperty(COMPILE_FLAGS)) {
lg->AppendFlags(flags, genexInterpreter.Evaluate(cflags, COMPILE_FLAGS));
}
+ const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ if (const char* coptions = sf->GetProperty(COMPILE_OPTIONS)) {
+ lg->AppendCompileOptions(
+ flags, genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS));
+ }
// Add per-source definitions.
BuildObjectListOrString flagsBuild(this, false);
@@ -759,6 +764,16 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
flags += flagsBuild.GetString();
}
+ // Add per-source include directories.
+ std::vector<std::string> includes;
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincludes = sf->GetProperty(INCLUDE_DIRECTORIES)) {
+ lg->AppendIncludeDirectories(
+ includes, genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES),
+ *sf);
+ }
+ lg->AppendFlags(flags, lg->GetIncludeFlags(includes, gtgt, lang, true));
+
cmXCodeObject* buildFile =
this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), gtgt, lang, sf);
@@ -3521,7 +3536,7 @@ void cmGlobalXCodeGenerator::AppendDefines(
}
void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
- std::string const& flag)
+ std::string const& flag) const
{
// Short-circuit for an empty flag.
if (flag.empty()) {
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 2269b25..d173f7a 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -104,7 +104,7 @@ public:
bool ShouldStripResourcePath(cmMakefile*) const override;
bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override;
- void AppendFlag(std::string& flags, std::string const& flag);
+ void AppendFlag(std::string& flags, std::string const& flag) const;
protected:
void AddExtraIDETargets() override;
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 4b59f44..354b757 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -13,6 +13,7 @@ cmIDEOptions::cmIDEOptions()
{
this->DoingDefine = false;
this->AllowDefine = true;
+ this->DoingInclude = false;
this->AllowSlash = false;
this->DoingFollowing = 0;
for (int i = 0; i < FlagTableCount; ++i) {
@@ -33,6 +34,13 @@ void cmIDEOptions::HandleFlag(const char* flag)
return;
}
+ // If the last option was -I then this option is the include directory.
+ if (this->DoingInclude) {
+ this->DoingInclude = false;
+ this->Includes.push_back(flag);
+ return;
+ }
+
// If the last option expected a following value, this is it.
if (this->DoingFollowing) {
this->FlagMapUpdate(this->DoingFollowing, flag);
@@ -53,6 +61,17 @@ void cmIDEOptions::HandleFlag(const char* flag)
}
return;
}
+ // Look for include directory.
+ if (this->AllowInclude && flag[1] == 'I') {
+ if (flag[2] == '\0') {
+ // The next argument will have the include directory.
+ this->DoingInclude = true;
+ } else {
+ // Store this include directory.
+ this->Includes.push_back(flag + 2);
+ }
+ return;
+ }
// Look through the available flag tables.
bool flag_handled = false;
@@ -155,6 +174,29 @@ std::vector<std::string> const& cmIDEOptions::GetDefines() const
return this->Defines;
}
+void cmIDEOptions::AddInclude(const std::string& include)
+{
+ this->Includes.push_back(include);
+}
+
+void cmIDEOptions::AddIncludes(const char* includes)
+{
+ if (includes) {
+ // Expand the list of includes.
+ cmSystemTools::ExpandListArgument(includes, this->Includes);
+ }
+}
+void cmIDEOptions::AddIncludes(const std::vector<std::string>& includes)
+{
+ this->Includes.insert(this->Includes.end(), includes.begin(),
+ includes.end());
+}
+
+std::vector<std::string> const& cmIDEOptions::GetIncludes() const
+{
+ return this->Includes;
+}
+
void cmIDEOptions::AddFlag(std::string const& flag, std::string const& value)
{
this->FlagMap[flag] = value;
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index ded92ca..54cb524 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -20,12 +20,17 @@ public:
cmIDEOptions();
virtual ~cmIDEOptions();
- // Store definitions and flags.
+ // Store definitions, includes and flags.
void AddDefine(const std::string& define);
void AddDefines(const char* defines);
void AddDefines(const std::vector<std::string>& defines);
std::vector<std::string> const& GetDefines() const;
+ void AddInclude(const std::string& includes);
+ void AddIncludes(const char* includes);
+ void AddIncludes(const std::vector<std::string>& includes);
+ std::vector<std::string> const& GetIncludes() const;
+
void AddFlag(std::string const& flag, std::string const& value);
void AddFlag(std::string const& flag, std::vector<std::string> const& value);
void AppendFlag(std::string const& flag, std::string const& value);
@@ -76,8 +81,13 @@ protected:
// Preprocessor definitions.
std::vector<std::string> Defines;
+ // Include directories.
+ std::vector<std::string> Includes;
+
bool DoingDefine;
bool AllowDefine;
+ bool DoingInclude;
+ bool AllowInclude;
bool AllowSlash;
cmIDEFlagTable const* DoingFollowing;
enum
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c8d94c0..86b16f8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmMakefile.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateTypes.h"
@@ -37,6 +38,7 @@
#include <sstream>
#include <stdio.h>
#include <string.h>
+#include <unordered_set>
#include <utility>
#if defined(__HAIKU__)
@@ -792,19 +794,14 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
if (const char* langFlagRegexStr =
this->Makefile->GetDefinition(langFlagRegexVar)) {
// Filter flags acceptable to this language.
- cmsys::RegularExpression r(langFlagRegexStr);
std::vector<std::string> opts;
if (const char* targetFlags = target->GetProperty("COMPILE_FLAGS")) {
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
}
target->GetCompileOptions(opts, config, lang);
- for (std::string const& opt : opts) {
- if (r.find(opt.c_str())) {
- // (Re-)Escape this flag. COMPILE_FLAGS were already parsed
- // as a command line above, and COMPILE_OPTIONS are escaped.
- this->AppendFlagEscape(flags, opt);
- }
- }
+ // (Re-)Escape these flags. COMPILE_FLAGS were already parsed
+ // as a command line above, and COMPILE_OPTIONS are escaped.
+ this->AppendCompileOptions(flags, opts, langFlagRegexStr);
} else {
// Use all flags.
if (const char* targetFlags = target->GetProperty("COMPILE_FLAGS")) {
@@ -813,10 +810,8 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
}
std::vector<std::string> opts;
target->GetCompileOptions(opts, config, lang);
- for (std::string const& opt : opts) {
- // COMPILE_OPTIONS are escaped.
- this->AppendFlagEscape(flags, opt);
- }
+ // COMPILE_OPTIONS are escaped.
+ this->AppendCompileOptions(flags, opts);
}
for (auto const& it : target->GetMaxLanguageStandards()) {
@@ -1876,7 +1871,7 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
}
void cmLocalGenerator::AppendFlags(std::string& flags,
- const std::string& newFlags)
+ const std::string& newFlags) const
{
if (!newFlags.empty()) {
if (!flags.empty()) {
@@ -1886,7 +1881,8 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
}
}
-void cmLocalGenerator::AppendFlags(std::string& flags, const char* newFlags)
+void cmLocalGenerator::AppendFlags(std::string& flags,
+ const char* newFlags) const
{
if (newFlags && *newFlags) {
this->AppendFlags(flags, std::string(newFlags));
@@ -1894,7 +1890,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags, const char* newFlags)
}
void cmLocalGenerator::AppendFlagEscape(std::string& flags,
- const std::string& rawFlag)
+ const std::string& rawFlag) const
{
this->AppendFlags(flags, this->EscapeForShell(rawFlag));
}
@@ -1930,6 +1926,87 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
}
}
+void cmLocalGenerator::AppendCompileOptions(std::string& options,
+ const char* options_list,
+ const char* regex) const
+{
+ // Short-circuit if there are no options.
+ if (!options_list) {
+ return;
+ }
+
+ // Expand the list of options.
+ std::vector<std::string> options_vec;
+ cmSystemTools::ExpandListArgument(options_list, options_vec);
+ this->AppendCompileOptions(options, options_vec, regex);
+}
+
+void cmLocalGenerator::AppendCompileOptions(
+ std::string& options, const std::vector<std::string>& options_vec,
+ const char* regex) const
+{
+ if (regex != nullptr) {
+ // Filter flags upon specified reges.
+ cmsys::RegularExpression r(regex);
+
+ for (std::string const& opt : options_vec) {
+ if (r.find(opt.c_str())) {
+ this->AppendFlagEscape(options, opt);
+ }
+ }
+ } else {
+ for (std::string const& opt : options_vec) {
+ this->AppendFlagEscape(options, opt);
+ }
+ }
+}
+
+void cmLocalGenerator::AppendIncludeDirectories(
+ std::vector<std::string>& includes, const char* includes_list,
+ const cmSourceFile& sourceFile) const
+{
+ // Short-circuit if there are no includes.
+ if (!includes_list) {
+ return;
+ }
+
+ // Expand the list of includes.
+ std::vector<std::string> includes_vec;
+ cmSystemTools::ExpandListArgument(includes_list, includes_vec);
+ this->AppendIncludeDirectories(includes, includes_vec, sourceFile);
+}
+
+void cmLocalGenerator::AppendIncludeDirectories(
+ std::vector<std::string>& includes,
+ const std::vector<std::string>& includes_vec,
+ const cmSourceFile& sourceFile) const
+{
+ std::unordered_set<std::string> uniqueIncludes;
+
+ for (const std::string& include : includes_vec) {
+ if (!cmSystemTools::FileIsFullPath(include.c_str())) {
+ std::ostringstream e;
+ e << "Found relative path while evaluating include directories of "
+ "\""
+ << sourceFile.GetLocation().GetName() << "\":\n \"" << include
+ << "\"\n";
+
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+
+ std::string inc = include;
+
+ if (!cmSystemTools::IsOff(inc.c_str())) {
+ cmSystemTools::ConvertToUnixSlashes(inc);
+ }
+
+ if (uniqueIncludes.insert(inc).second) {
+ includes.push_back(inc);
+ }
+ }
+}
+
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
const char* defines_list) const
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 4a7d2ca..a66fa6e 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -118,10 +118,11 @@ public:
cmGeneratorTarget const* target,
const std::string& lang);
///! Append flags to a string.
- virtual void AppendFlags(std::string& flags, const std::string& newFlags);
- virtual void AppendFlags(std::string& flags, const char* newFlags);
+ virtual void AppendFlags(std::string& flags,
+ const std::string& newFlags) const;
+ virtual void AppendFlags(std::string& flags, const char* newFlags) const;
virtual void AppendFlagEscape(std::string& flags,
- const std::string& rawFlag);
+ const std::string& rawFlag) const;
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
@@ -152,6 +153,23 @@ public:
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
/**
+ * Process a list of include directories
+ */
+ void AppendIncludeDirectories(std::vector<std::string>& includes,
+ const char* includes_list,
+ const cmSourceFile& sourceFile) const;
+ void AppendIncludeDirectories(std::vector<std::string>& includes,
+ std::string const& includes_list,
+ const cmSourceFile& sourceFile) const
+ {
+ this->AppendIncludeDirectories(includes, includes_list.c_str(),
+ sourceFile);
+ }
+ void AppendIncludeDirectories(std::vector<std::string>& includes,
+ const std::vector<std::string>& includes_vec,
+ const cmSourceFile& sourceFile) const;
+
+ /**
* Encode a list of preprocessor definitions for the compiler
* command line.
*/
@@ -166,6 +184,22 @@ public:
const std::vector<std::string>& defines_vec) const;
/**
+ * Encode a list of compile options for the compiler
+ * command line.
+ */
+ void AppendCompileOptions(std::string& options, const char* options_list,
+ const char* regex = nullptr) const;
+ void AppendCompileOptions(std::string& options,
+ std::string const& options_list,
+ const char* regex = nullptr) const
+ {
+ this->AppendCompileOptions(options, options_list.c_str(), regex);
+ }
+ void AppendCompileOptions(std::string& options,
+ const std::vector<std::string>& options_vec,
+ const char* regex = nullptr) const;
+
+ /**
* Join a set of defines into a definesString with a space separator.
*/
void JoinDefines(const std::set<std::string>& defines,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 28890f0..e2d5322 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -830,8 +830,8 @@ std::string cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(
return dir;
}
-void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
- const std::string& newFlags)
+void cmLocalUnixMakefileGenerator3::AppendFlags(
+ std::string& flags, const std::string& newFlags) const
{
if (this->IsWatcomWMake() && !newFlags.empty()) {
std::string newf = newFlags;
@@ -845,7 +845,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
}
void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
- const char* newFlags)
+ const char* newFlags) const
{
this->cmLocalGenerator::AppendFlags(flags, newFlags);
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index b149524..86c5aab 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -88,8 +88,9 @@ public:
const std::string& tgt);
// append flags to a string
- void AppendFlags(std::string& flags, const std::string& newFlags) override;
- void AppendFlags(std::string& flags, const char* newFlags) override;
+ void AppendFlags(std::string& flags,
+ const std::string& newFlags) const override;
+ void AppendFlags(std::string& flags, const char* newFlags) const override;
// append an echo command
enum EchoColor
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 59c20a9..f38cd79 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -45,15 +45,6 @@ public:
extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[];
-static void cmConvertToWindowsSlash(std::string& s)
-{
- std::string::size_type pos = 0;
- while ((pos = s.find('/', pos)) != std::string::npos) {
- s[pos] = '\\';
- pos++;
- }
-}
-
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(
cmGlobalGenerator* gg, cmMakefile* mf)
: cmLocalVisualStudioGenerator(gg, mf)
@@ -704,11 +695,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str());
targetOptions.ParseFinish();
- std::vector<std::string> targetDefines;
if (!langForClCompile.empty()) {
+ std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines, configName, langForClCompile);
+ targetOptions.AddDefines(targetDefines);
+
+ std::vector<std::string> targetIncludes;
+ this->GetIncludeDirectories(targetIncludes, target, langForClCompile,
+ configName);
+ targetOptions.AddIncludes(targetIncludes);
}
- targetOptions.AddDefines(targetDefines);
targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
@@ -795,27 +791,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
<< this->ConvertToXMLOutputPath(modDir.c_str())
<< "\\$(ConfigurationName)\"\n";
}
- fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
- std::vector<std::string> includes_cl;
- if (!langForClCompile.empty()) {
- this->GetIncludeDirectories(includes_cl, target, langForClCompile,
- configName);
- }
- std::vector<std::string>::iterator i = includes_cl.begin();
- for (; i != includes_cl.end(); ++i) {
- // output the include path
- std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
- fout << ipath << ";";
- // if this is fortran then output the include with
- // a ConfigurationName on the end of it.
- if (this->FortranProject) {
- ipath = i->c_str();
- ipath += "/$(ConfigurationName)";
- ipath = this->ConvertToXMLOutputPath(ipath.c_str());
- fout << ipath << ";";
- }
- }
- fout << "\"\n";
+ targetOptions.OutputAdditionalIncludeDirectories(
+ fout, "\t\t\t\t", "\n",
+ this->FortranProject ? "Fortran" : langForClCompile);
targetOptions.OutputFlagMap(fout, "\t\t\t\t");
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n",
langForClCompile);
@@ -835,20 +813,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
fout <<
"\t\t\t<Tool\n"
"\t\t\t\tName=\"MASM\"\n"
- "\t\t\t\tIncludePaths=\""
;
- std::vector<std::string> includes_masm;
- this->GetIncludeDirectories(includes_masm, target, "ASM_MASM",
- configName);
/* clang-format on */
- const char* sep = "";
- for (i = includes_masm.begin(); i != includes_masm.end(); ++i) {
- std::string inc = *i;
- cmConvertToWindowsSlash(inc);
- fout << sep << this->EscapeForXML(inc);
- sep = ";";
- }
- fout << "\"\n";
+ targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t", "\n",
+ "ASM_MASM");
// Use same preprocessor definitions as VCCLCompilerTool.
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n",
"ASM_MASM");
@@ -868,16 +836,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
if (this->FortranProject) {
tool = "VFResourceCompilerTool";
}
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"
- << "\t\t\t\tAdditionalIncludeDirectories=\"";
- std::vector<std::string> includes_rc;
- this->GetIncludeDirectories(includes_rc, target, "RC", configName);
- for (i = includes_rc.begin(); i != includes_rc.end(); ++i) {
- std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
- fout << ipath << ";";
- }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
+ targetOptions.OutputAdditionalIncludeDirectories(fout, "\n\t\t\t\t", "",
+ "RC");
// add the -D flags to the RC tool
- fout << "\"";
targetOptions.OutputPreprocessorDefinitions(fout, "\n\t\t\t\t", "", "RC");
fout << "/>\n";
tool = "VCMIDLTool";
@@ -885,14 +847,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
tool = "VFMIDLTool";
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
- fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
- std::vector<std::string> includes_midl;
- this->GetIncludeDirectories(includes_midl, target, "MIDL", configName);
- for (i = includes_midl.begin(); i != includes_midl.end(); ++i) {
- std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
- fout << ipath << ";";
- }
- fout << "\"\n";
+ targetOptions.OutputAdditionalIncludeDirectories(fout, "\n\t\t\t\t", "",
+ "MIDL");
fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n";
if (gg->GetPlatformName() == "x64") {
fout << "\t\t\t\tTargetEnvironment=\"3\"\n";
@@ -1410,7 +1366,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// Add the file to the list of sources.
std::string const source = sf->GetFullPath();
cmSourceGroup* sourceGroup =
- this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+ this->Makefile->FindSourceGroup(source, sourceGroups);
sourceGroup->AssignSource(sf);
}
@@ -1440,6 +1396,7 @@ struct cmLVS7GFileConfig
std::string CompileDefs;
std::string CompileDefsConfig;
std::string AdditionalDeps;
+ std::string IncludeDirs;
bool ExcludedFromBuild;
};
@@ -1494,6 +1451,12 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
fc.CompileFlags = genexInterpreter.Evaluate(cflags, COMPILE_FLAGS);
needfc = true;
}
+ const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ if (const char* coptions = sf.GetProperty(COMPILE_OPTIONS)) {
+ lg->AppendCompileOptions(
+ fc.CompileFlags, genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS));
+ needfc = true;
+ }
if (lg->FortranProject) {
switch (cmOutputConverter::GetFortranFormat(
sf.GetProperty("Fortran_FORMAT"))) {
@@ -1522,6 +1485,12 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
needfc = true;
}
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincs = sf.GetProperty(INCLUDE_DIRECTORIES)) {
+ fc.IncludeDirs = genexInterpreter.Evaluate(cincs, INCLUDE_DIRECTORIES);
+ needfc = true;
+ }
+
// Check for extra object-file dependencies.
if (const char* deps = sf.GetProperty("OBJECT_DEPENDS")) {
std::vector<std::string> depends;
@@ -1652,7 +1621,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
this->WriteCustomRule(fout, configs, source.c_str(), *command, fcinfo);
} else if (!fcinfo.FileConfigMap.empty()) {
const char* aCompilerTool = "VCCLCompilerTool";
- const char* ppLang = "CXX";
+ std::string ppLang = "CXX";
if (this->FortranProject) {
aCompilerTool = "VFFortranCompilerTool";
}
@@ -1699,7 +1668,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n";
if (!fc.CompileFlags.empty() || !fc.CompileDefs.empty() ||
- !fc.CompileDefsConfig.empty()) {
+ !fc.CompileDefsConfig.empty() || !fc.IncludeDirs.empty()) {
Options::Tool tool = Options::Compiler;
cmVS7FlagTable const* table =
cmLocalVisualStudio7GeneratorFlagTable;
@@ -1711,7 +1680,14 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
fileOptions.Parse(fc.CompileFlags.c_str());
fileOptions.AddDefines(fc.CompileDefs.c_str());
fileOptions.AddDefines(fc.CompileDefsConfig.c_str());
+ // validate source level include directories
+ std::vector<std::string> includes;
+ this->AppendIncludeDirectories(includes, fc.IncludeDirs, **sf);
+ fileOptions.AddIncludes(includes);
fileOptions.OutputFlagMap(fout, "\t\t\t\t\t");
+ fileOptions.OutputAdditionalIncludeDirectories(
+ fout, "\t\t\t\t\t", "\n",
+ ppLang == "CXX" && this->FortranProject ? "Fortran" : ppLang);
fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t", "\n",
ppLang);
}
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 457d1fd..92c958d 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -31,10 +31,10 @@ std::string cmLocalXCodeGenerator::GetTargetDirectory(
}
void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags,
- const std::string& rawFlag)
+ const std::string& rawFlag) const
{
- cmGlobalXCodeGenerator* gg =
- static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator);
+ const cmGlobalXCodeGenerator* gg =
+ static_cast<const cmGlobalXCodeGenerator*>(this->GlobalGenerator);
gg->AppendFlag(flags, rawFlag);
}
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 8c9596f..5c22dcf 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -31,7 +31,7 @@ public:
std::string GetTargetDirectory(
cmGeneratorTarget const* target) const override;
void AppendFlagEscape(std::string& flags,
- const std::string& rawFlag) override;
+ const std::string& rawFlag) const override;
void Generate() override;
virtual void GenerateInstallRules();
void ComputeObjectFilenames(
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eeeb54f..c12cd9e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -664,7 +664,7 @@ struct file_not_persistent
bool operator()(const std::string& path) const
{
return !(path.find("CMakeTmp") == std::string::npos &&
- cmSystemTools::FileExists(path.c_str()));
+ cmSystemTools::FileExists(path));
}
};
}
@@ -755,8 +755,9 @@ void cmMakefile::AddCustomCommandToTarget(
return;
}
+ cmTarget& t = ti->second;
if (objLibraryCommands == RejectObjectLibraryCommands &&
- ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) {
+ t.GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Target \"" << target
<< "\" is an OBJECT library "
@@ -764,7 +765,7 @@ void cmMakefile::AddCustomCommandToTarget(
this->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
- if (ti->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "Target \"" << target
<< "\" is an INTERFACE library "
@@ -791,13 +792,13 @@ void cmMakefile::AddCustomCommandToTarget(
cc.SetDepfile(depfile);
switch (type) {
case cmTarget::PRE_BUILD:
- ti->second.AddPreBuildCommand(cc);
+ t.AddPreBuildCommand(cc);
break;
case cmTarget::PRE_LINK:
- ti->second.AddPreLinkCommand(cc);
+ t.AddPreLinkCommand(cc);
break;
case cmTarget::POST_BUILD:
- ti->second.AddPostBuildCommand(cc);
+ t.AddPostBuildCommand(cc);
break;
}
}
@@ -1180,14 +1181,14 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
static cmsys::RegularExpression valid("^[-/]D[A-Za-z_][A-Za-z0-9_]*(=.*)?$");
// Make sure the definition matches.
- if (!valid.find(def.c_str())) {
+ if (!valid.find(def)) {
return false;
}
// Definitions with non-trivial values require a policy check.
static cmsys::RegularExpression trivial(
"^[-/]D[A-Za-z_][A-Za-z0-9_]*(=[A-Za-z0-9_.]+)?$");
- if (!trivial.find(def.c_str())) {
+ if (!trivial.find(def)) {
// This definition has a non-trivial value.
switch (this->GetPolicyStatus(cmPolicies::CMP0005)) {
case cmPolicies::WARN:
@@ -1409,9 +1410,9 @@ void cmMakefile::Configure()
// make sure the CMakeFiles dir is there
std::string filesDir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
filesDir += cmake::GetCMakeFilesDirectory();
- cmSystemTools::MakeDirectory(filesDir.c_str());
+ cmSystemTools::MakeDirectory(filesDir);
- assert(cmSystemTools::FileExists(currentStart.c_str(), true));
+ assert(cmSystemTools::FileExists(currentStart, true));
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
cmListFile listFile;
@@ -1572,7 +1573,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
newSnapshot.GetDirectory().SetCurrentSource(srcPath);
newSnapshot.GetDirectory().SetCurrentBinary(binPath);
- cmSystemTools::MakeDirectory(binPath.c_str());
+ cmSystemTools::MakeDirectory(binPath);
cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
this->GetGlobalGenerator()->AddMakefile(subMf);
@@ -1876,7 +1877,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
return target;
}
-cmTarget* cmMakefile::AddExecutable(const char* exeName,
+cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
const std::vector<std::string>& srcs,
bool excludeFromAll)
{
@@ -1936,7 +1937,7 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
{
// If the queried path is not absolute we use the backward compatible
// linear-time search for an output with a matching suffix.
- if (!cmSystemTools::FileIsFullPath(name.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(name)) {
return this->LinearGetSourceFileWithOutput(name);
}
// Otherwise we use an efficient lookup map.
@@ -2055,7 +2056,7 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
* inherited ones.
*/
cmSourceGroup* cmMakefile::FindSourceGroup(
- const char* source, std::vector<cmSourceGroup>& groups) const
+ const std::string& source, std::vector<cmSourceGroup>& groups) const
{
// First search for a group that lists the file explicitly.
for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
@@ -3232,7 +3233,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
this->IsSourceFileTryCompile = fast;
// does the binary directory exist ? If not create it...
if (!cmSystemTools::FileIsDirectory(bindir)) {
- cmSystemTools::MakeDirectory(bindir.c_str());
+ cmSystemTools::MakeDirectory(bindir);
}
// change to the tests directory and run cmake
@@ -3410,7 +3411,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
cmSystemTools::ConvertToUnixSlashes(itempl);
itempl += "/";
itempl += filename;
- if (cmSystemTools::FileExists(itempl.c_str())) {
+ if (cmSystemTools::FileExists(itempl)) {
moduleInCMakeModulePath = itempl;
break;
}
@@ -3422,7 +3423,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
moduleInCMakeRoot += "/Modules/";
moduleInCMakeRoot += filename;
cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot);
- if (!cmSystemTools::FileExists(moduleInCMakeRoot.c_str())) {
+ if (!cmSystemTools::FileExists(moduleInCMakeRoot)) {
moduleInCMakeRoot.clear();
}
@@ -3554,11 +3555,11 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
this->AddCMakeOutputFile(soutfile);
mode_t perm = 0;
- cmSystemTools::GetPermissions(sinfile.c_str(), perm);
+ cmSystemTools::GetPermissions(sinfile, perm);
std::string::size_type pos = soutfile.rfind('/');
if (pos != std::string::npos) {
std::string path = soutfile.substr(0, pos);
- cmSystemTools::MakeDirectory(path.c_str());
+ cmSystemTools::MakeDirectory(path);
}
if (copyonly) {
@@ -3618,7 +3619,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
soutfile.c_str())) {
res = 0;
} else {
- cmSystemTools::SetPermissions(soutfile.c_str(), perm);
+ cmSystemTools::SetPermissions(soutfile, perm);
}
cmSystemTools::RemoveFile(tempOutputFile);
}
@@ -3707,7 +3708,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
cmSystemTools::ExpandListArgument(deps_str, deps);
}
for (std::string const& dep : deps) {
- if (cmSystemTools::FileIsFullPath(dep.c_str())) {
+ if (cmSystemTools::FileIsFullPath(dep)) {
this->AddCMakeDependFile(dep);
} else {
std::string f = this->GetCurrentSourceDirectory();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index f06e2ff..2721277 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -180,7 +180,7 @@ public:
/**
* Add an executable to the build.
*/
- cmTarget* AddExecutable(const char* exename,
+ cmTarget* AddExecutable(const std::string& exename,
const std::vector<std::string>& srcs,
bool excludeFromAll = false);
@@ -516,7 +516,7 @@ public:
/**
* find what source group this source is in
*/
- cmSourceGroup* FindSourceGroup(const char* source,
+ cmSourceGroup* FindSourceGroup(const std::string& source,
std::vector<cmSourceGroup>& groups) const;
#endif
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 002cc0f..5d80e77 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -445,10 +445,35 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
<< "\n";
}
+ const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ if (const char* coptions = source.GetProperty(COMPILE_OPTIONS)) {
+ const char* evaluatedOptions =
+ genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS);
+ this->LocalGenerator->AppendCompileOptions(flags, evaluatedOptions);
+ *this->FlagFileStream << "# Custom options: " << relativeObj
+ << "_OPTIONS = " << evaluatedOptions << "\n"
+ << "\n";
+ }
+
+ // Add include directories from source file properties.
+ std::vector<std::string> includes;
+
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincludes = source.GetProperty(INCLUDE_DIRECTORIES)) {
+ const char* evaluatedIncludes =
+ genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES);
+ this->LocalGenerator->AppendIncludeDirectories(includes, evaluatedIncludes,
+ source);
+ *this->FlagFileStream << "# Custom include directories: " << relativeObj
+ << "_INCLUDE_DIRECTORIES = " << evaluatedIncludes
+ << "\n"
+ << "\n";
+ }
+
// Add language-specific defines.
std::set<std::string> defines;
- // Add source-sepcific preprocessor definitions.
+ // Add source-specific preprocessor definitions.
const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (const char* compile_defs = source.GetProperty(COMPILE_DEFINITIONS)) {
const char* evaluatedDefs =
@@ -565,7 +590,10 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
vars.Defines = definesString.c_str();
- std::string const includesString = "$(" + lang + "_INCLUDES)";
+ std::string includesString = this->LocalGenerator->GetIncludeFlags(
+ includes, this->GeneratorTarget, lang, true, false, config);
+ this->LocalGenerator->AppendFlags(includesString,
+ "$(" + lang + "_INCLUDES)");
vars.Includes = includesString.c_str();
// At the moment, it is assumed that C, C++, Fortran, and CUDA have both
@@ -1625,10 +1653,17 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
}
if (useResponseFile) {
+ std::string const responseFlagVar =
+ "CMAKE_" + lang + "_RESPONSE_FILE_FLAG";
+ std::string responseFlag =
+ this->Makefile->GetSafeDefinition(responseFlagVar);
+ if (responseFlag.empty()) {
+ responseFlag = "@";
+ }
std::string name = "includes_";
name += lang;
name += ".rsp";
- std::string arg = "@" +
+ std::string arg = std::move(responseFlag) +
this->CreateResponseFile(name.c_str(), includeFlags,
this->FlagFileDepends[lang]);
this->LocalGenerator->AppendFlags(flags, arg);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index f967168..a442463 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -135,16 +135,23 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
}
// Add source file specific flags.
+ cmGeneratorExpressionInterpreter genexInterpreter(
+ this->LocalGenerator, this->GeneratorTarget,
+ this->LocalGenerator->GetConfigName(), this->GeneratorTarget->GetName(),
+ language);
+
const std::string COMPILE_FLAGS("COMPILE_FLAGS");
if (const char* cflags = source->GetProperty(COMPILE_FLAGS)) {
- cmGeneratorExpressionInterpreter genexInterpreter(
- this->LocalGenerator, this->GeneratorTarget,
- this->LocalGenerator->GetConfigName(), this->GeneratorTarget->GetName(),
- language);
this->LocalGenerator->AppendFlags(
flags, genexInterpreter.Evaluate(cflags, COMPILE_FLAGS));
}
+ const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ if (const char* coptions = source->GetProperty(COMPILE_OPTIONS)) {
+ this->LocalGenerator->AppendCompileOptions(
+ flags, genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS));
+ }
+
return flags;
}
@@ -204,6 +211,30 @@ std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source,
return definesString;
}
+std::string cmNinjaTargetGenerator::ComputeIncludes(
+ cmSourceFile const* source, const std::string& language)
+{
+ std::vector<std::string> includes;
+ const std::string config = this->LocalGenerator->GetConfigName();
+ cmGeneratorExpressionInterpreter genexInterpreter(
+ this->LocalGenerator, this->GeneratorTarget, config,
+ this->GeneratorTarget->GetName(), language);
+
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincludes = source->GetProperty(INCLUDE_DIRECTORIES)) {
+ this->LocalGenerator->AppendIncludeDirectories(
+ includes, genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES),
+ *source);
+ }
+
+ std::string includesString = this->LocalGenerator->GetIncludeFlags(
+ includes, this->GeneratorTarget, language, true, false, config);
+ this->LocalGenerator->AppendFlags(includesString,
+ this->GetIncludes(language));
+
+ return includesString;
+}
+
cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
{
// Static libraries never depend on other targets for linking.
@@ -416,14 +447,20 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string flags = "$FLAGS";
std::string rspfile;
std::string rspcontent;
- std::string responseFlag;
bool const lang_supports_response = !(lang == "RC" || lang == "CUDA");
if (lang_supports_response && this->ForceResponseFile()) {
+ std::string const responseFlagVar =
+ "CMAKE_" + lang + "_RESPONSE_FILE_FLAG";
+ std::string responseFlag =
+ this->Makefile->GetSafeDefinition(responseFlagVar);
+ if (responseFlag.empty()) {
+ responseFlag = "@";
+ }
rspfile = "$RSP_FILE";
- responseFlag = "@" + rspfile;
+ responseFlag += rspfile;
rspcontent = " $DEFINES $INCLUDES $FLAGS";
- flags = responseFlag;
+ flags = std::move(responseFlag);
vars.Defines = "";
vars.Includes = "";
}
@@ -818,7 +855,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmNinjaVars vars;
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
- vars["INCLUDES"] = this->GetIncludes(language);
+ vars["INCLUDES"] = this->ComputeIncludes(source, language);
if (!this->NeedDepTypeMSVC(language)) {
vars["DEP_FILE"] = this->GetLocalGenerator()->ConvertToOutputFormat(
objectFileName + ".d", cmOutputConverter::SHELL);
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 770a99d..4660a3a 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -82,6 +82,9 @@ protected:
std::string ComputeDefines(cmSourceFile const* source,
const std::string& language);
+ std::string ComputeIncludes(cmSourceFile const* source,
+ const std::string& language);
+
std::string ConvertToNinjaPath(const std::string& path) const
{
return this->GetGlobalGenerator()->ConvertToNinjaPath(path);
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 4c0a354..371d536 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -266,8 +266,8 @@ static void setErrorMessage(std::string* errorMessage, const std::string& text)
}
}
-static bool testHomeDirectory(cmState* state, std::string& value,
- std::string* errorMessage)
+static bool getOrTestHomeDirectory(cmState* state, std::string& value,
+ std::string* errorMessage)
{
const std::string cachedValue =
std::string(state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"));
@@ -288,9 +288,10 @@ static bool testHomeDirectory(cmState* state, std::string& value,
return true;
}
-static bool testValue(cmState* state, const std::string& key,
- std::string& value, const std::string& keyDescription,
- std::string* errorMessage)
+static bool getOrTestValue(cmState* state, const std::string& key,
+ std::string& value,
+ const std::string& keyDescription,
+ std::string* errorMessage)
{
const char* entry = state->GetCacheEntryValue(key);
const std::string cachedValue =
@@ -337,31 +338,31 @@ bool cmServerProtocol1::DoActivate(const cmServerRequest& request,
cmState* state = cm->GetState();
// Check generator:
- if (!testValue(state, "CMAKE_GENERATOR", generator, "generator",
- errorMessage)) {
+ if (!getOrTestValue(state, "CMAKE_GENERATOR", generator, "generator",
+ errorMessage)) {
return false;
}
// check extra generator:
- if (!testValue(state, "CMAKE_EXTRA_GENERATOR", extraGenerator,
- "extra generator", errorMessage)) {
+ if (!getOrTestValue(state, "CMAKE_EXTRA_GENERATOR", extraGenerator,
+ "extra generator", errorMessage)) {
return false;
}
// check sourcedir:
- if (!testHomeDirectory(state, sourceDirectory, errorMessage)) {
+ if (!getOrTestHomeDirectory(state, sourceDirectory, errorMessage)) {
return false;
}
// check toolset:
- if (!testValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset",
- errorMessage)) {
+ if (!getOrTestValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset",
+ errorMessage)) {
return false;
}
// check platform:
- if (!testValue(state, "CMAKE_GENERATOR_PLATFORM", platform, "platform",
- errorMessage)) {
+ if (!getOrTestValue(state, "CMAKE_GENERATOR_PLATFORM", platform,
+ "platform", errorMessage)) {
return false;
}
}
@@ -708,9 +709,31 @@ static Json::Value DumpSourceFilesList(
lg->AppendFlags(compileFlags,
genexInterpreter.Evaluate(cflags, COMPILE_FLAGS));
}
+ const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
+ if (const char* coptions = file->GetProperty(COMPILE_OPTIONS)) {
+ lg->AppendCompileOptions(
+ compileFlags, genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS));
+ }
fileData.Flags = compileFlags;
- fileData.IncludePathList = ld.IncludePathList;
+ // Add include directories from source file properties.
+ std::vector<std::string> includes;
+
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincludes = file->GetProperty(INCLUDE_DIRECTORIES)) {
+ const char* evaluatedIncludes =
+ genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES);
+ lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file);
+
+ for (const auto& include : includes) {
+ fileData.IncludePathList.push_back(std::make_pair(
+ include, target->IsSystemIncludeDirectory(include, config)));
+ }
+ }
+
+ fileData.IncludePathList.insert(fileData.IncludePathList.end(),
+ ld.IncludePathList.begin(),
+ ld.IncludePathList.end());
const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
std::set<std::string> defines;
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index bdef3e5..479ecd2 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -386,6 +386,12 @@ void cmStateSnapshot::InitializeFromParent()
parent->BuildSystemDirectory->CompileOptionsBacktraces,
this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
this->Position->CompileOptionsPosition);
+
+ const char* include_regex =
+ parent->BuildSystemDirectory->Properties.GetPropertyValue(
+ "INCLUDE_REGULAR_EXPRESSION");
+ this->Position->BuildSystemDirectory->Properties.SetProperty(
+ "INCLUDE_REGULAR_EXPRESSION", include_regex);
}
cmState* cmStateSnapshot::GetState() const
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 06b0b3c..ce08465 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2107,8 +2107,12 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
(void)argv0; // ignore this on windows
wchar_t modulepath[_MAX_PATH];
::GetModuleFileNameW(NULL, modulepath, sizeof(modulepath));
- exe_dir =
- cmSystemTools::GetFilenamePath(cmsys::Encoding::ToNarrow(modulepath));
+ std::string path = cmsys::Encoding::ToNarrow(modulepath);
+ std::string realPath = cmSystemTools::GetRealPath(path, NULL);
+ if (realPath.empty()) {
+ realPath = path;
+ }
+ exe_dir = cmSystemTools::GetFilenamePath(realPath);
#elif defined(__APPLE__)
(void)argv0; // ignore this on OS X
#define CM_EXE_PATH_LOCAL_SIZE 16384
diff --git a/Source/cmUtils.hxx b/Source/cmUtils.hxx
index c5c767c..a7a3e81 100644
--- a/Source/cmUtils.hxx
+++ b/Source/cmUtils.hxx
@@ -7,7 +7,7 @@
// Use the make system's VERBOSE environment variable to enable
// verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
-// (which is set by the Eclipse and KDevelop generators).
+// (which is set by the Eclipse generator).
inline bool isCMakeVerbose()
{
return (cmSystemTools::HasEnv("VERBOSE") &&
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a511337..4555358 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -114,22 +114,6 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
{
- for (OptionsMap::iterator i = this->ClOptions.begin();
- i != this->ClOptions.end(); ++i) {
- delete i->second;
- }
- for (OptionsMap::iterator i = this->LinkOptions.begin();
- i != this->LinkOptions.end(); ++i) {
- delete i->second;
- }
- for (OptionsMap::iterator i = this->CudaOptions.begin();
- i != this->CudaOptions.end(); ++i) {
- delete i->second;
- }
- for (OptionsMap::iterator i = this->CudaLinkOptions.begin();
- i != this->CudaLinkOptions.end(); ++i) {
- delete i->second;
- }
if (!this->BuildFileStream) {
return;
}
@@ -1366,7 +1350,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
si != sources.end(); ++si) {
std::string const& source = si->Source->GetFullPath();
cmSourceGroup* sourceGroup =
- this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+ this->Makefile->FindSourceGroup(source, sourceGroups);
groupsUsed.insert(sourceGroup);
}
@@ -1538,7 +1522,7 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources(
cmSourceFile const* sf = s.SourceFile;
std::string const& source = sf->GetFullPath();
cmSourceGroup* sourceGroup =
- this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+ this->Makefile->FindSourceGroup(source, sourceGroups);
std::string const& filter = sourceGroup->GetFullName();
this->WriteString("<", 2);
std::string path = this->ConvertPath(source, s.RelativePath);
@@ -2036,18 +2020,32 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
std::string flags;
bool configDependentFlags = false;
+ std::string options;
+ bool configDependentOptions = false;
std::string defines;
bool configDependentDefines = false;
+ std::string includes;
+ bool configDependentIncludes = false;
if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
configDependentFlags =
cmGeneratorExpression::Find(cflags) != std::string::npos;
flags += cflags;
}
+ if (const char* coptions = sf.GetProperty("COMPILE_OPTIONS")) {
+ configDependentOptions =
+ cmGeneratorExpression::Find(coptions) != std::string::npos;
+ options += coptions;
+ }
if (const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) {
configDependentDefines =
cmGeneratorExpression::Find(cdefs) != std::string::npos;
defines += cdefs;
}
+ if (const char* cincludes = sf.GetProperty("INCLUDE_DIRECTORIES")) {
+ configDependentIncludes =
+ cmGeneratorExpression::Find(cincludes) != std::string::npos;
+ includes += cincludes;
+ }
std::string lang =
this->GlobalGenerator->GetLanguageFromExtension(sf.GetExtension().c_str());
std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
@@ -2099,7 +2097,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
// if we have flags or defines for this config then
// use them
- if (!flags.empty() || !configDefines.empty() || compileAs || noWinRT) {
+ if (!flags.empty() || !options.empty() || !configDefines.empty() ||
+ !includes.empty() || compileAs || noWinRT) {
(*this->BuildFileStream) << firstString;
firstString = ""; // only do firstString once
hasFlags = true;
@@ -2137,9 +2136,16 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
} else {
clOptions.Parse(flags.c_str());
}
- if (clOptions.HasFlag("AdditionalIncludeDirectories")) {
- clOptions.AppendFlag("AdditionalIncludeDirectories",
- "%(AdditionalIncludeDirectories)");
+ if (!options.empty()) {
+ std::string expandedOptions;
+ if (configDependentOptions) {
+ this->LocalGenerator->AppendCompileOptions(
+ expandedOptions,
+ genexInterpreter.Evaluate(options, "COMPILE_OPTIONS"));
+ } else {
+ this->LocalGenerator->AppendCompileOptions(expandedOptions, options);
+ }
+ clOptions.Parse(expandedOptions.c_str());
}
if (clOptions.HasFlag("DisableSpecificWarnings")) {
clOptions.AppendFlag("DisableSpecificWarnings",
@@ -2151,9 +2157,21 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
} else {
clOptions.AddDefines(configDefines.c_str());
}
+ std::vector<std::string> includeList;
+ if (configDependentIncludes) {
+ this->LocalGenerator->AppendIncludeDirectories(
+ includeList,
+ genexInterpreter.Evaluate(includes, "INCLUDE_DIRECTORIES"), *source);
+ } else {
+ this->LocalGenerator->AppendIncludeDirectories(includeList, includes,
+ *source);
+ }
+ clOptions.AddIncludes(includeList);
clOptions.SetConfiguration(config.c_str());
clOptions.PrependInheritedString("AdditionalOptions");
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
+ clOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
+ " ", "\n", lang);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", lang);
}
@@ -2446,6 +2464,13 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
break;
}
clOptions.AddDefines(targetDefines);
+
+ // Get includes for this target
+ if (!this->LangForClCompile.empty()) {
+ clOptions.AddIncludes(
+ this->GetIncludes(configName, this->LangForClCompile));
+ }
+
if (this->MSTools) {
clOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
@@ -2497,7 +2522,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- this->ClOptions[configName] = pOptions.release();
+ this->ClOptions[configName] = std::move(pOptions);
return true;
}
@@ -2510,14 +2535,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
}
this->WriteString("<ClCompile>\n", 2);
clOptions.PrependInheritedString("AdditionalOptions");
- if (!this->LangForClCompile.empty()) {
- std::vector<std::string> const includes =
- this->GetIncludes(configName, this->LangForClCompile);
- clOptions.AppendFlag("AdditionalIncludeDirectories", includes);
- }
- clOptions.AppendFlag("AdditionalIncludeDirectories",
- "%(AdditionalIncludeDirectories)");
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
+ clOptions.OutputAdditionalIncludeDirectories(
+ *this->BuildFileStream, " ", "\n", this->LangForClCompile);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", this->LangForClCompile);
@@ -2595,7 +2615,10 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
Options& clOptions = *(this->ClOptions[configName]);
rcOptions.AddDefines(clOptions.GetDefines());
- this->RcOptions[configName] = pOptions.release();
+ // Get includes for this target
+ rcOptions.AddIncludes(this->GetIncludes(configName, "RC"));
+
+ this->RcOptions[configName] = std::move(pOptions);
return true;
}
@@ -2610,11 +2633,8 @@ void cmVisualStudio10TargetGenerator::WriteRCOptions(
Options& rcOptions = *(this->RcOptions[configName]);
rcOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "RC");
- std::vector<std::string> const includes =
- this->GetIncludes(configName, "RC");
- rcOptions.AppendFlag("AdditionalIncludeDirectories", includes);
- rcOptions.AppendFlag("AdditionalIncludeDirectories",
- "%(AdditionalIncludeDirectories)");
+ rcOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
+ " ", "\n", "RC");
rcOptions.PrependInheritedString("AdditionalOptions");
rcOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -2728,7 +2748,10 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
cudaOptions.AddDefine(exportMacro);
}
- this->CudaOptions[configName] = pOptions.release();
+ // Get includes for this target
+ cudaOptions.AddIncludes(this->GetIncludes(configName, "CUDA"));
+
+ this->CudaOptions[configName] = std::move(pOptions);
return true;
}
@@ -2741,10 +2764,8 @@ void cmVisualStudio10TargetGenerator::WriteCudaOptions(
this->WriteString("<CudaCompile>\n", 2);
Options& cudaOptions = *(this->CudaOptions[configName]);
- std::vector<std::string> const includes =
- this->GetIncludes(configName, "CUDA");
- cudaOptions.AppendFlag("Include", includes);
- cudaOptions.AppendFlag("Include", "%(Include)");
+ cudaOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
+ " ", "\n", "CUDA");
cudaOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CUDA");
cudaOptions.PrependInheritedString("AdditionalOptions");
@@ -2801,7 +2822,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
"-Wno-deprecated-gpu-targets");
}
- this->CudaLinkOptions[configName] = pOptions.release();
+ this->CudaLinkOptions[configName] = std::move(pOptions);
return true;
}
@@ -2852,7 +2873,11 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
std::string(this->Makefile->GetSafeDefinition(configFlagsVar));
masmOptions.Parse(flags.c_str());
- this->MasmOptions[configName] = pOptions.release();
+
+ // Get includes for this target
+ masmOptions.AddIncludes(this->GetIncludes(configName, "ASM_MASM"));
+
+ this->MasmOptions[configName] = std::move(pOptions);
return true;
}
@@ -2870,10 +2895,8 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions(
"\n", "ASM_MASM");
Options& masmOptions = *(this->MasmOptions[configName]);
- std::vector<std::string> const includes =
- this->GetIncludes(configName, "ASM_MASM");
- masmOptions.AppendFlag("IncludePaths", includes);
- masmOptions.AppendFlag("IncludePaths", "%(IncludePaths)");
+ masmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
+ " ", "\n", "ASM_MASM");
masmOptions.PrependInheritedString("AdditionalOptions");
masmOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -2911,7 +2934,11 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions(
std::string(" ") +
std::string(this->Makefile->GetSafeDefinition(configFlagsVar));
nasmOptions.Parse(flags.c_str());
- this->NasmOptions[configName] = pOptions.release();
+
+ // Get includes for this target
+ nasmOptions.AddIncludes(this->GetIncludes(configName, "ASM_NASM"));
+
+ this->NasmOptions[configName] = std::move(pOptions);
return true;
}
@@ -2926,12 +2953,8 @@ void cmVisualStudio10TargetGenerator::WriteNasmOptions(
std::vector<std::string> includes =
this->GetIncludes(configName, "ASM_NASM");
Options& nasmOptions = *(this->NasmOptions[configName]);
- for (size_t i = 0; i < includes.size(); i++) {
- includes[i] += "\\";
- }
-
- nasmOptions.AppendFlag("IncludePaths", includes);
- nasmOptions.AppendFlag("IncludePaths", "%(IncludePaths)");
+ nasmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
+ " ", "\n", "ASM_NASM");
nasmOptions.OutputFlagMap(*this->BuildFileStream, " ");
nasmOptions.PrependInheritedString("AdditionalOptions");
nasmOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
@@ -3357,7 +3380,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
}
}
- this->LinkOptions[config] = pOptions.release();
+ this->LinkOptions[config] = std::move(pOptions);
return true;
}
@@ -3523,7 +3546,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
if (this->ProjectType == csproj) {
return;
}
- for (std::string const& i : this->Configurations) {
+ for (const auto& i : this->Configurations) {
this->WritePlatformConfigTag("ItemDefinitionGroup", i, 1);
*this->BuildFileStream << "\n";
// output cl compile flags <ClCompile></ClCompile>
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index c346164..2bc5da9 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -7,6 +7,7 @@
#include <iosfwd>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -24,6 +25,8 @@ class cmVisualStudioGeneratorOptions;
class cmVisualStudio10TargetGenerator
{
+ CM_DISABLE_COPY(cmVisualStudio10TargetGenerator)
+
public:
cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg);
@@ -169,7 +172,7 @@ private:
private:
typedef cmVisualStudioGeneratorOptions Options;
- typedef std::map<std::string, Options*> OptionsMap;
+ typedef std::map<std::string, std::unique_ptr<Options>> OptionsMap;
OptionsMap ClOptions;
OptionsMap RcOptions;
OptionsMap CudaOptions;
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 106bdff..ccbff83 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -29,23 +29,8 @@ static std::string cmVisualStudioGeneratorOptionsEscapeForXML(std::string ret)
cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions(
cmLocalVisualStudioGenerator* lg, Tool tool,
cmVisualStudio10TargetGenerator* g)
- : cmIDEOptions()
- , LocalGenerator(lg)
- , Version(lg->GetVersion())
- , CurrentTool(tool)
- , TargetGenerator(g)
+ : cmVisualStudioGeneratorOptions(lg, tool, nullptr, nullptr, g)
{
- // Preprocessor definitions are not allowed for linker tools.
- this->AllowDefine = (tool != Linker);
-
- // Slash options are allowed for VS.
- this->AllowSlash = true;
-
- this->FortranRuntimeDebug = false;
- this->FortranRuntimeDLL = false;
- this->FortranRuntimeMT = false;
-
- this->UnknownFlagField = "AdditionalOptions";
}
cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions(
@@ -64,6 +49,9 @@ cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions(
// Preprocessor definitions are not allowed for linker tools.
this->AllowDefine = (tool != Linker);
+ // include directories are not allowed for linker tools.
+ this->AllowInclude = (tool != Linker);
+
// Slash options are allowed for VS.
this->AllowSlash = true;
@@ -511,6 +499,69 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
}
}
+void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
+ std::ostream& fout, const char* prefix, const char* suffix,
+ const std::string& lang)
+{
+ if (this->Includes.empty()) {
+ return;
+ }
+
+ const char* tag = "AdditionalIncludeDirectories";
+ if (lang == "CUDA") {
+ tag = "Include";
+ } else if (lang == "ASM_MASM" || lang == "ASM_NASM") {
+ tag = "IncludePaths";
+ }
+
+ if (this->Version >= cmGlobalVisualStudioGenerator::VS10) {
+ // if there are configuration specific flags, then
+ // use the configuration specific tag for PreprocessorDefinitions
+ if (!this->Configuration.empty()) {
+ fout << prefix;
+ this->TargetGenerator->WritePlatformConfigTag(
+ tag, this->Configuration.c_str(), 0, 0, 0, &fout);
+ } else {
+ fout << prefix << "<" << tag << ">";
+ }
+ } else {
+ fout << prefix << tag << "=\"";
+ }
+
+ const char* sep = "";
+ for (std::string include : this->Includes) {
+ // first convert all of the slashes
+ std::string::size_type pos = 0;
+ while ((pos = include.find('/', pos)) != std::string::npos) {
+ include[pos] = '\\';
+ pos++;
+ }
+
+ if (lang == "ASM_NASM") {
+ include += "\\";
+ }
+
+ // Escape this include for the IDE.
+ fout << sep << (this->Version >= cmGlobalVisualStudioGenerator::VS10
+ ? cmVisualStudio10GeneratorOptionsEscapeForXML(include)
+ : cmVisualStudioGeneratorOptionsEscapeForXML(include));
+ sep = ";";
+
+ if (lang == "Fortran") {
+ include += "/$(ConfigurationName)";
+ fout << sep << (this->Version >= cmGlobalVisualStudioGenerator::VS10
+ ? cmVisualStudio10GeneratorOptionsEscapeForXML(include)
+ : cmVisualStudioGeneratorOptionsEscapeForXML(include));
+ }
+ }
+
+ if (this->Version >= cmGlobalVisualStudioGenerator::VS10) {
+ fout << sep << "%(" << tag << ")</" << tag << ">" << suffix;
+ } else {
+ fout << "\"" << suffix;
+ }
+}
+
void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
const char* indent)
{
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 7c08a2c..2dffe9b 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -86,6 +86,10 @@ public:
void OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix,
const char* suffix,
const std::string& lang);
+ void OutputAdditionalIncludeDirectories(std::ostream& fout,
+ const char* prefix,
+ const char* suffix,
+ const std::string& lang);
void OutputFlagMap(std::ostream& fout, const char* indent);
void SetConfiguration(const char* config);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 480646e..cefea27 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -34,14 +34,6 @@
#include <unordered_map>
#endif
-// only build kdevelop generator on non-windows platforms
-// when not bootstrapping cmake
-#if !defined(_WIN32)
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#define CMAKE_USE_KDEVELOP
-#endif
-#endif
-
#if defined(CMAKE_BUILD_WITH_CMAKE)
#define CMAKE_USE_ECLIPSE
#endif
@@ -87,10 +79,6 @@
#include "cmExtraKateGenerator.h"
#include "cmExtraSublimeTextGenerator.h"
-#ifdef CMAKE_USE_KDEVELOP
-#include "cmGlobalKdevelopGenerator.h"
-#endif
-
#ifdef CMAKE_USE_ECLIPSE
#include "cmExtraEclipseCDT4Generator.h"
#endif
@@ -756,8 +744,13 @@ void cmake::SetArgs(const std::vector<std::string>& args,
}
cmGlobalGenerator* gen = this->CreateGlobalGenerator(value);
if (!gen) {
+ const char* kdevError = nullptr;
+ if (value.find("KDevelop3", 0) != std::string::npos) {
+ kdevError = "\nThe KDevelop3 generator is not supported anymore.";
+ }
+
cmSystemTools::Error("Could not create named generator ",
- value.c_str());
+ value.c_str(), kdevError);
this->PrintGeneratorList();
} else {
this->SetGlobalGenerator(gen);
@@ -902,9 +895,6 @@ void cmake::AddDefaultExtraGenerators()
this->ExtraGenerators.push_back(cmExtraEclipseCDT4Generator::GetFactory());
#endif
-#ifdef CMAKE_USE_KDEVELOP
- this->ExtraGenerators.push_back(cmGlobalKdevelopGenerator::GetFactory());
-#endif
#endif
}
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 351e38d..2570e5b 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -83,7 +83,9 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
FOREACH(p
+ CMP0022 # CMake 2.8, Define link interface - required by android_mk export
CMP0025 # CMake 3.0, Compiler id for Apple Clang is now AppleClang.
+ CMP0042 # CMake 3.0, MACOSX_RPATH is enabled by default.
CMP0048 # CMake 3.0, Let the project command manage version variables.
CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature.
CMP0063 # CMake 3.3, Honor visibility properties for all target types.
@@ -494,6 +496,14 @@ IF(KWSYS_USE_SystemTools)
KWSYS_CXX_STAT_HAS_ST_MTIM=${KWSYS_CXX_STAT_HAS_ST_MTIM}
KWSYS_CXX_STAT_HAS_ST_MTIMESPEC=${KWSYS_CXX_STAT_HAS_ST_MTIMESPEC}
)
+
+ # Disable getpwnam for static linux builds since it depends on shared glibc
+ GET_PROPERTY(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT SHARED_LIBS_SUPPORTED)
+ SET_PROPERTY(SOURCE SystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS
+ HAVE_GETPWNAM=0
+ )
+ ENDIF()
ENDIF()
IF(KWSYS_USE_SystemInformation)
@@ -576,7 +586,7 @@ IF(KWSYS_USE_SystemInformation)
CHECK_INCLUDE_FILE_CXX("execinfo.h" KWSYS_CXX_HAS_EXECINFOH)
IF (KWSYS_CXX_HAS_EXECINFOH)
# we have the backtrace header check if it
- # can be used with this compiler
+ # can be used with this compiler
SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${EXECINFO_LIB})
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BACKTRACE
"Checking whether backtrace works with this C++ compiler" DIRECT)
@@ -1012,11 +1022,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# C tests
SET(KWSYS_C_TESTS
- testEncode
- testTerminal
+ testEncode.c
+ testTerminal.c
)
IF(KWSYS_STANDALONE)
- SET(KWSYS_C_TESTS ${KWSYS_C_TESTS} testFail)
+ SET(KWSYS_C_TESTS ${KWSYS_C_TESTS} testFail.c)
ENDIF()
CREATE_TEST_SOURCELIST(
KWSYS_C_TEST_SRCS ${KWSYS_NAMESPACE}TestsC.c
@@ -1025,7 +1035,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsC ${KWSYS_C_TEST_SRCS})
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsC PROPERTY LABELS ${KWSYS_LABELS_EXE})
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsC ${KWSYS_TARGET_C_LINK})
- FOREACH(test ${KWSYS_C_TESTS})
+ FOREACH(testfile ${KWSYS_C_TESTS})
+ get_filename_component(test "${testfile}" NAME_WE)
ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsC ${test} ${KWSYS_TEST_ARGS_${test}})
SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST})
ENDFOREACH()
@@ -1033,24 +1044,24 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# C++ tests
IF(NOT WATCOM AND NOT CMake_SOURCE_DIR)
SET(KWSYS_CXX_TESTS
- testHashSTL
+ testHashSTL.cxx
)
ENDIF()
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testConfigure
- testSystemTools
- testCommandLineArguments
- testCommandLineArguments1
- testDirectory
+ testConfigure.cxx
+ testSystemTools.cxx
+ testCommandLineArguments.cxx
+ testCommandLineArguments1.cxx
+ testDirectory.cxx
)
IF(KWSYS_STL_HAS_WSTRING)
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testEncoding
+ testEncoding.cxx
)
ENDIF()
IF(KWSYS_USE_FStream)
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testFStream
+ testFStream.cxx
)
ENDIF()
IF(KWSYS_USE_ConsoleBuf)
@@ -1062,7 +1073,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE})
TARGET_LINK_LIBRARIES(testConsoleBufChild ${KWSYS_TARGET_LINK})
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testConsoleBuf
+ testConsoleBuf.cxx
)
IF("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "19.0.23506")
@@ -1072,10 +1083,10 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})
ENDIF()
IF(KWSYS_USE_SystemInformation)
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation)
+ SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation.cxx)
ENDIF()
IF(KWSYS_USE_DynamicLoader)
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testDynamicLoader)
+ SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testDynamicLoader.cxx)
# If kwsys contains the DynamicLoader, need extra library
ADD_LIBRARY(${KWSYS_NAMESPACE}TestDynload MODULE testDynload.c)
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestDynload PROPERTY LABELS ${KWSYS_LABELS_LIB})
@@ -1134,7 +1145,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
-p
some junk at the end
)
- FOREACH(test ${KWSYS_CXX_TESTS})
+ FOREACH(testfile ${KWSYS_CXX_TESTS})
+ get_filename_component(test "${testfile}" NAME_WE)
ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsCxx ${test} ${KWSYS_TEST_ARGS_${test}})
SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST})
ENDFOREACH()
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 5792da9..a6387ea 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -68,8 +68,8 @@ class CommandLineArgumentsInternal
public:
CommandLineArgumentsInternal()
{
- this->UnknownArgumentCallback = 0;
- this->ClientData = 0;
+ this->UnknownArgumentCallback = KWSYS_NULLPTR;
+ this->ClientData = KWSYS_NULLPTR;
this->LastArgument = 0;
}
@@ -187,7 +187,7 @@ int CommandLineArguments::Parse()
switch (cs->ArgumentType) {
case NO_ARGUMENT:
// No value
- if (!this->PopulateVariable(cs, 0)) {
+ if (!this->PopulateVariable(cs, KWSYS_NULLPTR)) {
return 0;
}
break;
@@ -340,7 +340,7 @@ void CommandLineArguments::AddCallback(const char* argument,
s.Callback = callback;
s.CallData = call_data;
s.VariableType = CommandLineArguments::NO_VARIABLE_TYPE;
- s.Variable = 0;
+ s.Variable = KWSYS_NULLPTR;
s.Help = help;
this->Internals->Callbacks[argument] = s;
@@ -355,8 +355,8 @@ void CommandLineArguments::AddArgument(const char* argument,
CommandLineArgumentsCallbackStructure s;
s.Argument = argument;
s.ArgumentType = type;
- s.Callback = 0;
- s.CallData = 0;
+ s.Callback = KWSYS_NULLPTR;
+ s.CallData = KWSYS_NULLPTR;
s.VariableType = vtype;
s.Variable = variable;
s.Help = help;
@@ -427,7 +427,7 @@ const char* CommandLineArguments::GetHelp(const char* arg)
CommandLineArguments::Internal::CallbacksMap::iterator it =
this->Internals->Callbacks.find(arg);
if (it == this->Internals->Callbacks.end()) {
- return 0;
+ return KWSYS_NULLPTR;
}
// Since several arguments may point to the same argument, find the one this
@@ -621,7 +621,7 @@ void CommandLineArguments::PopulateVariable(bool* variable,
void CommandLineArguments::PopulateVariable(int* variable,
const std::string& value)
{
- char* res = 0;
+ char* res = KWSYS_NULLPTR;
*variable = static_cast<int>(strtol(value.c_str(), &res, 10));
// if ( res && *res )
// {
@@ -632,7 +632,7 @@ void CommandLineArguments::PopulateVariable(int* variable,
void CommandLineArguments::PopulateVariable(double* variable,
const std::string& value)
{
- char* res = 0;
+ char* res = KWSYS_NULLPTR;
*variable = strtod(value.c_str(), &res);
// if ( res && *res )
// {
@@ -669,7 +669,7 @@ void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
const std::string& value)
{
- char* res = 0;
+ char* res = KWSYS_NULLPTR;
variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
// if ( res && *res )
// {
@@ -680,7 +680,7 @@ void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
const std::string& value)
{
- char* res = 0;
+ char* res = KWSYS_NULLPTR;
variable->push_back(strtod(value.c_str(), &res));
// if ( res && *res )
// {
diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in
index 1e67874..05afc7d 100644
--- a/Source/kwsys/Configure.hxx.in
+++ b/Source/kwsys/Configure.hxx.in
@@ -20,6 +20,12 @@
#define @KWSYS_NAMESPACE@__has_cpp_attribute(x) 0
#endif
+#if __cplusplus >= 201103L
+#define @KWSYS_NAMESPACE@_NULLPTR nullptr
+#else
+#define @KWSYS_NAMESPACE@_NULLPTR 0
+#endif
+
#ifndef @KWSYS_NAMESPACE@_FALLTHROUGH
#if __cplusplus >= 201703L && @KWSYS_NAMESPACE@__has_cpp_attribute(fallthrough)
#define @KWSYS_NAMESPACE@_FALLTHROUGH [[fallthrough]]
@@ -48,6 +54,7 @@
#define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \
@KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
#define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH
+#define KWSYS_NULLPTR @KWSYS_NAMESPACE@_NULLPTR
#endif
#endif
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 69068aa..a84be11 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -48,7 +48,7 @@ unsigned long Directory::GetNumberOfFiles() const
const char* Directory::GetFile(unsigned long dindex) const
{
if (dindex >= this->Internal->Files.size()) {
- return 0;
+ return KWSYS_NULLPTR;
}
return this->Internal->Files[dindex].c_str();
}
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx
index 664f183..9b7d9bf 100644
--- a/Source/kwsys/DynamicLoader.cxx
+++ b/Source/kwsys/DynamicLoader.cxx
@@ -60,7 +60,7 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#elif defined(__hpux)
-// Implementation for HPUX machines
+// Implementation for HPUX machines
#include <dl.h>
#include <errno.h>
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index b1e54c9..a1fe040 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -65,7 +65,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac,
for (int i = 0; i < ac; i++) {
this->argv_[i] = strdup(av[i]);
}
- this->argv_[ac] = 0;
+ this->argv_[ac] = KWSYS_NULLPTR;
}
Encoding::CommandLineArguments::CommandLineArguments(int ac,
@@ -75,7 +75,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac,
for (int i = 0; i < ac; i++) {
this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]);
}
- this->argv_[ac] = 0;
+ this->argv_[ac] = KWSYS_NULLPTR;
}
Encoding::CommandLineArguments::~CommandLineArguments()
@@ -90,7 +90,7 @@ Encoding::CommandLineArguments::CommandLineArguments(
{
this->argv_.resize(other.argv_.size());
for (size_t i = 0; i < this->argv_.size(); i++) {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR;
}
}
@@ -105,7 +105,7 @@ Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(
this->argv_.resize(other.argv_.size());
for (i = 0; i < this->argv_.size(); i++) {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR;
}
}
@@ -193,7 +193,7 @@ std::string Encoding::ToNarrow(const std::wstring& str)
std::wstring Encoding::ToWide(const char* cstr)
{
std::wstring wstr;
- size_t length = kwsysEncoding_mbstowcs(0, cstr, 0) + 1;
+ size_t length = kwsysEncoding_mbstowcs(KWSYS_NULLPTR, cstr, 0) + 1;
if (length > 0) {
std::vector<wchar_t> wchars(length);
if (kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) {
@@ -206,7 +206,7 @@ std::wstring Encoding::ToWide(const char* cstr)
std::string Encoding::ToNarrow(const wchar_t* wcstr)
{
std::string str;
- size_t length = kwsysEncoding_wcstombs(0, wcstr, 0) + 1;
+ size_t length = kwsysEncoding_wcstombs(KWSYS_NULLPTR, wcstr, 0) + 1;
if (length > 0) {
std::vector<char> chars(length);
if (kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0) {
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index d2f0b85..2b6db78 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -28,7 +28,7 @@
#include <string.h>
namespace KWSYS_NAMESPACE {
#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
-// On Windows and apple, no difference between lower and upper case
+// On Windows and Apple, no difference between lower and upper case
#define KWSYS_GLOB_CASE_INDEPENDENT
#endif
@@ -81,13 +81,13 @@ std::string Glob::PatternToRegex(const std::string& pattern,
int c = *i;
if (c == '*') {
// A '*' (not between brackets) matches any string.
- // We modify this to not match slashes since the orignal glob
+ // We modify this to not match slashes since the original glob
// pattern documentation was meant for matching file name
// components separated by slashes.
regex += "[^/]*";
} else if (c == '?') {
// A '?' (not between brackets) matches any single character.
- // We modify this to not match slashes since the orignal glob
+ // We modify this to not match slashes since the original glob
// pattern documentation was meant for matching file name
// components separated by slashes.
regex += "[^/]";
@@ -201,7 +201,7 @@ bool Glob::RecurseDirectory(std::string::size_type start,
}
#if defined(KWSYS_GLOB_CASE_INDEPENDENT)
- // On Windows and apple, no difference between lower and upper case
+ // On Windows and Apple, no difference between lower and upper case
fname = kwsys::SystemTools::LowerCase(fname);
#endif
@@ -430,7 +430,7 @@ void Glob::SetRelative(const char* dir)
const char* Glob::GetRelative()
{
if (this->Relative.empty()) {
- return 0;
+ return KWSYS_NULLPTR;
}
return this->Relative.c_str();
}
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 718a1aa..1e80b39 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -231,7 +231,7 @@ struct kwsysProcess_s
when reaping PIDs or modifying this array to avoid race conditions. */
volatile pid_t* volatile ForkPIDs;
- /* Flag for whether the children were terminated by a faild select. */
+ /* Flag for whether the children were terminated by a failed select. */
int SelectError;
/* The timeout length. */
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index fa3551c..78cff1a 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -37,18 +37,18 @@ namespace KWSYS_NAMESPACE {
RegularExpression::RegularExpression(const RegularExpression& rxp)
{
if (!rxp.program) {
- this->program = 0;
+ this->program = KWSYS_NULLPTR;
return;
}
int ind;
this->progsize = rxp.progsize; // Copy regular expression size
this->program = new char[this->progsize]; // Allocate storage
- for (ind = this->progsize; ind-- != 0;) // Copy regular expresion
+ for (ind = this->progsize; ind-- != 0;) // Copy regular expression
this->program[ind] = rxp.program[ind];
// Copy pointers into last successful "find" operation
this->regmatch = rxp.regmatch;
this->regmust = rxp.regmust; // Copy field
- if (rxp.regmust != 0) {
+ if (rxp.regmust != KWSYS_NULLPTR) {
char* dum = rxp.program;
ind = 0;
while (dum != rxp.regmust) {
@@ -69,19 +69,19 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
return *this;
}
if (!rxp.program) {
- this->program = 0;
+ this->program = KWSYS_NULLPTR;
return *this;
}
int ind;
this->progsize = rxp.progsize; // Copy regular expression size
delete[] this->program;
this->program = new char[this->progsize]; // Allocate storage
- for (ind = this->progsize; ind-- != 0;) // Copy regular expresion
+ for (ind = this->progsize; ind-- != 0;) // Copy regular expression
this->program[ind] = rxp.program[ind];
// Copy pointers into last successful "find" operation
this->regmatch = rxp.regmatch;
this->regmust = rxp.regmust; // Copy field
- if (rxp.regmust != 0) {
+ if (rxp.regmust != KWSYS_NULLPTR) {
char* dum = rxp.program;
ind = 0;
while (dum != rxp.regmust) {
@@ -128,8 +128,8 @@ bool RegularExpression::deep_equal(const RegularExpression& rxp) const
this->regmatch.end() == rxp.regmatch.end());
}
-// The remaining code in this file is derived from the regular expression code
-// whose copyright statement appears below. It has been changed to work
+// The remaining code in this file is derived from the regular expression code
+// whose copyright statement appears below. It has been changed to work
// with the class concepts of C++ and COOL.
/*
@@ -335,7 +335,7 @@ bool RegularExpression::compile(const char* exp)
size_t len;
int flags;
- if (exp == 0) {
+ if (exp == KWSYS_NULLPTR) {
// RAISE Error, SYM(RegularExpression), SYM(No_Expr),
printf("RegularExpression::compile(): No expression supplied.\n");
return false;
@@ -363,13 +363,13 @@ bool RegularExpression::compile(const char* exp)
// Allocate space.
//#ifndef _WIN32
- if (this->program != 0)
+ if (this->program != KWSYS_NULLPTR)
delete[] this->program;
//#endif
this->program = new char[comp.regsize];
this->progsize = static_cast<int>(comp.regsize);
- if (this->program == 0) {
+ if (this->program == KWSYS_NULLPTR) {
// RAISE Error, SYM(RegularExpression), SYM(Out_Of_Memory),
printf("RegularExpression::compile(): Out of memory.\n");
return false;
@@ -385,7 +385,7 @@ bool RegularExpression::compile(const char* exp)
// Dig out information for optimizations.
this->regstart = '\0'; // Worst-case defaults.
this->reganch = 0;
- this->regmust = 0;
+ this->regmust = KWSYS_NULLPTR;
this->regmlen = 0;
scan = this->program + 1; // First BRANCH.
if (OP(regnext(scan)) == END) { // Only one top-level choice.
@@ -406,9 +406,9 @@ bool RegularExpression::compile(const char* exp)
// absence of others.
//
if (flags & SPSTART) {
- longest = 0;
+ longest = KWSYS_NULLPTR;
len = 0;
- for (; scan != 0; scan = regnext(scan))
+ for (; scan != KWSYS_NULLPTR; scan = regnext(scan))
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
longest = OPERAND(scan);
len = strlen(OPERAND(scan));
@@ -444,19 +444,19 @@ char* RegExpCompile::reg(int paren, int* flagp)
if (regnpar >= RegularExpressionMatch::NSUBEXP) {
// RAISE Error, SYM(RegularExpression), SYM(Too_Many_Parens),
printf("RegularExpression::compile(): Too many parentheses.\n");
- return 0;
+ return KWSYS_NULLPTR;
}
parno = regnpar;
regnpar++;
ret = regnode(static_cast<char>(OPEN + parno));
} else
- ret = 0;
+ ret = KWSYS_NULLPTR;
// Pick up the branches, linking them together.
br = regbranch(&flags);
- if (br == 0)
- return (0);
- if (ret != 0)
+ if (br == KWSYS_NULLPTR)
+ return (KWSYS_NULLPTR);
+ if (ret != KWSYS_NULLPTR)
regtail(ret, br); // OPEN -> first.
else
ret = br;
@@ -466,8 +466,8 @@ char* RegExpCompile::reg(int paren, int* flagp)
while (*regparse == '|') {
regparse++;
br = regbranch(&flags);
- if (br == 0)
- return (0);
+ if (br == KWSYS_NULLPTR)
+ return (KWSYS_NULLPTR);
regtail(ret, br); // BRANCH -> BRANCH.
if (!(flags & HASWIDTH))
*flagp &= ~HASWIDTH;
@@ -479,23 +479,23 @@ char* RegExpCompile::reg(int paren, int* flagp)
regtail(ret, ender);
// Hook the tails of the branches to the closing node.
- for (br = ret; br != 0; br = regnext(br))
+ for (br = ret; br != KWSYS_NULLPTR; br = regnext(br))
regoptail(br, ender);
// Check for proper termination.
if (paren && *regparse++ != ')') {
// RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
printf("RegularExpression::compile(): Unmatched parentheses.\n");
- return 0;
+ return KWSYS_NULLPTR;
} else if (!paren && *regparse != '\0') {
if (*regparse == ')') {
// RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
printf("RegularExpression::compile(): Unmatched parentheses.\n");
- return 0;
+ return KWSYS_NULLPTR;
} else {
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
printf("RegularExpression::compile(): Internal error.\n");
- return 0;
+ return KWSYS_NULLPTR;
}
// NOTREACHED
}
@@ -517,19 +517,19 @@ char* RegExpCompile::regbranch(int* flagp)
*flagp = WORST; // Tentatively.
ret = regnode(BRANCH);
- chain = 0;
+ chain = KWSYS_NULLPTR;
while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
latest = regpiece(&flags);
- if (latest == 0)
- return (0);
+ if (latest == KWSYS_NULLPTR)
+ return (KWSYS_NULLPTR);
*flagp |= flags & HASWIDTH;
- if (chain == 0) // First piece.
+ if (chain == KWSYS_NULLPTR) // First piece.
*flagp |= flags & SPSTART;
else
regtail(chain, latest);
chain = latest;
}
- if (chain == 0) // Loop ran zero times.
+ if (chain == KWSYS_NULLPTR) // Loop ran zero times.
regnode(NOTHING);
return (ret);
@@ -552,8 +552,8 @@ char* RegExpCompile::regpiece(int* flagp)
int flags;
ret = regatom(&flags);
- if (ret == 0)
- return (0);
+ if (ret == KWSYS_NULLPTR)
+ return (KWSYS_NULLPTR);
op = *regparse;
if (!ISMULT(op)) {
@@ -564,7 +564,7 @@ char* RegExpCompile::regpiece(int* flagp)
if (!(flags & HASWIDTH) && op != '?') {
// RAISE Error, SYM(RegularExpression), SYM(Empty_Operand),
printf("RegularExpression::compile() : *+ operand could be empty.\n");
- return 0;
+ return KWSYS_NULLPTR;
}
*flagp = (op != '+') ? (WORST | SPSTART) : (WORST | HASWIDTH);
@@ -598,7 +598,7 @@ char* RegExpCompile::regpiece(int* flagp)
if (ISMULT(*regparse)) {
// RAISE Error, SYM(RegularExpression), SYM(Nested_Operand),
printf("RegularExpression::compile(): Nested *?+.\n");
- return 0;
+ return KWSYS_NULLPTR;
}
return (ret);
}
@@ -651,7 +651,7 @@ char* RegExpCompile::regatom(int* flagp)
if (rxpclass > rxpclassend + 1) {
// RAISE Error, SYM(RegularExpression), SYM(Invalid_Range),
printf("RegularExpression::compile(): Invalid range in [].\n");
- return 0;
+ return KWSYS_NULLPTR;
}
for (; rxpclass <= rxpclassend; rxpclass++)
regc(static_cast<char>(rxpclass));
@@ -664,15 +664,15 @@ char* RegExpCompile::regatom(int* flagp)
if (*regparse != ']') {
// RAISE Error, SYM(RegularExpression), SYM(Unmatched_Bracket),
printf("RegularExpression::compile(): Unmatched [].\n");
- return 0;
+ return KWSYS_NULLPTR;
}
regparse++;
*flagp |= HASWIDTH | SIMPLE;
} break;
case '(':
ret = reg(1, &flags);
- if (ret == 0)
- return (0);
+ if (ret == KWSYS_NULLPTR)
+ return (KWSYS_NULLPTR);
*flagp |= flags & (HASWIDTH | SPSTART);
break;
case '\0':
@@ -680,18 +680,18 @@ char* RegExpCompile::regatom(int* flagp)
case ')':
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
printf("RegularExpression::compile(): Internal error.\n"); // Never here
- return 0;
+ return KWSYS_NULLPTR;
case '?':
case '+':
case '*':
// RAISE Error, SYM(RegularExpression), SYM(No_Operand),
printf("RegularExpression::compile(): ?+* follows nothing.\n");
- return 0;
+ return KWSYS_NULLPTR;
case '\\':
if (*regparse == '\0') {
// RAISE Error, SYM(RegularExpression), SYM(Trailing_Backslash),
printf("RegularExpression::compile(): Trailing backslash.\n");
- return 0;
+ return KWSYS_NULLPTR;
}
ret = regnode(EXACTLY);
regc(*regparse++);
@@ -707,7 +707,7 @@ char* RegExpCompile::regatom(int* flagp)
if (len <= 0) {
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
printf("RegularExpression::compile(): Internal error.\n");
- return 0;
+ return KWSYS_NULLPTR;
}
ender = *(regparse + len);
if (len > 1 && ISMULT(ender))
@@ -805,7 +805,7 @@ void RegExpCompile::regtail(char* p, const char* val)
scan = p;
for (;;) {
temp = regnext(scan);
- if (temp == 0)
+ if (temp == KWSYS_NULLPTR)
break;
scan = temp;
}
@@ -824,7 +824,7 @@ void RegExpCompile::regtail(char* p, const char* val)
void RegExpCompile::regoptail(char* p, const char* val)
{
// "Operandless" and "op != BRANCH" are synonymous in practice.
- if (p == 0 || p == regdummyptr || OP(p) != BRANCH)
+ if (p == KWSYS_NULLPTR || p == regdummyptr || OP(p) != BRANCH)
return;
regtail(OPERAND(p), val);
}
@@ -874,14 +874,14 @@ bool RegularExpression::find(char const* string,
}
// If there is a "must appear" string, look for it.
- if (this->regmust != 0) {
+ if (this->regmust != KWSYS_NULLPTR) {
s = string;
- while ((s = strchr(s, this->regmust[0])) != 0) {
+ while ((s = strchr(s, this->regmust[0])) != KWSYS_NULLPTR) {
if (strncmp(s, this->regmust, this->regmlen) == 0)
break; // Found it.
s++;
}
- if (s == 0) // Not present.
+ if (s == KWSYS_NULLPTR) // Not present.
return false;
}
@@ -899,7 +899,7 @@ bool RegularExpression::find(char const* string,
s = string;
if (this->regstart != '\0')
// We know what char it must start with.
- while ((s = strchr(s, this->regstart)) != 0) {
+ while ((s = strchr(s, this->regstart)) != KWSYS_NULLPTR) {
if (regFind.regtry(s, rmatch.startp, rmatch.endp, this->program))
return true;
s++;
@@ -933,8 +933,8 @@ int RegExpFind::regtry(const char* string, const char** start,
sp1 = start;
ep = end;
for (i = RegularExpressionMatch::NSUBEXP; i > 0; i--) {
- *sp1++ = 0;
- *ep++ = 0;
+ *sp1++ = KWSYS_NULLPTR;
+ *ep++ = KWSYS_NULLPTR;
}
if (regmatch(prog + 1)) {
start[0] = string;
@@ -962,7 +962,7 @@ int RegExpFind::regmatch(const char* prog)
scan = prog;
- while (scan != 0) {
+ while (scan != KWSYS_NULLPTR) {
next = regnext(scan);
@@ -994,12 +994,14 @@ int RegExpFind::regmatch(const char* prog)
reginput += len;
} break;
case ANYOF:
- if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == 0)
+ if (*reginput == '\0' ||
+ strchr(OPERAND(scan), *reginput) == KWSYS_NULLPTR)
return (0);
reginput++;
break;
case ANYBUT:
- if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != 0)
+ if (*reginput == '\0' ||
+ strchr(OPERAND(scan), *reginput) != KWSYS_NULLPTR)
return (0);
reginput++;
break;
@@ -1028,7 +1030,7 @@ int RegExpFind::regmatch(const char* prog)
// Don't set startp if some later invocation of the
// same parentheses already has.
//
- if (regstartp[no] == 0)
+ if (regstartp[no] == KWSYS_NULLPTR)
regstartp[no] = save;
return (1);
} else
@@ -1056,7 +1058,7 @@ int RegExpFind::regmatch(const char* prog)
// Don't set endp if some later invocation of the
// same parentheses already has.
//
- if (regendp[no] == 0)
+ if (regendp[no] == KWSYS_NULLPTR)
regendp[no] = save;
return (1);
} else
@@ -1076,7 +1078,7 @@ int RegExpFind::regmatch(const char* prog)
return (1);
reginput = save;
scan = regnext(scan);
- } while (scan != 0 && OP(scan) == BRANCH);
+ } while (scan != KWSYS_NULLPTR && OP(scan) == BRANCH);
return (0);
// NOTREACHED
}
@@ -1154,13 +1156,13 @@ int RegExpFind::regrepeat(const char* p)
}
break;
case ANYOF:
- while (*scan != '\0' && strchr(opnd, *scan) != 0) {
+ while (*scan != '\0' && strchr(opnd, *scan) != KWSYS_NULLPTR) {
count++;
scan++;
}
break;
case ANYBUT:
- while (*scan != '\0' && strchr(opnd, *scan) == 0) {
+ while (*scan != '\0' && strchr(opnd, *scan) == KWSYS_NULLPTR) {
count++;
scan++;
}
@@ -1182,11 +1184,11 @@ static const char* regnext(const char* p)
int offset;
if (p == regdummyptr)
- return (0);
+ return (KWSYS_NULLPTR);
offset = NEXT(p);
if (offset == 0)
- return (0);
+ return (KWSYS_NULLPTR);
if (OP(p) == BACK)
return (p - offset);
@@ -1199,11 +1201,11 @@ static char* regnext(char* p)
int offset;
if (p == regdummyptr)
- return (0);
+ return (KWSYS_NULLPTR);
offset = NEXT(p);
if (offset == 0)
- return (0);
+ return (KWSYS_NULLPTR);
if (OP(p) == BACK)
return (p - offset);
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index a3fe72d..3cbbeb8 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -202,7 +202,7 @@ inline std::string RegularExpressionMatch::match(int n) const
*
* ? Matches preceding pattern zero or once only
*
- * () Saves a matched expression and uses it in a later match
+ * () Saves a matched expression and uses it in a later match
*
* Note that more than one of these metacharacters can be used
* in a single regular expression in order to create complex
diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in
index f638267..0caf5e7 100644
--- a/Source/kwsys/SharedForward.h.in
+++ b/Source/kwsys/SharedForward.h.in
@@ -225,7 +225,7 @@ static const char kwsys_shared_forward_path_slash[2] = {
#define KWSYS_SHARED_FORWARD_LDD_N 1
#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-/* OSX */
+/* OS X */
#elif defined(__APPLE__)
#define KWSYS_SHARED_FORWARD_LDD "otool", "-L"
#define KWSYS_SHARED_FORWARD_LDD_N 2
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index ab1f40a..7503469 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -340,7 +340,7 @@ public:
bool DoesCPUSupportCPUID();
- // Retrieve memory information in megabyte.
+ // Retrieve memory information in MiB.
size_t GetTotalVirtualMemory();
size_t GetAvailableVirtualMemory();
size_t GetTotalPhysicalMemory();
@@ -348,7 +348,7 @@ public:
LongLong GetProcessId();
- // Retrieve memory information in kib
+ // Retrieve memory information in KiB.
LongLong GetHostMemoryTotal();
LongLong GetHostMemoryAvailable(const char* envVarName);
LongLong GetHostMemoryUsed();
@@ -736,7 +736,7 @@ bool SystemInformation::DoesCPUSupportCPUID()
return this->Implementation->DoesCPUSupportCPUID();
}
-// Retrieve memory information in megabyte.
+// Retrieve memory information in MiB.
size_t SystemInformation::GetTotalVirtualMemory()
{
return this->Implementation->GetTotalVirtualMemory();
@@ -881,7 +881,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
char buf[bufSize] = { '\0' };
while (!feof(file) && !ferror(file)) {
errno = 0;
- if (fgets(buf, bufSize, file) == 0) {
+ if (fgets(buf, bufSize, file) == KWSYS_NULLPTR) {
if (ferror(file) && (errno == EINTR)) {
clearerr(file);
}
@@ -977,7 +977,7 @@ int GetFieldsFromCommand(const char* command, const char** fieldNames,
T* values)
{
FILE* file = popen(command, "r");
- if (file == 0) {
+ if (file == KWSYS_NULLPTR) {
return -1;
}
std::vector<std::string> fields;
@@ -987,7 +987,7 @@ int GetFieldsFromCommand(const char* command, const char** fieldNames,
return -1;
}
int i = 0;
- while (fieldNames[i] != NULL) {
+ while (fieldNames[i] != KWSYS_NULLPTR) {
int ierr = NameValue(fields, fieldNames[i], values[i]);
if (ierr) {
return -(i + 2);
@@ -1023,7 +1023,8 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
break;
case SIGFPE:
- oss << "Caught SIGFPE at " << (sigInfo->si_addr == 0 ? "0x" : "")
+ oss << "Caught SIGFPE at "
+ << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
<< sigInfo->si_addr << " ";
switch (sigInfo->si_code) {
#if defined(FPE_INTDIV)
@@ -1071,7 +1072,8 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
break;
case SIGSEGV:
- oss << "Caught SIGSEGV at " << (sigInfo->si_addr == 0 ? "0x" : "")
+ oss << "Caught SIGSEGV at "
+ << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
<< sigInfo->si_addr << " ";
switch (sigInfo->si_code) {
case SEGV_MAPERR:
@@ -1089,7 +1091,8 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
break;
case SIGBUS:
- oss << "Caught SIGBUS at " << (sigInfo->si_addr == 0 ? "0x" : "")
+ oss << "Caught SIGBUS at "
+ << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
<< sigInfo->si_addr << " ";
switch (sigInfo->si_code) {
case BUS_ADRALN:
@@ -1129,7 +1132,8 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
break;
case SIGILL:
- oss << "Caught SIGILL at " << (sigInfo->si_addr == 0 ? "0x" : "")
+ oss << "Caught SIGILL at "
+ << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
<< sigInfo->si_addr << " ";
switch (sigInfo->si_code) {
case ILL_ILLOPC:
@@ -1313,8 +1317,8 @@ SymbolProperties::SymbolProperties()
// not using an initializer list
// to avoid some PGI compiler warnings
this->SetBinary("???");
- this->SetBinaryBaseAddress(NULL);
- this->Address = NULL;
+ this->SetBinaryBaseAddress(KWSYS_NULLPTR);
+ this->Address = KWSYS_NULLPTR;
this->SetSourceFile("???");
this->SetFunction("???");
this->SetLineNumber(-1);
@@ -1649,7 +1653,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
// any number of interfaces on this system we look for the
// first of these that contains the name returned by gethostname
// and is longer. failing that we return gethostname and indicate
- // with a failure code. Return of a failure code is not necessarilly
+ // with a failure code. Return of a failure code is not necessarily
// an indication of an error. for instance gethostname may return
// the fully qualified domain name, or there may not be one if the
// system lives on a private network such as in the case of a cluster
@@ -1671,7 +1675,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
return -2;
}
- for (ifa = ifas; ifa != NULL; ifa = ifa->ifa_next) {
+ for (ifa = ifas; ifa != KWSYS_NULLPTR; ifa = ifa->ifa_next) {
int fam = ifa->ifa_addr ? ifa->ifa_addr->sa_family : -1;
// Skip Loopback interfaces
if (((fam == AF_INET) || (fam == AF_INET6)) &&
@@ -1682,7 +1686,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
: sizeof(struct sockaddr_in6));
ierr = getnameinfo(ifa->ifa_addr, static_cast<socklen_t>(addrlen), host,
- NI_MAXHOST, NULL, 0, NI_NAMEREQD);
+ NI_MAXHOST, KWSYS_NULLPTR, 0, NI_NAMEREQD);
if (ierr) {
// don't report the failure now since we may succeed on another
// interface. If all attempts fail then return the failure code.
@@ -3609,7 +3613,7 @@ SystemInformationImplementation::GetHostMemoryTotal()
#elif defined(__APPLE__)
uint64_t mem;
size_t len = sizeof(mem);
- int ierr = sysctlbyname("hw.memsize", &mem, &len, NULL, 0);
+ int ierr = sysctlbyname("hw.memsize", &mem, &len, KWSYS_NULLPTR, 0);
if (ierr) {
return -1;
}
@@ -3752,7 +3756,8 @@ SystemInformationImplementation::GetHostMemoryUsed()
if (psz < 1) {
return -1;
}
- const char* names[3] = { "Pages wired down:", "Pages active:", NULL };
+ const char* names[3] = { "Pages wired down:", "Pages active:",
+ KWSYS_NULLPTR };
SystemInformation::LongLong values[2] = { SystemInformation::LongLong(0) };
int ierr = GetFieldsFromCommand("vm_stat", names, values);
if (ierr) {
@@ -3800,7 +3805,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
std::ostringstream oss;
oss << "ps -o rss= -p " << pid;
FILE* file = popen(oss.str().c_str(), "r");
- if (file == 0) {
+ if (file == KWSYS_NULLPTR) {
return -1;
}
oss.str("");
@@ -3933,13 +3938,13 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable)
if (enable && !saOrigValid) {
// save the current actions
- sigaction(SIGABRT, 0, &saABRTOrig);
- sigaction(SIGSEGV, 0, &saSEGVOrig);
- sigaction(SIGTERM, 0, &saTERMOrig);
- sigaction(SIGINT, 0, &saINTOrig);
- sigaction(SIGILL, 0, &saILLOrig);
- sigaction(SIGBUS, 0, &saBUSOrig);
- sigaction(SIGFPE, 0, &saFPEOrig);
+ sigaction(SIGABRT, KWSYS_NULLPTR, &saABRTOrig);
+ sigaction(SIGSEGV, KWSYS_NULLPTR, &saSEGVOrig);
+ sigaction(SIGTERM, KWSYS_NULLPTR, &saTERMOrig);
+ sigaction(SIGINT, KWSYS_NULLPTR, &saINTOrig);
+ sigaction(SIGILL, KWSYS_NULLPTR, &saILLOrig);
+ sigaction(SIGBUS, KWSYS_NULLPTR, &saBUSOrig);
+ sigaction(SIGFPE, KWSYS_NULLPTR, &saFPEOrig);
// enable read, disable write
saOrigValid = 1;
@@ -3953,22 +3958,22 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable)
#endif
sigemptyset(&sa.sa_mask);
- sigaction(SIGABRT, &sa, 0);
- sigaction(SIGSEGV, &sa, 0);
- sigaction(SIGTERM, &sa, 0);
- sigaction(SIGINT, &sa, 0);
- sigaction(SIGILL, &sa, 0);
- sigaction(SIGBUS, &sa, 0);
- sigaction(SIGFPE, &sa, 0);
+ sigaction(SIGABRT, &sa, KWSYS_NULLPTR);
+ sigaction(SIGSEGV, &sa, KWSYS_NULLPTR);
+ sigaction(SIGTERM, &sa, KWSYS_NULLPTR);
+ sigaction(SIGINT, &sa, KWSYS_NULLPTR);
+ sigaction(SIGILL, &sa, KWSYS_NULLPTR);
+ sigaction(SIGBUS, &sa, KWSYS_NULLPTR);
+ sigaction(SIGFPE, &sa, KWSYS_NULLPTR);
} else if (!enable && saOrigValid) {
// restore previous actions
- sigaction(SIGABRT, &saABRTOrig, 0);
- sigaction(SIGSEGV, &saSEGVOrig, 0);
- sigaction(SIGTERM, &saTERMOrig, 0);
- sigaction(SIGINT, &saINTOrig, 0);
- sigaction(SIGILL, &saILLOrig, 0);
- sigaction(SIGBUS, &saBUSOrig, 0);
- sigaction(SIGFPE, &saFPEOrig, 0);
+ sigaction(SIGABRT, &saABRTOrig, KWSYS_NULLPTR);
+ sigaction(SIGSEGV, &saSEGVOrig, KWSYS_NULLPTR);
+ sigaction(SIGTERM, &saTERMOrig, KWSYS_NULLPTR);
+ sigaction(SIGINT, &saINTOrig, KWSYS_NULLPTR);
+ sigaction(SIGILL, &saILLOrig, KWSYS_NULLPTR);
+ sigaction(SIGBUS, &saBUSOrig, KWSYS_NULLPTR);
+ sigaction(SIGFPE, &saFPEOrig, KWSYS_NULLPTR);
// enable write, disable read
saOrigValid = 0;
@@ -4404,7 +4409,7 @@ bool SystemInformationImplementation::ParseSysCtl()
int err = 0;
uint64_t value = 0;
size_t len = sizeof(value);
- sysctlbyname("hw.memsize", &value, &len, NULL, 0);
+ sysctlbyname("hw.memsize", &value, &len, KWSYS_NULLPTR, 0);
this->TotalPhysicalMemory = static_cast<size_t>(value / 1048576);
// Parse values for Mac
@@ -4414,7 +4419,7 @@ bool SystemInformationImplementation::ParseSysCtl()
if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat,
&count) == KERN_SUCCESS) {
len = sizeof(value);
- err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0);
+ err = sysctlbyname("hw.pagesize", &value, &len, KWSYS_NULLPTR, 0);
int64_t available_memory = vmstat.free_count * value;
this->AvailablePhysicalMemory =
static_cast<size_t>(available_memory / 1048576);
@@ -4426,7 +4431,7 @@ bool SystemInformationImplementation::ParseSysCtl()
size_t miblen = sizeof(mib) / sizeof(mib[0]);
struct xsw_usage swap;
len = sizeof(swap);
- err = sysctl(mib, miblen, &swap, &len, NULL, 0);
+ err = sysctl(mib, miblen, &swap, &len, KWSYS_NULLPTR, 0);
if (err == 0) {
this->AvailableVirtualMemory =
static_cast<size_t>(swap.xsu_avail / 1048576);
@@ -4439,71 +4444,75 @@ bool SystemInformationImplementation::ParseSysCtl()
// CPU Info
len = sizeof(this->NumberOfPhysicalCPU);
- sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len, NULL, 0);
+ sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len,
+ KWSYS_NULLPTR, 0);
len = sizeof(this->NumberOfLogicalCPU);
- sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, NULL, 0);
+ sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, KWSYS_NULLPTR,
+ 0);
int cores_per_package = 0;
len = sizeof(cores_per_package);
err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len,
- NULL, 0);
+ KWSYS_NULLPTR, 0);
// That name was not found, default to 1
this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical =
err != 0 ? 1 : static_cast<unsigned char>(cores_per_package);
len = sizeof(value);
- sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0);
+ sysctlbyname("hw.cpufrequency", &value, &len, KWSYS_NULLPTR, 0);
this->CPUSpeedInMHz = static_cast<float>(value) / 1000000;
// Chip family
len = sizeof(this->ChipID.Family);
// Seems only the intel chips will have this name so if this fails it is
// probably a PPC machine
- err =
- sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len, NULL, 0);
+ err = sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len,
+ KWSYS_NULLPTR, 0);
if (err != 0) // Go back to names we know but are less descriptive
{
this->ChipID.Family = 0;
::memset(retBuf, 0, 128);
len = 32;
- err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0);
+ err = sysctlbyname("hw.machine", &retBuf, &len, KWSYS_NULLPTR, 0);
std::string machineBuf(retBuf);
if (machineBuf.find_first_of("Power") != std::string::npos) {
this->ChipID.Vendor = "IBM";
len = sizeof(this->ChipID.Family);
- err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0);
+ err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len,
+ KWSYS_NULLPTR, 0);
len = sizeof(this->ChipID.Model);
- err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0);
+ err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len,
+ KWSYS_NULLPTR, 0);
this->FindManufacturer();
}
} else // Should be an Intel Chip.
{
len = sizeof(this->ChipID.Family);
- err =
- sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len, NULL, 0);
+ err = sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len,
+ KWSYS_NULLPTR, 0);
::memset(retBuf, 0, 128);
len = 128;
- err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0);
+ err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, KWSYS_NULLPTR, 0);
// Chip Vendor
this->ChipID.Vendor = retBuf;
this->FindManufacturer();
// Chip Model
len = sizeof(value);
- err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0);
+ err = sysctlbyname("machdep.cpu.model", &value, &len, KWSYS_NULLPTR, 0);
this->ChipID.Model = static_cast<int>(value);
// Chip Stepping
len = sizeof(value);
value = 0;
- err = sysctlbyname("machdep.cpu.stepping", &value, &len, NULL, 0);
+ err = sysctlbyname("machdep.cpu.stepping", &value, &len, KWSYS_NULLPTR, 0);
if (!err) {
this->ChipID.Revision = static_cast<int>(value);
}
// feature string
- char* buf = 0;
+ char* buf = KWSYS_NULLPTR;
size_t allocSize = 128;
err = 0;
@@ -4520,7 +4529,8 @@ bool SystemInformationImplementation::ParseSysCtl()
}
buf[0] = ' ';
len = allocSize - 2; // keep space for leading and trailing space
- err = sysctlbyname("machdep.cpu.features", buf + 1, &len, NULL, 0);
+ err =
+ sysctlbyname("machdep.cpu.features", buf + 1, &len, KWSYS_NULLPTR, 0);
}
if (!err && buf && len) {
// now we can match every flags as space + flag + space
@@ -4561,7 +4571,8 @@ bool SystemInformationImplementation::ParseSysCtl()
// brand string
::memset(retBuf, 0, sizeof(retBuf));
len = sizeof(retBuf);
- err = sysctlbyname("machdep.cpu.brand_string", retBuf, &len, NULL, 0);
+ err =
+ sysctlbyname("machdep.cpu.brand_string", retBuf, &len, KWSYS_NULLPTR, 0);
if (!err) {
this->ChipID.ProcessorName = retBuf;
this->ChipID.ModelName = retBuf;
@@ -4569,10 +4580,10 @@ bool SystemInformationImplementation::ParseSysCtl()
// Cache size
len = sizeof(value);
- err = sysctlbyname("hw.l1icachesize", &value, &len, NULL, 0);
+ err = sysctlbyname("hw.l1icachesize", &value, &len, KWSYS_NULLPTR, 0);
this->Features.L1CacheSize = static_cast<int>(value);
len = sizeof(value);
- err = sysctlbyname("hw.l2cachesize", &value, &len, NULL, 0);
+ err = sysctlbyname("hw.l2cachesize", &value, &len, KWSYS_NULLPTR, 0);
this->Features.L2CacheSize = static_cast<int>(value);
return true;
@@ -4609,7 +4620,7 @@ std::string SystemInformationImplementation::RunProcess(
kwsysProcess_Execute(gp);
- char* data = NULL;
+ char* data = KWSYS_NULLPTR;
int length;
double timeout = 255;
int pipe; // pipe id as returned by kwsysProcess_WaitForData()
@@ -4621,7 +4632,7 @@ std::string SystemInformationImplementation::RunProcess(
{
buffer.append(data, length);
}
- kwsysProcess_WaitForExit(gp, 0);
+ kwsysProcess_WaitForExit(gp, KWSYS_NULLPTR);
int result = 0;
switch (kwsysProcess_GetState(gp)) {
@@ -4694,7 +4705,7 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
std::string lastArg = command.substr(start + 1, command.size() - start - 1);
args.push_back(lastArg.c_str());
- args.push_back(0);
+ args.push_back(KWSYS_NULLPTR);
std::string buffer = this->RunProcess(args);
@@ -5379,7 +5390,7 @@ int SystemInformationImplementation::CallSwVers(const char* arg,
std::vector<const char*> args;
args.push_back("sw_vers");
args.push_back(arg);
- args.push_back(0);
+ args.push_back(KWSYS_NULLPTR);
ver = this->RunProcess(args);
this->TrimNewline(ver);
#else
diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in
index 5678e8a..fe7e8b5 100644
--- a/Source/kwsys/SystemInformation.hxx.in
+++ b/Source/kwsys/SystemInformation.hxx.in
@@ -103,14 +103,14 @@ public:
// Retrieve id of the current running process
LongLong GetProcessId();
- // Retrieve memory information in megabyte.
+ // Retrieve memory information in MiB.
size_t GetTotalVirtualMemory();
size_t GetAvailableVirtualMemory();
size_t GetTotalPhysicalMemory();
size_t GetAvailablePhysicalMemory();
// returns an informative general description if the installed and
- // available ram on this system. See the GetHostMmeoryTotal, and
+ // available ram on this system. See the GetHostMemoryTotal, and
// Get{Host,Proc}MemoryAvailable methods for more information.
std::string GetMemoryDescription(const char* hostLimitEnvVarName = NULL,
const char* procLimitEnvVarName = NULL);
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index f547362..999beb3 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -107,7 +107,8 @@ extern char** environ;
// getpwnam doesn't exist on Windows and Cray Xt3/Catamount
// same for TIOCGWINSZ
-#if defined(_WIN32) || defined(__LIBCATAMOUNT__)
+#if defined(_WIN32) || defined(__LIBCATAMOUNT__) || \
+ (defined(HAVE_GETPWNAM) && HAVE_GETPWNAM == 0)
#undef HAVE_GETPWNAM
#undef HAVE_TTY_INFO
#else
@@ -306,7 +307,7 @@ inline int Chdir(const std::string& dir)
return chdir(dir.c_str());
}
inline void Realpath(const std::string& path, std::string& resolved_path,
- std::string* errorMessage = 0)
+ std::string* errorMessage = KWSYS_NULLPTR)
{
char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
@@ -352,7 +353,7 @@ double SystemTools::GetTime(void)
11644473600.0);
#else
struct timeval t;
- gettimeofday(&t, 0);
+ gettimeofday(&t, KWSYS_NULLPTR);
return 1.0 * double(t.tv_sec) + 0.000001 * double(t.tv_usec);
#endif
}
@@ -414,7 +415,7 @@ public:
const envchar* Release(const envchar* env)
{
- const envchar* old = 0;
+ const envchar* old = KWSYS_NULLPTR;
iterator i = this->find(env);
if (i != this->end()) {
old = *i;
@@ -489,7 +490,7 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
const char* SystemTools::GetEnvImpl(const char* key)
{
- const char* v = 0;
+ const char* v = KWSYS_NULLPTR;
#if defined(_WIN32)
std::string env;
if (SystemTools::GetEnv(key, env)) {
@@ -545,7 +546,7 @@ bool SystemTools::HasEnv(const char* key)
#else
const char* v = getenv(key);
#endif
- return v != 0;
+ return v != KWSYS_NULLPTR;
}
bool SystemTools::HasEnv(const std::string& key)
@@ -776,7 +777,7 @@ bool SystemTools::MakeDirectory(const std::string& path, const mode_t* mode)
while ((pos = dir.find('/', pos)) != std::string::npos) {
topdir = dir.substr(0, pos);
- if (Mkdir(topdir) == 0 && mode != 0) {
+ if (Mkdir(topdir) == 0 && mode != KWSYS_NULLPTR) {
SystemTools::SetPermissions(topdir, *mode);
}
@@ -795,7 +796,7 @@ bool SystemTools::MakeDirectory(const std::string& path, const mode_t* mode)
) {
return false;
}
- } else if (mode != 0) {
+ } else if (mode != KWSYS_NULLPTR) {
SystemTools::SetPermissions(topdir, *mode);
}
@@ -1072,7 +1073,7 @@ bool SystemTools::WriteRegistryValue(const std::string&, const std::string&,
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will delete the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
-// => will delete the data of the "Root" value of the key
+// => will delete the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
bool SystemTools::DeleteRegistryValue(const std::string& key, KeyWOW64 view)
@@ -1520,7 +1521,7 @@ char* SystemTools::AppendStrings(const char* str1, const char* str2)
size_t len1 = strlen(str1);
char* newstr = new char[len1 + strlen(str2) + 1];
if (!newstr) {
- return 0;
+ return KWSYS_NULLPTR;
}
strcpy(newstr, str1);
strcat(newstr + len1, str2);
@@ -1543,7 +1544,7 @@ char* SystemTools::AppendStrings(const char* str1, const char* str2,
size_t len1 = strlen(str1), len2 = strlen(str2);
char* newstr = new char[len1 + len2 + strlen(str3) + 1];
if (!newstr) {
- return 0;
+ return KWSYS_NULLPTR;
}
strcpy(newstr, str1);
strcat(newstr + len1, str2);
@@ -1593,7 +1594,7 @@ size_t SystemTools::CountChar(const char* str, char c)
char* SystemTools::RemoveChars(const char* str, const char* toremove)
{
if (!str) {
- return NULL;
+ return KWSYS_NULLPTR;
}
char* clean_str = new char[strlen(str) + 1];
char* ptr = clean_str;
@@ -1615,7 +1616,7 @@ char* SystemTools::RemoveChars(const char* str, const char* toremove)
char* SystemTools::RemoveCharsButUpperHex(const char* str)
{
if (!str) {
- return 0;
+ return KWSYS_NULLPTR;
}
char* clean_str = new char[strlen(str) + 1];
char* ptr = clean_str;
@@ -1696,7 +1697,7 @@ bool SystemTools::StringEndsWith(const std::string& str1, const char* str2)
const char* SystemTools::FindLastString(const char* str1, const char* str2)
{
if (!str1 || !str2) {
- return NULL;
+ return KWSYS_NULLPTR;
}
size_t len1 = strlen(str1), len2 = strlen(str2);
@@ -1709,7 +1710,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
} while (ptr-- != str1);
}
- return NULL;
+ return KWSYS_NULLPTR;
}
// Duplicate string
@@ -1719,7 +1720,7 @@ char* SystemTools::DuplicateString(const char* str)
char* newstr = new char[strlen(str) + 1];
return strcpy(newstr, str);
}
- return NULL;
+ return KWSYS_NULLPTR;
}
// Return a cropped string
@@ -3100,7 +3101,7 @@ bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut,
std::string SystemTools::CollapseFullPath(const std::string& in_relative)
{
- return SystemTools::CollapseFullPath(in_relative, 0);
+ return SystemTools::CollapseFullPath(in_relative, KWSYS_NULLPTR);
}
void SystemTools::AddTranslationPath(const std::string& a,
@@ -3326,7 +3327,7 @@ std::string SystemTools::RelativePath(const std::string& local,
unsigned int sameCount = 0;
while (((sameCount <= (localSplit.size() - 1)) &&
(sameCount <= (remoteSplit.size() - 1))) &&
-// for windows and apple do a case insensitive string compare
+// for Windows and Apple do a case insensitive string compare
#if defined(_WIN32) || defined(__APPLE__)
SystemTools::Strucmp(localSplit[sameCount].c_str(),
remoteSplit[sameCount].c_str()) == 0
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 8a02b75..719d45c 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -881,7 +881,7 @@ public:
/**
* Get the width of the terminal window. The code may or may not work, so
- * make sure you have some resonable defaults prepared if the code returns
+ * make sure you have some reasonable defaults prepared if the code returns
* some bogus size.
*/
static int GetTerminalWidth();
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index d2215d6..78baed9 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -76,7 +76,7 @@ int testCommandLineArguments(int argc, char* argv[])
int some_int_variable = 10;
double some_double_variable = 10.10;
- char* some_string_variable = 0;
+ char* some_string_variable = KWSYS_NULLPTR;
std::string some_stl_string_variable = "";
bool some_bool_variable = false;
bool some_bool_variable1 = false;
@@ -202,7 +202,7 @@ int testCommandLineArguments(int argc, char* argv[])
for (cc = 0; cc < strings_argument.size(); ++cc) {
delete[] strings_argument[cc];
- strings_argument[cc] = 0;
+ strings_argument[cc] = KWSYS_NULLPTR;
}
return res;
}
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index 5a03401..5dfa5e3 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -21,7 +21,7 @@ int testCommandLineArguments1(int argc, char* argv[])
arg.Initialize(argc, argv);
int n = 0;
- char* m = 0;
+ char* m = KWSYS_NULLPTR;
std::string p;
int res = 0;
@@ -55,11 +55,11 @@ int testCommandLineArguments1(int argc, char* argv[])
delete[] m;
}
- char** newArgv = 0;
+ char** newArgv = KWSYS_NULLPTR;
int newArgc = 0;
arg.GetUnusedArguments(&newArgc, &newArgv);
int cc;
- const char* valid_unused_args[9] = { 0,
+ const char* valid_unused_args[9] = { KWSYS_NULLPTR,
"--ignored",
"--second-ignored",
"third-ignored",
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index 2742fe4..6bf273f 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -84,7 +84,7 @@ static int testRobustEncoding()
// this conversion could fail
std::wstring wstr = kwsys::Encoding::ToWide(cstr);
- wstr = kwsys::Encoding::ToWide(NULL);
+ wstr = kwsys::Encoding::ToWide(KWSYS_NULLPTR);
if (wstr != L"") {
const wchar_t* wcstr = wstr.c_str();
std::cout << "ToWide(NULL) returned";
@@ -112,7 +112,7 @@ static int testRobustEncoding()
std::string win_str = kwsys::Encoding::ToNarrow(cwstr);
#endif
- std::string str = kwsys::Encoding::ToNarrow(NULL);
+ std::string str = kwsys::Encoding::ToNarrow(KWSYS_NULLPTR);
if (str != "") {
std::cout << "ToNarrow(NULL) returned " << str << std::endl;
ret++;
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index a6af9cc..f1321e5 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -52,7 +52,7 @@ static const char* toUnixPaths[][2] = {
{ "\\\\usr\\local\\bin\\passwd", "//usr/local/bin/passwd" },
{ "\\\\usr\\lo cal\\bin\\pa sswd", "//usr/lo cal/bin/pa sswd" },
{ "\\\\usr\\lo\\ cal\\bin\\pa\\ sswd", "//usr/lo\\ cal/bin/pa\\ sswd" },
- { 0, 0 }
+ { KWSYS_NULLPTR, KWSYS_NULLPTR }
};
static bool CheckConvertToUnixSlashes(std::string const& input,
@@ -68,10 +68,11 @@ static bool CheckConvertToUnixSlashes(std::string const& input,
return true;
}
-static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\",
- "\\1 foo \\2 bar \\2" },
- { " {} ", "{}", "#", " #{#} " },
- { 0, 0, 0, 0 } };
+static const char* checkEscapeChars[][4] = {
+ { "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2" },
+ { " {} ", "{}", "#", " #{#} " },
+ { KWSYS_NULLPTR, KWSYS_NULLPTR, KWSYS_NULLPTR, KWSYS_NULLPTR }
+};
static bool CheckEscapeChars(std::string const& input,
const char* chars_to_escape, char escape_char,
@@ -159,7 +160,7 @@ static bool CheckFileOperations()
res = false;
}
// calling with 0 pointer should return false
- if (kwsys::SystemTools::MakeDirectory(0)) {
+ if (kwsys::SystemTools::MakeDirectory(KWSYS_NULLPTR)) {
std::cerr << "Problem with MakeDirectory(0)" << std::endl;
res = false;
}
@@ -217,11 +218,11 @@ static bool CheckFileOperations()
}
// calling with 0 pointer should return false
- if (kwsys::SystemTools::FileExists(0)) {
+ if (kwsys::SystemTools::FileExists(KWSYS_NULLPTR)) {
std::cerr << "Problem with FileExists(0)" << std::endl;
res = false;
}
- if (kwsys::SystemTools::FileExists(0, true)) {
+ if (kwsys::SystemTools::FileExists(KWSYS_NULLPTR, true)) {
std::cerr << "Problem with FileExists(0) as file" << std::endl;
res = false;
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 506e995..08bfebe 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -390,6 +390,9 @@ if(BUILD_TESTING)
endif()
ADD_TEST_MACRO(SourcesProperty SourcesProperty)
ADD_TEST_MACRO(SourceFileProperty SourceFileProperty)
+ if (NOT CMAKE_GENERATOR STREQUAL "Xcode")
+ ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty)
+ endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
set(runCxxDialectTest 1)
@@ -624,7 +627,6 @@ if(BUILD_TESTING)
"CodeLite"
"Eclipse CDT4"
"Kate"
- "KDevelop3"
"Sublime Text 2")
foreach(extraGenerator ${extraGenerators})
@@ -3246,7 +3248,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
# add some cross compiler tests, for now only with makefile based generators
- if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "KDevelop")
+ if(CMAKE_GENERATOR MATCHES "Makefiles")
# if sdcc is found, build the SimpleCOnly project with sdcc
find_program(SDCC_EXECUTABLE sdcc)
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 4586357..19d12e5 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -260,17 +260,49 @@ add_custom_target(check-part4 ALL
#-----------------------------------------------------------------------------
# Cover source file properties with generator expressions.
-add_executable(srcgenex_flags srcgenex_flags.c)
-set_property(SOURCE srcgenex_flags.c PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>")
-
-add_executable(srcgenex_flags_COMPILE_LANGUAGE srcgenex_flags_COMPILE_LANGUAGE.c)
-set_property(SOURCE srcgenex_flags_COMPILE_LANGUAGE.c PROPERTY COMPILE_FLAGS "$<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>")
-
-add_executable(srcgenex_defs srcgenex_defs.c)
-set_property(SOURCE srcgenex_defs.c PROPERTY COMPILE_DEFINITIONS NAME=$<TARGET_PROPERTY:NAME>)
-
-add_executable(srcgenex_defs_COMPILE_LANGUAGE srcgenex_defs_COMPILE_LANGUAGE.c)
-set_property(SOURCE srcgenex_defs_COMPILE_LANGUAGE.c PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>)
+## generate various source files
+foreach (item IN ITEMS flags flags_COMPILE_LANGUAGE
+ options options_COMPILE_LANGUAGE
+ defs defs_COMPILE_LANGUAGE)
+ set(TARGET_NAME srcgenex_${item})
+ configure_file(srcgenex.c.in ${TARGET_NAME}.c @ONLY)
+endforeach()
+add_executable(srcgenex_flags "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags.c")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags.c"
+ PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>")
+add_executable(srcgenex_flags_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags_COMPILE_LANGUAGE.c")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags_COMPILE_LANGUAGE.c"
+ PROPERTY COMPILE_FLAGS "$<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>")
+
+add_executable(srcgenex_options "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options.c")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options.c"
+ PROPERTY COMPILE_OPTIONS -DUNUSED -DNAME=$<TARGET_PROPERTY:NAME>)
+add_executable(srcgenex_options_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUAGE.c")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUAGE.c"
+ PROPERTY COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>)
+
+add_executable(srcgenex_defs "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs.c")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs.c"
+ PROPERTY COMPILE_DEFINITIONS UNUSED NAME=$<TARGET_PROPERTY:NAME>)
+add_executable(srcgenex_defs_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs_COMPILE_LANGUAGE.c")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs_COMPILE_LANGUAGE.c"
+ PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>)
+
+foreach (item IN ITEMS basic COMPILE_LANGUAGE)
+ set(TARGET_NAME srcgenex_includes_${item})
+ configure_file(srcgenex_includes.h.in "sf_includes_${item}/${TARGET_NAME}.h" @ONLY)
+ configure_file(srcgenex_includes.c.in ${TARGET_NAME}.c @ONLY)
+endforeach()
+add_executable(srcgenex_includes_basic "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_basic.c")
+# first include directory is useless but ensure list aspect is tested
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_basic.c"
+ PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/sf_includes_basic")
+if (CMAKE_GENERATOR MATCHES "Makefiles|Ninja|Watcom WMake")
+ add_executable(srcgenex_includes_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_COMPILE_LANGUAGE.c")
+ # first include directory is useless but ensure list aspect is tested
+ set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_COMPILE_LANGUAGE.c"
+ PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" $<$<COMPILE_LANGUAGE:C>:${CMAKE_CURRENT_BINARY_DIR}/sf_includes_COMPILE_LANGUAGE>)
+endif()
#-----------------------------------------------------------------------------
# Cover test properties with generator expressions.
diff --git a/Tests/GeneratorExpression/srcgenex_defs.c b/Tests/GeneratorExpression/srcgenex.c.in
index 883e631..4a43bd1 100644
--- a/Tests/GeneratorExpression/srcgenex_defs.c
+++ b/Tests/GeneratorExpression/srcgenex.c.in
@@ -1,4 +1,4 @@
-int srcgenex_defs(void)
+int @TARGET_NAME@(void)
{
return 0;
}
diff --git a/Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c b/Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c
deleted file mode 100644
index 421b55b..0000000
--- a/Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c
+++ /dev/null
@@ -1,12 +0,0 @@
-int srcgenex_defs_COMPILE_LANGUAGE(void)
-{
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
-#ifndef NAME
-#error NAME not defined
-#endif
- return NAME();
-}
diff --git a/Tests/GeneratorExpression/srcgenex_flags.c b/Tests/GeneratorExpression/srcgenex_flags.c
deleted file mode 100644
index 3de2b12..0000000
--- a/Tests/GeneratorExpression/srcgenex_flags.c
+++ /dev/null
@@ -1,12 +0,0 @@
-int srcgenex_flags(void)
-{
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
-#ifndef NAME
-#error NAME not defined
-#endif
- return NAME();
-}
diff --git a/Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c b/Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c
deleted file mode 100644
index 4e80d6e..0000000
--- a/Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c
+++ /dev/null
@@ -1,12 +0,0 @@
-int srcgenex_flags_COMPILE_LANGUAGE(void)
-{
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
-#ifndef NAME
-#error NAME not defined
-#endif
- return NAME();
-}
diff --git a/Tests/GeneratorExpression/srcgenex_includes.c.in b/Tests/GeneratorExpression/srcgenex_includes.c.in
new file mode 100644
index 0000000..b48d7df
--- /dev/null
+++ b/Tests/GeneratorExpression/srcgenex_includes.c.in
@@ -0,0 +1,12 @@
+
+#include "@TARGET_NAME@.h"
+
+int @TARGET_NAME@(void)
+{
+ return 0;
+}
+
+int main(int argc, char* argv[])
+{
+ return @TARGET_NAME@();
+}
diff --git a/Tests/GeneratorExpression/srcgenex_includes.h.in b/Tests/GeneratorExpression/srcgenex_includes.h.in
new file mode 100644
index 0000000..2259ca6
--- /dev/null
+++ b/Tests/GeneratorExpression/srcgenex_includes.h.in
@@ -0,0 +1,7 @@
+
+#if !defined @TARGET_NAME@_H
+#define @TARGET_NAME@_H
+
+int @TARGET_NAME@(void);
+
+#endif
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e440b7f..d5bd297 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -176,6 +176,7 @@ add_RunCMake_test(CompileDefinitions)
add_RunCMake_test(CompileFeatures)
add_RunCMake_test(PolicyScope)
add_RunCMake_test(WriteCompilerDetectionHeader)
+add_RunCMake_test(SourceProperties)
if(NOT WIN32)
add_RunCMake_test(PositionIndependentCode)
endif()
diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake b/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake
new file mode 100644
index 0000000..dbdf7be
--- /dev/null
+++ b/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake
@@ -0,0 +1,4 @@
+include("${RunCMake_TEST_BINARY_DIR}/IncludeRegexSubdir/CMakeFiles/CMakeDirectoryInformation.cmake" OPTIONAL)
+if(NOT CMAKE_C_INCLUDE_REGEX_SCAN STREQUAL "^custom_include_regex$")
+ set(RunCMake_TEST_FAILED "CMAKE_C_INCLUDE_REGEX_SCAN has unexpected value:\n \"${CMAKE_C_INCLUDE_REGEX_SCAN}\"")
+endif()
diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir.cmake b/Tests/RunCMake/Make/IncludeRegexSubdir.cmake
new file mode 100644
index 0000000..a7a93a0
--- /dev/null
+++ b/Tests/RunCMake/Make/IncludeRegexSubdir.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+include_regular_expression("^custom_include_regex$")
+add_subdirectory(IncludeRegexSubdir)
diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt b/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt
new file mode 100644
index 0000000..e712aea
--- /dev/null
+++ b/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt
@@ -0,0 +1 @@
+# We only need this directory to be processed. No targets needed.
diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake
index 869d11e..3b2b8f5 100644
--- a/Tests/RunCMake/Make/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Make/RunCMakeTest.cmake
@@ -17,3 +17,4 @@ run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON)
run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF)
run_cmake(CustomCommandDepfile-ERROR)
+run_cmake(IncludeRegexSubdir)
diff --git a/Tests/RunCMake/SourceProperties/CMakeLists.txt b/Tests/RunCMake/SourceProperties/CMakeLists.txt
new file mode 100644
index 0000000..a17c8cd
--- /dev/null
+++ b/Tests/RunCMake/SourceProperties/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt
new file mode 100644
index 0000000..cf146c2
--- /dev/null
+++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error in CMakeLists.txt:
+ Found relative path while evaluating include directories of "empty.c":
+
+ "relative"
diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake b/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake
new file mode 100644
index 0000000..08dffa8
--- /dev/null
+++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake
@@ -0,0 +1,4 @@
+
+set_property (SOURCE empty.c PROPERTY INCLUDE_DIRECTORIES "relative")
+
+add_library (somelib empty.c)
diff --git a/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake b/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake
new file mode 100644
index 0000000..0982153
--- /dev/null
+++ b/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(RelativeIncludeDir)
diff --git a/Tests/RunCMake/SourceProperties/empty.c b/Tests/RunCMake/SourceProperties/empty.c
new file mode 100644
index 0000000..a9ec102
--- /dev/null
+++ b/Tests/RunCMake/SourceProperties/empty.c
@@ -0,0 +1,5 @@
+
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt
new file mode 100644
index 0000000..f9b8ee7
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Error in CMakeLists.txt:
+ Xcode does not support per-config per-source INCLUDE_DIRECTORIES:
+
+ \$<\$<CONFIG:Debug>:MYDEBUG>
+
+ specified for source:
+
+ .*/Tests/RunCMake/XcodeProject/main.c$
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake
new file mode 100644
index 0000000..4476c39
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_executable(main main.c)
+set_property(SOURCE main.c PROPERTY INCLUDE_DIRECTORIES "$<$<CONFIG:Debug>:MYDEBUG>")
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt
new file mode 100644
index 0000000..bfca020
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Error in CMakeLists.txt:
+ Xcode does not support per-config per-source COMPILE_OPTIONS:
+
+ \$<\$<CONFIG:Debug>:-DMYDEBUG>
+
+ specified for source:
+
+ .*/Tests/RunCMake/XcodeProject/main.c$
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake
new file mode 100644
index 0000000..f8e8030
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_executable(main main.c)
+set_property(SOURCE main.c PROPERTY COMPILE_OPTIONS $<$<CONFIG:Debug>:-DMYDEBUG>)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 1313cb5..64a07f0 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -19,7 +19,9 @@ if (NOT XCODE_VERSION VERSION_LESS 6)
endif()
run_cmake(PerConfigPerSourceFlags)
+run_cmake(PerConfigPerSourceOptions)
run_cmake(PerConfigPerSourceDefinitions)
+run_cmake(PerConfigPerSourceIncludeDirs)
# Use a single build tree for a few tests without cleaning.
diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py
index 6e8761a..edb5af6 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -288,7 +288,7 @@ def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data):
tmp = line.strip()
if tmp.endswith(" [arch]"):
tmp = tmp[0:len(tmp) - 7]
- if (len(tmp) > 0) and (" - " not in tmp) and (tmp != 'KDevelop3'):
+ if (len(tmp) > 0) and (" - " not in tmp):
cmakeGenerators.append(tmp)
generators = []
diff --git a/Tests/SourceFileIncludeDirProperty/CMakeLists.txt b/Tests/SourceFileIncludeDirProperty/CMakeLists.txt
new file mode 100644
index 0000000..786d5b6
--- /dev/null
+++ b/Tests/SourceFileIncludeDirProperty/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.0)
+
+project(SourceFileIncludeDirProperty C)
+
+#
+# Check that source level include directory take
+# precedence over target one
+
+add_executable(SourceFileIncludeDirProperty main.c)
+
+set_property (TARGET SourceFileIncludeDirProperty
+ PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/target")
+
+set_property (SOURCE main.c
+ PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/source")
diff --git a/Tests/SourceFileIncludeDirProperty/main.c b/Tests/SourceFileIncludeDirProperty/main.c
new file mode 100644
index 0000000..36144ca
--- /dev/null
+++ b/Tests/SourceFileIncludeDirProperty/main.c
@@ -0,0 +1,7 @@
+
+#include "header.h"
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/SourceFileIncludeDirProperty/source/header.h b/Tests/SourceFileIncludeDirProperty/source/header.h
new file mode 100644
index 0000000..0c6f241
--- /dev/null
+++ b/Tests/SourceFileIncludeDirProperty/source/header.h
@@ -0,0 +1,2 @@
+
+/* used header file */
diff --git a/Tests/SourceFileIncludeDirProperty/target/header.h b/Tests/SourceFileIncludeDirProperty/target/header.h
new file mode 100644
index 0000000..71c1521
--- /dev/null
+++ b/Tests/SourceFileIncludeDirProperty/target/header.h
@@ -0,0 +1,2 @@
+
+#error "wrong header file"