Commit Graph

39 Commits

Author SHA1 Message Date
Daniel Pfeifer 7f6b8d3399 Simplify boolean expressions
Use clang-tidy's readability-simplify-boolean-expr checker.
After applying the fix-its, revise all changes *very* carefully.
Be aware of false positives and invalid changes.
2016-06-02 08:24:04 -04:00
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King 0ac18d40c8 Remove `//------...` horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00
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
Stephen Kelly 74d565e0e9 Remove unused cmLocalGenerator include. 2015-10-05 20:59:56 +02:00
Domen Vrankar 9298f56dce CPack: allow packaging of empty directories 2015-09-29 01:18:18 +02:00
Nils Gladitz d2cc580704 cmake: Teach "-E tar" command a "--format=" option
Allows specifying a libarchive defined archive format currently restricted to
7zip, gnutar, pax, paxr and zip.

The default is "paxr" (pax restricted).
2015-04-10 08:32:31 -04:00
Clinton Stimpson e3f84fc504 cpack: Fix CPACK_PACKAGING_INSTALL_PREFIX handling for archives (#14677)
Fix the case when the archive generator is used to package components
with an install prefix.
2015-03-30 09:22:14 -04: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
Eric NOULARD 805c1b21d6 Handle CPACK_MONOLITHIC_INSTALL in some rare use cases.
For example, when CPACK_<GEN>_COMPONENT_INSTALL and
CPACK_MONOLITHIC_INSTALL are both set. Previously, this
combination of variable settings produced an error without
any explanation. Now, in this case CPACK_MONOLITHIC_INSTALL wins
without trouble.
This is useful for when e.g. CPACK_ARCHIVE_COMPONENT_INSTALL is
globally on and one wants MONOLITHIC install for STGZ (but not
other generators). The same behavior may be obtained by re-setting
CPACK_ARCHIVE_COMPONENT_INSTALL to 0 but in any case the
'both set' case should have been handled without error.
2012-03-18 20:21:35 +01:00
Eric NOULARD 5d18851b25 CPackArchive restore default behavior and provide new variable.
CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY should be set by the user
in order to get the toplevel directory included in the archive
whenever a componentized archive is requested. This solves bug #12129
and keeps fully backward compatible behavior.
2012-02-01 23:32:50 +01:00
Daniel Nelson 3cab24a974 CPack Add top level directory in component install for Archive Generators
This patch fixes bug #0012129
Signed-off-by: Eric NOULARD <eric.noulard@gmail.com>
2012-01-13 22:01:53 +01:00
Eric NOULARD 9c43824066 Fix KWStyle warnings 2011-04-04 14:59:58 -04:00
Clinton Stimpson 64a5e20999 Combine component packaging methods into an enum.
Also allow generators to override the default packaging method.
Add a ONE_PER_GROUP option so that method can be specified by the user without relying on defaults.
2011-03-31 13:33:03 -04:00
Eric NOULARD 6dfc818394 CPack fix #11930 and simplifies component packaging options 2011-03-23 18:28:05 +01:00
Eric NOULARD fe530ff5e9 CPackArchive package all components specified in CPACK_COMPONENTS_ALL
When asking for group packaging the components not belonging to
any group should be packaged separately.
2011-03-03 21:19:13 +01:00
Eric NOULARD 4deb308e82 CPack Authorize DISPLAY_NAME usage in component package
Second (last) part fix of feature request #11814
2011-02-22 23:49:49 +01:00
Eric NOULARD 8c450f6287 CPack remove "-ALL" suffix for ALL-IN-ONE packages
First part fix of feature request 11814
2011-02-22 22:56:26 +01:00
Eric NOULARD 494bb8ada7 CPackRPM honors all the different ways of packaging components
RPM cannot easily 'merge' differents directory into a single RPM
with shared prefix. So more flexibility has been added to generic
CPackGenerator in order to let the specific generator chose the
local installation directory for each component.
2011-02-06 21:23:10 +01:00
Eric NOULARD 6d94ea3692 CPack use IsOn when it's better than IsSet
This authorize more control because one can set
CPACK_ARCHIVE_COMPONENT_INSTALL to ON globally
and then set it selectively to OFF inside
a CPack project config file.
Sidenote: GetOption ought to be a 'const' method.
2010-12-12 12:55:02 +01:00
Eric NOULARD 12a7125b32 CPack Fix KWStyle error 2010-12-01 21:00:38 +01:00
Eric NOULARD d0eb89c17b CPack backward compatibility fix 2.8.3-2.8.2 (bug 11452)
One should set CPACK_ARCHIVE_COMPONENT_INSTALL=1 in order to
trigger component install for ARCHIVE generators
2010-11-29 18:57:24 +01:00
Eric NOULARD 2c84d169b3 CPackRPM add basic component support to CPackRPM
basic means 1 RPM per component and no dependency handling
this implies some CPackGenerator refactoring
2010-11-13 17:56:36 +01:00
Bill Hoffman 390117435a Fix KWStyle line length issues. 2010-09-15 16:41:41 -04:00
Eric NOULARD 873e99a27d CPackArchiveGenerator improve usability and robustness
Handle the "no group defined" case
Implement the idea from Rolf Eike Beer to have a single
var CPACK_COMPONENTS_GROUPING with several values
2010-08-24 21:42:54 +02:00
Eric NOULARD 654683adc7 CPackArchiveGenerator add component supports 2010-08-24 21:42:21 +02:00
Eric NOULARD 36a550ae7a CPackArchiveGenerator use cmArchiveWrite wrapper 2010-08-24 21:41:32 +02:00
Brad King cc2ba7f9c2 Merge topic 'CPack-APIredesign'
bd510fe CPack: Avoid member shadowing after API refactor (part2)
31a313d CPack: Avoid member shadowing after API refactor
cd7b8a0 CPack: Refactor API in order to handle multi-file packages
2010-08-17 15:12:42 -04:00
Eric NOULARD cd7b8a03f5 CPack: Refactor API in order to handle multi-file packages
The multi-argument CompressFiles(...) method has been replace by the
no-argument PackageFiles() method and 3 more member variables.  This
will enable implemention of multi-package generators.  Now each specific
generator (which overloads PackageFiles()) may decide to change the name
and/or the number of generated package files.
2010-08-11 14:09:52 -04:00
Brad King 3296e6ad90 Include headers from chosen libarchive (#10923)
When CMAKE_USE_SYSTEM_LIBARCHIVE is on we must include the system
libarchive headers to match the library that will be linked.
2010-08-05 17:06:10 -04:00
David Cole 10a4abddfd Add missing archive_read_finish calls to fix some of the presently reported valgrind memory leaks. 2009-12-28 13:15:19 -05:00
Bill Hoffman 22fb266d06 use different tar format to handle longer file names 2009-11-14 08:48:32 -05:00
Bill Hoffman 70dbbcc542 add better error checking and run from correct directory. 2009-11-09 09:58:03 -05:00
Bill Hoffman 4fd75f959a add better error checking and support for symlinks to cpack's use of libarchive 2009-11-08 20:54:13 -05:00
Bill Hoffman b0d43475c6 Fix warning 2009-11-03 17:21:25 -05:00
Bill Hoffman 5f41fe03ca Fix warnings for unused variables 2009-11-03 16:50:49 -05:00
Bill Hoffman 78b2d5097c Fix cygwin package stuff to work with libarchive 2009-11-03 09:40:57 -05:00
Bill Hoffman d4b8945301 Fix for hpux... 2009-11-02 09:20:53 -05:00
Bill Hoffman fb51d98562 Switch to using libarchive from libtar for cpack and cmake -E tar
This allows for a built in bzip and zip capability, so external tools
will not be needed for these packagers.  The cmake -E tar xf should be
able to handle all compression types now as well.
2009-10-30 13:10:56 -04:00