Commit Graph

50 Commits

Author SHA1 Message Date
Brad King 64b5520346 Isolate formatted streaming blocks with clang-format off/on
The clang-format tool can do a good job formatting most code, but
well-organized streaming blocks are best left manually formatted.

Find blocks of the form

    os <<
      "...\n"
      "...\n"
      ;

using the command

    $ git ls-files -z -- Source |
      egrep -v -z '^Source/kwsys/' |
      xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
        '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}'

Find blocks of the form

    os << "...\n"
       << "...\n"
       << "...\n";

using the command

    $ git ls-files -z -- Source |
      egrep -v -z '^Source/kwsys/' |
      xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
        '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}'

Surround such blocks with the pair

    /* clang-format off */
    ...
    /* clang-format on */

in order to protect them from update by clang-format.  Use the C-style
`/*...*/` comments instead of C++-style `//...` comments in order to
prevent them from ever being swallowed by re-formatting of surrounding
comments.
2016-05-06 14:25:55 -04:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly 55d80d0a85 cmMakefile: Rename GetCurrent{,Source}Directory.
Match the names used in cmake code.
2015-04-21 00:12:52 +02:00
Brad King 3ef776fc38 configure_file: Do not warn about newline style arguments
The unknown argument warning added by commit v3.2.0-rc1~452^2
(configure_file: Warn about unknown arguments, 2014-10-31) failed to
account for options handled by the NewLineStyle member instead of
directly in the main loop.  Simply whitelist them for now.
2015-03-09 09:17:59 -04: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
Brad King 6aa2d47737 Merge topic 'fix-configure_file-COPYONLY'
1531df2b configure_file: Warn about unknown arguments
4abbb140 Qt4: Fix configure_file call to use COPYONLY, not COPY_ONLY
bd7ba8e2 KWSys: Fix configure_file call to use COPYONLY, not COPY_ONLY
e9282782 Help: Fix configure_file call to use COPYONLY, not COPY_ONLY
2014-11-03 09:08:35 -05:00
Brad King 1531df2b86 configure_file: Warn about unknown arguments
Extend the RunCMake.configure_file test with a case covering possible
common typos of the COPYONLY option.

Reported-by: Iosif Neitzke <iosif.neitzke@gmail.com>
2014-10-31 13:21:21 -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
Brad King 7d47c69365 Drop compatibility with CMake < 2.4
Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
a value lower than 2.4, and generate an error when projects or the user
attempt to do so.  In the error suggest using a CMake 2.8.x release.

