mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
Merge topic 'KateImprovements'
e7f7bff4f5Kate: improve the way the VCS-specific files are searched96389b4cd3Kate: add support for hg and fossil4c32623f5fHelp: fix typo in docs for set_property()9a7612d2d0Kate: make it possible to force a mode for the "files" entry8a7aa2642bHelp: add documentation for Kate-related variable Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8154
This commit is contained in:
@@ -90,7 +90,7 @@ It must be one of the following:
|
||||
for tests created by the :command:`add_test(NAME)` signature.
|
||||
|
||||
``CACHE``
|
||||
Scope must name zero or more cache existing entries.
|
||||
Scope must name zero or more existing cache entries.
|
||||
|
||||
The required ``PROPERTY`` option is immediately followed by the name of
|
||||
the property to set. Remaining arguments are used to compose the
|
||||
|
||||
@@ -226,6 +226,8 @@ Variables that Change Behavior
|
||||
/variable/CMAKE_INSTALL_MESSAGE
|
||||
/variable/CMAKE_INSTALL_PREFIX
|
||||
/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
|
||||
/variable/CMAKE_KATE_FILES_MODE
|
||||
/variable/CMAKE_KATE_MAKE_ARGUMENTS
|
||||
/variable/CMAKE_LIBRARY_PATH
|
||||
/variable/CMAKE_LINK_DIRECTORIES_BEFORE
|
||||
/variable/CMAKE_LINK_LIBRARIES_ONLY_TARGETS
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
CMAKE_KATE_FILES_MODE
|
||||
---------------------
|
||||
|
||||
.. versionadded:: 3.27
|
||||
|
||||
This cache variable is used by the Kate project generator and controls
|
||||
to what mode the ``files`` entry in the project file will be set. See
|
||||
:manual:`cmake-generators(7)`.
|
||||
|
||||
Possible values are ``AUTO``, ``SVN``, ``GIT``, ``HG``, ``FOSSIL`` and ``LIST``.
|
||||
|
||||
When set to ``LIST``, CMake will put the list of source files known to CMake
|
||||
in the project file.
|
||||
When set to ``SVN``, ``GIT``, ``HG`` or ``FOSSIL``, CMake will set
|
||||
the generated project accordingly to Subversion, git, Mercurial
|
||||
or Fossil, and Kate will then use the respective command line tool to
|
||||
retrieve the list of files in the project.
|
||||
When unset or set to ``AUTO``, CMake will try to detect whether the
|
||||
source directory is part of a git or svn checkout or not, and put the
|
||||
respective entry into the project file.
|
||||
@@ -0,0 +1,11 @@
|
||||
CMAKE_KATE_MAKE_ARGUMENTS
|
||||
-------------------------
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
This cache variable is used by the Kate project generator. See
|
||||
:manual:`cmake-generators(7)`.
|
||||
|
||||
This variable holds arguments which are used when Kate invokes the make
|
||||
tool. By default it is initialized to hold flags to enable parallel builds
|
||||
(using -j typically).
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
# This file is included in CMakeSystemSpecificInformation.cmake if
|
||||
# the Eclipse CDT4 extra generator has been selected.
|
||||
# the Kate extra generator has been selected.
|
||||
|
||||
|
||||
# Try to find out how many CPUs we have and set the -j argument for make accordingly
|
||||
@@ -17,5 +17,9 @@ if("${_CMAKE_KATE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMA
|
||||
set(_CMAKE_KATE_INITIAL_MAKE_ARGS "-j${_CMAKE_KATE_PROCESSOR_COUNT}")
|
||||
endif()
|
||||
|
||||
# This variable is used by the Eclipse generator and appended to the make invocation commands.
|
||||
# This variable is used by the Kate generator and appended to the make invocation commands.
|
||||
set(CMAKE_KATE_MAKE_ARGUMENTS "${_CMAKE_KATE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Kate invokes make. Enter e.g. -j<some_number> to get parallel builds")
|
||||
|
||||
|
||||
set(CMAKE_KATE_FILES_MODE "AUTO" CACHE STRING "Option to override the version control detection and force a mode for the Kate project.")
|
||||
set_property(CACHE CMAKE_KATE_FILES_MODE PROPERTY STRINGS "AUTO;SVN;GIT;LIST")
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "cmCMakePath.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -220,17 +221,58 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile(
|
||||
std::string cmExtraKateGenerator::GenerateFilesString(
|
||||
const cmLocalGenerator& lg) const
|
||||
{
|
||||
std::string s = cmStrCat(lg.GetSourceDirectory(), "/.git");
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return "\"git\": 1 ";
|
||||
const cmMakefile* mf = lg.GetMakefile();
|
||||
std::string mode =
|
||||
cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE"));
|
||||
static const std::string gitString = "\"git\": 1 ";
|
||||
static const std::string svnString = "\"svn\": 1 ";
|
||||
static const std::string hgString = "\"hg\": 1 ";
|
||||
static const std::string fossilString = "\"fossil\": 1 ";
|
||||
|
||||
if (mode == "SVN") {
|
||||
return svnString;
|
||||
}
|
||||
if (mode == "GIT") {
|
||||
return gitString;
|
||||
}
|
||||
if (mode == "HG") {
|
||||
return hgString;
|
||||
}
|
||||
if (mode == "FOSSIL") {
|
||||
return fossilString;
|
||||
}
|
||||
|
||||
s = cmStrCat(lg.GetSourceDirectory(), "/.svn");
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return "\"svn\": 1 ";
|
||||
}
|
||||
// check for the VCS files except when "forced" to "FILES" mode:
|
||||
if (mode != "LIST") {
|
||||
cmCMakePath startDir(lg.GetSourceDirectory(), cmCMakePath::auto_format);
|
||||
// move the directories up to the root directory to see whether we are in
|
||||
// a subdir of a svn, git, hg or fossil checkout
|
||||
for (;;) {
|
||||
std::string s = startDir.String() + "/.git";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return gitString;
|
||||
}
|
||||
|
||||
s = cmStrCat(lg.GetSourceDirectory(), '/');
|
||||
s = startDir.String() + "/.svn";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return svnString;
|
||||
}
|
||||
|
||||
s = startDir.String() + "/.hg";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return hgString;
|
||||
}
|
||||
s = startDir.String() + "/.fslckout";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return fossilString;
|
||||
}
|
||||
|
||||
if (!startDir.HasRelativePath()) { // have we reached the root dir ?
|
||||
break;
|
||||
}
|
||||
startDir = startDir.GetParentPath();
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> files;
|
||||
std::string tmp;
|
||||
|
||||
Reference in New Issue
Block a user