Commit Graph

33 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
Daniel Pfeifer 618fb23fc9 Pass arguments that are not modified as const&.
Use clang-tidy's performance-unnecessary-value-param checker to find
value parameter declarations of expensive to copy types that are not
modified inside the function.  Ignore findings in kwsys.
After applying the fix-its, manually change `const T&` to `T const&`.
2016-05-26 21:58:51 +02:00
Daniel Pfeifer 5cec953e6a Use std::replace for replacing chars in strings.
Find uses of `cmSystemTools::ReplaceString` where both `replace` and
`with` are string literals with a size of one.

Automate with:

git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
2016-05-24 23:22:20 +02: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
Domen Vrankar 44ee2d717a CPack/RPM different package names
Packagers may now set their own rpm package
file names or request that rpmbuild tool
chooses one for them. It also supports handing
of situations where one spec file may produce
multiple rpm packages.
2016-05-15 03:01:34 +02: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 180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -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
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
Clinton Stimpson e7e2694823 CPack: Fix RPM/Deb package names to not include "ALL_COMPONENTS_IN_ONE" 2012-11-06 11:50:07 -05:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04: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 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
Brad King b5b4aa2f71 Merge topic 'CPack-ChangeComponentNamingScheme'
3fb89cf CPack remove previously CPack generated files (if any) before running CPack
f2ab270 CPack  fix KWStyle warning
4deb308 CPack Authorize DISPLAY_NAME usage in component package
8c450f6 CPack remove "-ALL" suffix for ALL-IN-ONE packages
2011-03-01 15:30:14 -05:00
Eric NOULARD 5b4cbdb45e CPackRPM Replace space in some CPACK_ vars (Fix bug 9932) 2011-02-25 16:47:11 +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 0cf1d72e3c CPackRPM fix IRIX compiler warning (variable never used) 2011-02-15 19:55:36 +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 66e86b4770 CPack fix kwstyle breakage and make CPackRPM backward compatible
backward compatible= No componentized RPM unless requested
using CPACK_RPM_COMP0NENT_INSTALL
2010-11-15 20:54:19 +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
Eric NOULARD 40dc97dc73 CPack Backward-compatibly enforce DESTDIR for DEB and RPM 2010-08-23 16:14:40 +02: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 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
David Cole 5beb1da7f7 ENH: Add CPACK_SET_DESTDIR handling to enable packaging of installed files in absolute locations. With this setting on, cpack will set the DESTDIR env var when building the package so that files end up in their intended locations. Default behavior is not to set DESTDIR for backwards compatibility. Helps address issue #4993 and issue #5257. Also, remove unused CPACK_USE_DESTDIR variable. ENH: Add variable CPACK_PACKAGING_INSTALL_PREFIX to allow overriding the CPack GetPackagingInstallPrefix from a project's CMakeLists file if necessary. Could be used to remove the annoying /usr prefix still used by default in the Mac PackageMaker generator. 2007-10-31 08:50:17 -04:00
Bill Hoffman eb14543939 ENH: cpack changes, remove the escape variable stuff as it is not needed if you provide a config file for cpack 2007-10-30 23:02:43 -04:00
Alexander Neundorf feda0041c3 STYLE: InitializeInternal() is unused
Alex
2007-08-17 09:33:29 -04:00
Alexander Neundorf 45da4d2f80 ENH: patch from Eric Noulard for an RPM package generator
It seems rpmbuild can't handle paths with spaces, it complains that
Buildroot takes only one tag (or something like this), quoting and escaping
don't seem to help.

Alex
2007-08-17 09:13:15 -04:00
Alexander Neundorf 406349a1d1 COMP: silence warnings
Alex
2007-08-08 15:44:02 -04:00
Alexander Neundorf 7432ef206e ENH: add empty RPM package generator, Eric Noulard wants to work on it
Alex
2007-08-08 11:33:42 -04:00