Teach cmake_minimum_required to warn about projects that do not require
at least CMake 2.4.  They are not supported by CMake >= 3.0.

Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
reference to policy CMP0001.
2013-10-23 08:54:31 -04: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
Peter Kuemmel a087490697 Add NEWLINE_STYLE option to configure_file (#3957) 2011-11-28 13:48:59 -05: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
Brad King 6e8aeba415 Teach configure_file to handle directory names
This commit teaches configure_file how to handle directories for input
and output.  It is an error if the input is a directory.  If the output
is a directory we put the configured copy of the input file in it with
the same name.  See issue #9537.
2009-09-16 15:09:42 -04:00
Brad King 700cdf393a Teach configure_file to handle relative paths
The configure_file() command now converts relative output paths to full
paths using the current binary directory.  Input relative paths were
already converted using the current source directory, but this behavior
was not previously documented.
2009-09-16 15:09:29 -04:00
Brad King dda0da8b9e Fix typo in cmConfigureFileCommand ivar name
Rename 'OuputFile' to 'OutputFile'.
2009-09-16 15:09:19 -04:00
Brad King 5233b75a77 ENH: Improve handling of old-style compatibility.
- Remove CMP_0001 (no slash in target name) and restore
    old CMAKE_BACKWARDS_COMPATIBILITY check for it
  - Replace all checks of CMAKE_BACKWARDS_COMPATIBILITY
    with cmLocalGenerator::NeedBackwardsCompatibility calls
  - Create new CMP_0001 to determine whether or not
    CMAKE_BACKWARDS_COMPATIBILITY is used.
    (old = use, new = ignore)
  - Show CMAKE_BACKWARDS_COMPATIBILITY in cache only when
    CMP_0001 is set to OLD or WARN
  - Update documentation of cmake_policy and cmake_minimum_required
    to indicate their relationship and the 2.4 version boundary
  - When no cmake policy version is set in top level makefile
    implicitly call cmake_policy(VERSION 2.4) which restores
    CMAKE_BACKWARDS_COMPATIBILITY and other 2.4 compatibility
  - Fix tests MakeClean and Preprocess to call
    cmake_policy(VERSION 2.6) because they depend on new policies
2008-03-07 15:30:35 -05:00
Ken Martin 5588ed47fc BUG: change in handling of cmake_minimum_required 2008-03-06 15:08:03 -05:00
Ken Martin adddcea5d7 BUG: change the handling of CMAKE_MINIMUM_REQUIRED and BACKWARDS_COMPATIBILITY and extend the documentaiton quite a bit 2008-03-06 10:57:59 -05:00
Ken Martin f2c6e9e480 BUG: some fixes, still a few to go 2008-03-05 11:41:25 -05:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Andy Cedilnik 0b92b2faf5 BUG: No need for the backward compatibility variable warning 2007-04-04 12:05:44 -04:00
Ken Martin d77fbb9640 STYLE: fix line length 2006-05-10 14:15:15 -04:00
Andy Cedilnik ee1975570e ENH: Allow blocking of writing into the source tree 2006-03-22 14:40:36 -05:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Ken Martin f3ed62b75a ENH: configure file will assume start source dir if a full path is not provided 2005-07-07 16:01:35 -04:00
Ken Martin c9cc368a9d ENH: made configure file immediate by default for 2.2 or later 2005-06-13 09:33:38 -04:00
Andy Cedilnik 4a1f15c344 ENH: If configure file fails do not create directory 2004-03-28 16:00:57 -05:00
Andy Cedilnik 3f752ea4cd ENH: Move implementation of configure_file to cmMakefile, so that other classes can use it 2004-03-08 19:05:04 -05:00
Brad King 1dd718457f ENH: Moved variable and #cmakedefine replacement from cmConfigureFileCommand.cxx to a ConfigureString method on cmMakefile. This will give other commands access to the configuration code. 2004-03-03 18:18:47 -05:00
Andy Cedilnik 09421a261c ENH: Preserve permissions when copying files 2004-01-26 15:50:38 -05:00
Brad King 38482b46d1 ENH: Merged use of the kwsys RegularExpression class instead of cmRegularExpression. 2003-06-23 14:10:12 -04:00
Andy Cedilnik a9875aa62f Implement GetLineFromStream that actually works and use it instead of getline 2003-03-27 12:24:30 -05:00
Bill Hoffman ae5a80c795 spelling errors 2003-02-14 09:54:15 -05:00
Brad King 1f6a3c67b1 ENH: Added reference to Copyright.txt. Removed old reference to ITK copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs. 2002-10-23 18:03:27 -04:00
Bill Hoffman 4651dbcfc6 ENH: expand variables in arguments before the commands get them 2002-03-05 18:41:24 -05:00
Will Schroeder a6a43d5320 ENH:Updated copyright 2002-01-21 15:30:43 -05:00
Bill Hoffman ce89556706 BUG: make sure non cmakedef lines are not skipped 2002-01-16 15:00:01 -05:00
Bill Hoffman eede7afb7e ENH: do not undef cmakedefine stuff, just comment out the line 2002-01-16 12:45:33 -05:00
Andy Cedilnik 1793b70c56 Add space to output 2002-01-10 16:22:14 -05:00
Bill Hoffman 091e95f26d ENH: add an option to configure file command that allows for only expansion of at variables and not dollar variables 2001-10-30 14:05:07 -05:00
Bill Hoffman 1c5c899fd7 add dependency for configure files and use short path in WIN32 cmake test 2001-10-26 15:42:02 -04:00
Bill Hoffman baa28efd10 ENH: change InitialPass to take a const reference to the argument string, to avoid changes to the file cache 2001-09-20 15:08:30 -04:00
Brad King 9cce835900 ENH: Added 'IMMEDIATE' option to CONFIGURE_FILE command to force file copy and configuration on the initial pass so that current variable values are used. 2001-08-03 15:47:19 -04:00
Berk Geveci 238fe481f3 Wrong place for fout 2001-07-02 14:02:55 -04:00
Ken Martin 901d2626ce better configure file command 2001-06-29 16:46:28 -04:00
Ken Martin 8609fdb051 added escape quotes option 2001-06-22 11:15:18 -04:00
Bill Hoffman 9922155423 ENH: rename Invoke to InitialPass 2001-06-06 13:19:15 -04:00
Bill Hoffman df5059949d BUG: fix use beyond end of array 2001-05-09 09:52:21 -04:00
Bill Hoffman 885e37da22 ENH: call configure from cmake 2001-05-07 18:11:16 -04:00