Commit Graph

113 Commits

Author SHA1 Message Date
Brad King e1c7747253 Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -04:00
Daniel Wirtz 26fdd9c30a CPack: Fix CPACK_INSTALL_CMAKE_PROJECTS SubDirectory (4th) option 2016-02-18 09:37:59 -05:00
Stephen Kelly 20b95ef8c8 cmState: Initialize default definitions immediately.
Don't leave this as cmMakefile responsibility.
2015-10-14 00:16:20 +02:00
Stephen Kelly 94cc4e74ae CPack: Remove needless cmLocalGenerator creation. 2015-10-05 19:59:23 +02:00
Domen Vrankar 9298f56dce CPack: allow packaging of empty directories 2015-09-29 01:18:18 +02:00
Brad King 4fa1755315 Revert topic 'cpack-package-empty-dirs'
The changes in commit 47b060ae (CPackDeb: allow empty directories in
component packages, 2015-09-21), commit b58de9fe (CPack: allow packaging
of empty directories, 2015-09-21), and commit b761e90d (CPack: remove
accidental changes, 2015-09-22) regressed packaging of CMake itself.
Revert the changes until they can be revised and rebased on other
changes that make additional fixes.
2015-09-25 11:55:59 -04:00
Domen Vrankar b761e90d70 CPack: remove accidental changes
Remove changes accidentally included in commit b58de9fe (CPack: allow
packaging of empty directories, 2015-09-22).
2015-09-23 09:15:57 -04:00
Domen Vrankar b58de9fe2b CPack: allow packaging of empty directories 2015-09-22 02:08:26 +02:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 92041eec49 cmGlobalGenerator: Remove MakeLocalGenerator method.
Inline implementation to callers.
2015-08-28 18:44:38 +02:00
Stephen Kelly acb006229d cmGlobalGenerator: Require a snapshot to create a local generator. 2015-08-28 18:44:38 +02:00
Stephen Kelly c7b79aa16a cmGlobalGenerator: Require a cmake instance in ctor.
It is required anyway, so this makes it explicit.
2015-05-27 09:18:31 -04:00
Brad King be248ab435 Merge topic 'refactor-cmLocalGenerator'
fa9eb814 cmLocalGenerator: Remove redundant path access.
1933f3d1 cmLocalGenerator: Remove redundant path conversions.
9e4b6cc2 cmState: Store computed relative paths to to current directories.
991f5e49 cmState::Snapshot: Store components for current directories.
57bdc1a2 cmState: Compute and store directory components.
2015-05-19 11:09:39 -04:00
Stephen Kelly 57bdc1a2f7 cmState: Compute and store directory components.
There is no need to duplicate these in all cmLocalGenerators.

Rename the symbols according to current conventions.

Add explicit calls to Set{Source,Binary}Directory with empty strings
in order to trigger the population of the components containers with
the current working directory in cmLocalGenerator.  Having
directories set to empty is a special case in CMake, which is relied
on for the `if(CMAKE_BINARY_DIR)` condition at the end of
CMakeDetermineSystem.cmake.
2015-05-16 08:11:33 +02:00
Stephen Kelly b659d161da cmGlobalGenerator: Add NVI wrapper to create local generator. 2015-05-16 05:18:25 +02:00
Brad King 356c26ebdf cmSystemTools: Teach RunSingleCommand to separate stdout and stderr
Extend the RunSingleCommand signature to capture stdout and stderr
separately.  Allow both to be captured to the same std::string
to preserve existing behavior.  Update all call sites to do this
so that this refactoring does not introduce functional changes.
2015-04-20 15:47:50 -04:00
Stephen Kelly 6e23a4bddd cmMakefile: Remove always-null first parameter to ReadListFile. 2015-04-18 15:31:18 +02:00
Stephen Kelly fc7ab8874b CPack: Read the config listfile in the normal way.
This is a unique function call in CMake, and it was likely a
programming error when introduced.  All other similar calls to
ReadListFile use a null first paramter.

