[cmake-developers] [PATCH] Fixed some documentation typos
--- Help/manual/cmake-packages.7.rst | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index b9073a5..aebc5d9 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -89,7 +89,7 @@ a package is to set the ``CMAKE_PREFIX_PATH`` cache variable. Config-file packages are provided by upstream vendors as part of development packages, that is, they belong with the header files and any other files -provided to assist downsteams in using the package. +provided to assist downstreams in using the package. A set of variables which provide package status information are also set automatically when using a config-file package. The ``_FOUND`` @@ -352,7 +352,7 @@ version-specific variables ``_VERSION``, ``_VERSION_MAJOR``, used to export the targets in the ``ClimbingStatsTargets`` export-set, defined previously by the :command:`install(TARGETS)` command. This command generates the ``ClimbingStatsTargets.cmake`` file to contain :prop_tgt:`IMPORTED` -targets, suitable for use by downsteams and arranges to install it to +targets, suitable for use by downstreams and arranges to install it to ``lib/cmake/ClimbingStats``. The generated ``ClimbingStatsConfigVersion.cmake`` and a ``cmake/ClimbingStatsConfig.cmake`` are installed to the same location, completing the package. @@ -383,7 +383,7 @@ In this case, when using :command:`install(TARGETS)` the ``INCLUDES DESTINATION` was specified. This causes the ``IMPORTED`` targets to have their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` populated with the ``include`` directory in the :variable:`CMAKE_INSTALL_PREFIX`. When the ``IMPORTED`` -target is used by downsteam, it automatically consumes the entries from +target is used by downstream, it automatically consumes the entries from that property. Creating a Package Configuration File @@ -412,7 +412,7 @@ This can also be extended to cover dependencies: target_link_libraries(ClimbingStats PUBLIC Stats::Types) As the ``Stats::Types`` target is a ``PUBLIC`` dependency of ``ClimbingStats``, -downsteams must also find the ``Stats`` package and link to the ``Stats::Types`` +downstreams must also find the ``Stats`` package and link to the ``Stats::Types`` library. The ``Stats`` package should be found in the ``ClimbingStatsConfig.cmake`` file to ensure this. The ``find_dependency`` macro from the :module:`CMakeFindDependencyMacro` helps with this by propagating @@ -464,7 +464,7 @@ Creating a Package Configuration File for the Build Tree The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets definition file which is specific to the build-tree, and is not relocatable. -This can similiarly be used with a suitable package configuration file and +This can similarly be used with a suitable package configuration file and package version file to define a package for the build tree which may be used without installation. Consumers of the build tree can simply ensure that the :variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the -- 2.7.1 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH v2] Now prints warning when --build is not honored
--- In this version of the patch I've changed the message printed to give more information on how '--build' should be used. Source/cmake.cxx | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8f6b952..95948d5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -798,6 +798,12 @@ void cmake::SetArgs(const std::vector& args, this->SetGlobalGenerator(gen); } } +else if (arg.find("--build", 0) == 0) + { + cmSystemTools::Message("Ignoring option '--build' " + "because it is meant to be used only " + "to drive an already-generated project build system." , "Warning"); + } // no option assume it is the path to the source else { -- 2.7.1 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH] Now prints line number of cache parse error
To fix issue 11109, this patch implements the printing of the line number of the CMakeCache.txt file that causes a parse error when an error occurs. --- Source/cmCacheManager.cxx | 10 -- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 5 + Tests/RunCMake/CommandLine/cache-bad-entry-result.txt | 1 + Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt | 1 + Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt | 10 ++ Tests/RunCMake/CommandLine/cache-empty-entry-result.txt | 1 + Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt | 1 + Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt | 7 +++ 8 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry-result.txt create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry-result.txt create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index ce8af55..7466c29 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -64,12 +64,14 @@ bool cmCacheManager::LoadCache(const std::string& path, const char *realbuffer; std::string buffer; std::string entryKey; + unsigned int lineno = 0; while(fin) { // Format is key:type=value std::string helpString; CacheEntry e; cmSystemTools::GetLineFromStream(fin, buffer); +lineno++; realbuffer = buffer.c_str(); while(*realbuffer != '0' && (*realbuffer == ' ' || @@ -77,6 +79,7 @@ bool cmCacheManager::LoadCache(const std::string& path, *realbuffer == '\r' || *realbuffer == '\n')) { + if (*realbuffer == '\n') lineno++; realbuffer++; } // skip blank lines and comment lines @@ -96,6 +99,7 @@ bool cmCacheManager::LoadCache(const std::string& path, helpString += [2]; } cmSystemTools::GetLineFromStream(fin, buffer); + lineno++; realbuffer = buffer.c_str(); if(!fin) { @@ -138,8 +142,10 @@ bool cmCacheManager::LoadCache(const std::string& path, } else { - cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(), - ". Offending entry: ", realbuffer); + std::ostringstream error; + error << "Parse error in cache file " << cacheFile; + error << " on line " << lineno << ". Offending entry: " << realbuffer; + cmSystemTools::Error(error.str().c_str()); } } this->CacheMajorVersion = 0; diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index e77ba1f..8068973 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -33,6 +33,11 @@ run_cmake_command(build-bad-dir run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +run_cmake_command(cache-bad-entry + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/) +run_cmake_command(cache-empty-entry + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/) + function(run_BuildDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt new file mode 100644 index 000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt new file mode 100644 index 000..35e8be2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Parse error in cache file /home/ashley/workspace/cmake/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt on line 7. Offending entry: BAD ENTRY.* diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt new file mode 100644 index 000..75cd7c2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt @@ -0,0 +1,10 @@ +# This is a comment + +// That was an empty line. This isn't. +EMPTY_LINE:BOOL=FALSE + +// Uhoh! Here it comes +BAD ENTRY + +// This is fine +GOOD_ENTRY:BOOL=TRUE diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt new file mode 100644 index 000..d00491f --- /dev/null +++
[cmake-developers] [PATCH] Now prints warning when --build is not honored
As per issue 12641, this patch means that a warning is given when the "--build" option is ignored. I'm not sure if you'd want a different error message here. I feel like it might be better to print something about the fact that "--build" should be used after the binary tree has been generated, but I can't think of a good way to word it. Also this doesn't print a warning when "--build" is used in command mode. It felt unnecessary. --- Source/cmake.cxx | 5 + 1 file changed, 5 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8f6b952..27378c9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -798,6 +798,11 @@ void cmake::SetArgs(const std::vector& args, this->SetGlobalGenerator(gen); } } +else if (arg.find("--build", 0) == 0) + { + cmSystemTools::Message("--build is not a valid option when " + "generating a project binary tree. Ignoring.", "Warning"); + } // no option assume it is the path to the source else { -- 2.6.4 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH] Added FILTER subcommand to list command
In response to issue 0003986, I've implemented a FILTER subcommand to the "list" command that filters a list using a regular expression. This doesn't implement an optional "OUTPUT_VARIABLE" parameter. There was a discussion on the issue as to whether or not the user using a macro would be a better option. Therefore I've submitted a sample macro for the reporter on the issue as well if this patch isn't accepted. --- Help/command/list.rst | 12 +++-- Source/cmListCommand.cxx | 54 ++ Source/cmListCommand.h | 1 + Tests/RunCMake/list/EmptyFilter-result.txt | 1 + Tests/RunCMake/list/EmptyFilter-stderr.txt | 0 Tests/RunCMake/list/EmptyFilter.cmake | 2 + Tests/RunCMake/list/FILTER-InvalidRegex-result.txt | 1 + Tests/RunCMake/list/FILTER-InvalidRegex-stderr.txt | 4 ++ Tests/RunCMake/list/FILTER-InvalidRegex.cmake | 2 + Tests/RunCMake/list/FILTER-NotList-result.txt | 1 + Tests/RunCMake/list/FILTER-NotList-stderr.txt | 4 ++ Tests/RunCMake/list/FILTER-NotList.cmake | 2 + .../list/FILTER-TooManyArguments-result.txt| 1 + .../list/FILTER-TooManyArguments-stderr.txt| 4 ++ Tests/RunCMake/list/FILTER-TooManyArguments.cmake | 1 + Tests/RunCMake/list/FILTER-Valid0-result.txt | 1 + Tests/RunCMake/list/FILTER-Valid0-stderr.txt | 2 + Tests/RunCMake/list/FILTER-Valid0.cmake| 4 ++ Tests/RunCMake/list/RunCMakeTest.cmake | 6 +++ 19 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/list/EmptyFilter-result.txt create mode 100644 Tests/RunCMake/list/EmptyFilter-stderr.txt create mode 100644 Tests/RunCMake/list/EmptyFilter.cmake create mode 100644 Tests/RunCMake/list/FILTER-InvalidRegex-result.txt create mode 100644 Tests/RunCMake/list/FILTER-InvalidRegex-stderr.txt create mode 100644 Tests/RunCMake/list/FILTER-InvalidRegex.cmake create mode 100644 Tests/RunCMake/list/FILTER-NotList-result.txt create mode 100644 Tests/RunCMake/list/FILTER-NotList-stderr.txt create mode 100644 Tests/RunCMake/list/FILTER-NotList.cmake create mode 100644 Tests/RunCMake/list/FILTER-TooManyArguments-result.txt create mode 100644 Tests/RunCMake/list/FILTER-TooManyArguments-stderr.txt create mode 100644 Tests/RunCMake/list/FILTER-TooManyArguments.cmake create mode 100644 Tests/RunCMake/list/FILTER-Valid0-result.txt create mode 100644 Tests/RunCMake/list/FILTER-Valid0-stderr.txt create mode 100644 Tests/RunCMake/list/FILTER-Valid0.cmake diff --git a/Help/command/list.rst b/Help/command/list.rst index a7a05c7..797cc14 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -9,6 +9,7 @@ List operations. list(GET [ ...] ) list(APPEND [ ...]) + list(FILTER ) list(FIND ) list(INSERT[ ...]) list(REMOVE_ITEM [ ...]) @@ -23,6 +24,11 @@ List operations. ``APPEND`` will append elements to the list. +``FILTER`` will remove the items from the list that match the given regular +expression. +For more information on regular expressions see also the :command:`string` +command. + ``FIND`` will return the index of the element specified in the list or -1 if it wasn't found. @@ -38,9 +44,9 @@ difference is that ``REMOVE_ITEM`` will remove the given items, while ``SORT`` sorts the list in-place alphabetically. -The list subcommands ``APPEND``, ``INSERT``, ``REMOVE_AT``, ``REMOVE_ITEM``, -``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new values for -the list within the current CMake variable scope. Similar to the +The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``, +``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new +values for the list within the current CMake variable scope. Similar to the :command:`set` command, the LIST command creates new variable values in the current scope, even if the list itself is actually defined in a parent scope. To propagate the results of these operations upwards, use diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 6041fb7..bafd647 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -14,6 +14,7 @@ #include #include "cmAlgorithms.h" +#include #include // required for atoi #include #include @@ -68,6 +69,10 @@ bool cmListCommand { return this->HandleReverseCommand(args); } + if(subCommand == "FILTER") +{ +return this->HandleFilterCommand(args); +} std::string e = "does not recognize sub-command "+subCommand; this->SetError(e); @@ -517,3 +522,52 @@ bool cmListCommand::HandleRemoveAtCommand( return true; } +// +class MatchesRegex { +public: + MatchesRegex(cmsys::RegularExpression& in_regex) : regex(in_regex) {} + + bool operator()(const std::string& target) { +