The effect of this patch is to no-longer define CMAKE_PARENT_LIST_FILE
to the config file itself while evaluating it.

The ReadListFile method also no longer hits a condition that it uses
CollapseFullPath on the input file.  However, as cpack does not
set the StartDirectory anyway, this has no effect. See bug 15522.
2015-04-18 15:26:12 +02:00
Raffi Enficiaud ed0b063085 CPack: Fix single component packaging
Refine logic added in commit 0ffd3534 (CPack single component packaging,
2015-04-02).  Component packaging should be enabled if either at least
one component or one group is set and should not require both.
2015-04-16 16:29:33 -04:00
Domen Vrankar 0ffd35340e CPack single component packaging
RPM, DEB and archive packages were not created
in cases when CPACK_<generator>_COMPONENT_INSTALL
was set to ON and a single component existed.
Patch also changes CPackRPM test to implicitly
test for this case.
2015-04-05 22:49:41 +02:00
Brad King 93a3ec8b77 CPack: Fix make tool selection during preinstall (#15483)
The CMAKE_MAKE_PROGRAM selected by CMake while configuring the project
should also be used to drive the "preinstall" target during packaging.
Teach CPack to use "cmake --build" instead of constructing the build
command line itself.  The "cmake --build" command already knows how
to select the proper make tool.
2015-03-31 10:30:25 -04:00
Gregor Jasny ce935ebe50 cmake: Teach --build to honor CMAKE_VERBOSE_MAKEFILE for Ninja
The Ninja build system does not support a in-file verbositiy switch.
Instead teach 'cmake --build' to extract the CMAKE_VERBOSE_MAKEFILE
setting and pass it as an optional '-v' argument to Ninja.  This can
serve as a reasonable fallback.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-02-26 09:51:11 -05:00
Stephen Kelly af65da0aa9 cmStandardIncludes: Remove list include.
Include it only where used.
2015-02-06 19:04:53 +01:00
Bill Hoffman 81221b80e2 CPack: Fix packaging of source tarballs with symbolic links
When staging the package installation, if the first file in a directory
happens to be a symbolic link, make sure we create the directory before
trying to create the link.
2015-01-30 10:06:09 -05:00
Stephen Kelly f09fde2d21 Replace 'foo.length() > 0' pattern with !foo.empty(). 2015-01-18 14:25:25 +01:00
Stephen Kelly d92887efab Replace 'foo.size() > 0' pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Domen Vrankar f89e41c3e7 CPack invalid CMake generator
Case where CPACK_CMAKE_GENERATOR value is non existent or
or contains multiple words that were not quoted was not
handled and produced a segmentation fault.
2015-01-02 10:46:08 +01:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Bill Hoffman 2cac483e64 Fix used value warning.
packageFileName no longer has only one value in this function.  Move the
declaration into the loop and remove its initial and unused asignment.
2014-08-05 10:22:36 -04:00
Brad King 3bae343f62 cmCPackGenerator: Avoid crash on undefined CMAKE_MAKE_PROGRAM
Since commit 6557382d (stringapi: Use strings for program
paths, 2014-02-24), cmGlobalGenerator::GenerateBuildCommand
takes the make program path as a std::string.  Fix the lookup
in cmCPackGenerator::InstallProjectViaInstallCMakeProjects to
use GetSafeDefinition for CMAKE_MAKE_PROGRAM to avoid possible
construction of std::string from a NULL.

Reported-by: Richard Wirth <richard@califax.de>
2014-06-25 09:18:27 -04:00
Nils Gladitz 15a8af21e8 Add an "installed file" property scope
Teach set_property and get_property an "INSTALL" property type to be
associated with install-tree file paths.  Make the properties available
to CPack for use during packaging.  Add a "prop_inst" Sphinx domain
object type for documentation of such properties.
2014-05-28 12:28:18 -04:00
Stephen Kelly af8a1643c1 Remove c_str calls when using stream APIs.
Use an ad-hoc clang tool for matching the calls which should be
ported.
2014-03-11 15:03:50 +01:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Ben Boeckel 191f25e2bd stringapi: Prevent a NULL dereference in WiX 2014-03-08 13:05:40 -05:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 2b17626e9b stringapi: Pass strings as install directories in CPack 2014-03-08 13:05:37 -05:00
Ben Boeckel 84fdc9921c stringapi: Pass configuration names as strings 2014-03-08 13:05:36 -05:00
Ben Boeckel 9f48d3bac2 stringapi: Use strings in CPack generator parameters
Most of these are turned into strings in the body of the method
(multiple times in some cases). Accept strings to simplify the API and
keep string construction down.
2014-03-08 13:05:30 -05:00
Ben Boeckel 3742bb0d32 stringapi: Use strings for variable names
Variable names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Nils Gladitz 378eb5b712 CPackWIX: Allow Windows Installer property customization 2014-03-01 23:13:35 +01:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Nils Gladitz 5bc64440e1 CPack: use IsOn instead of IsSet for boolean CPack options
The CPackComponent macros specifically set CPack options to FALSE
which CPack previously interpreted to mean "true".
2013-11-19 23:52:39 +01:00
Brad King 8904d1410b cmGlobalGenerator: Cleanup GenerateBuildCommand API
All cmGlobalGenerator::GenerateBuildCommand call sites that need to
produce a string now generate "cmake --build" commands.  The remaining
call sites immediately pass the result to cmSystemTools::RunSingleCommand.
Avoid the intermediate string and argument parsing by directly producing a
vector of strings.  Also drop the ignoreErrors argument because no call
sites remain that use it.
2013-11-18 08:26:21 -05:00
Brad King d1526f825e Refactor internal resource location APIs and initialization
Rename cmSystemTools::FindExecutableDirectory to FindCMakeResources.
Teach it to compute the locations of cmake, ctest, cpack, ccmake, and
cmake-gui executables, and the location of CMAKE_ROOT.  Provide this
information from static cmSystemTools::Get<resource>() methods.
Refactor code that needs these locations to use the new APIs.

Teach FindCMakeResources to use the OS X system API to lookup the
executable location.  When running from the CMake build tree itself,
leave a file in the tree that FindCMakeResources can use to read the
location of the source tree.  This avoids the need to compile the source
tree location into a binary that may be installed and used without the
source tree.

Teach the QtDialog on OS X to create a "cmake-gui" symlink in the build
tree next to "cmake" and the other tools, as is already done in the
install tree for the application bundle.  This ensures a consistent set
of executables are available in one directory.
2013-11-12 08:23:35 -05:00
Adrien Destugues 1dc61f8142 Haiku: Remove use of B_COMMON_DIRECTORY
The common directory was removed in Haiku. Applications are now
installed in the system directory.

Applied-by: Rolf Eike Beer <eike@sf-mail.de>
2013-10-08 09:55:38 -04:00
Petr Kmoch de8be9ef7d Add projectDir parameter to GenerateBuildCommand
Extend the cmGlobalGenerator::GenerateBuildCommand virtual method
signature with a "projectDir" parameter specifying the top of the
project build tree for which the build command will be generated.
Populate it from call sites in cmGlobalGenerator::Build where a
fully-generated build tree should be available.
2013-04-12 11:35:35 -04:00
Stephen Kelly ddc052052b Always use the auto_ptr from cmsys.
This is for consistency throughout cmake. The cmsys version exists
becaues uses of auto_ptr types as return types does not work with
some implementations in ancient compilers.
2012-11-21 00:56:36 +01:00
Brad King 7cdc95ac36 Merge topic 'CPack-BugFixesSet'
b6f7881 Remove seemingly bogus duplicate CPACK_PACKAGE_FILE_NAME call.
2012-11-13 14:32:09 -05:00