Commit Graph

26 Commits

Author SHA1 Message Date
Daniel Pfeifer 7a649111cd Use string(APPEND) in Tests
Automate with:

find Tests -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2016-07-28 00:43:04 +02:00
Brad King ceebac93f6 Tests: Restore fix to Plugin test on Watcom compiler
The fix in commit v3.4.0-rc1~127^2 (Tests: Fix Plugin test on Watcom
compiler, 2015-09-03) was reverted accidentally by automated .c_str()
removal.  Restore it and add a comment explaining why.
2016-06-09 09:11:10 -04:00
Daniel Pfeifer fa277b29e4 Remove c_str() calls from stream arguments.
Mostly automated:

git grep -l '.c_str() <<' | xargs sed -i 's|\.c_str() <<| <<|g'
2016-06-06 23:53:32 +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
Brad King a20d7d4821 Tests: Fix Plugin test include order
Fix the order accidentally broken by commit e1c77472 (Format include
directive blocks and ordering with clang-format, 2016-04-29).  Include
the KWSys header first in its own block so that it is not moved by tools
that re-order includes.  It must be included first to define large file
support macros consistently.
2016-05-03 10:08:41 -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
Mariusz Pluciński 3541af67b7 Tests: fix Plugin building on Clang/C2 2016-03-10 09:11:41 -05:00
Brad King d2b8229d02 Tests: Fix Plugin test on Watcom compiler
The Watcom compiler does not have stream operators for std::string.
Since KWSys no longer provides the operators for us, just use c_str()
to avoid the problem and allow the test to compile on Watcom.
2015-09-03 09:34:47 -04:00
Brad King e1c58e0bfa Merge topic 'modules-no-soname'
21d99aa3 Tests: Use a less strict regular expression to look for "SONAME"
2015-09-02 09:58:28 -04:00
Raphael Kubo da Costa 21d99aa345 Tests: Use a less strict regular expression to look for "SONAME"
Commit 899458ab (Tests: Cover NO_SONAME property for SHARED libraries,
2015-08-20) introduced a few new ExportImport tests, and the
check_lib_{no}soname.cmake scripts that parse readelf(1)'s output.

Make the regular expression matching the SONAME line output by readelf
less strict, as the output format varies across implementations: GNU
binutils' readelf is the only one to write each ELF header within
parentheses (which the previous regular expression expected).  The new
tests were thus failing when either Fedora's elfutils (eu-readelf) or
elftoolchain's readelf (present on recent FreeBSD versions) were being
used, as they both list the headers without parentheses.

The same issue also affected Tests/Plugin's check_mod_soname.cmake, so
fix that one as well -- the only reason the test was not failing is that
it tested that the regular expression did not match, which was always
the case with a non-binutils readelf.
2015-09-01 10:30:09 -04:00
Brad King 76fa859699 Tests: Remove use of include <kwsys/{ios,stl}> and kwsys_{ios,stl}::
We no longer need this compatibility layer for the compilers we support.
2015-08-31 09:50:12 -04:00
Felix Geyer f799ffb5cb Do not set SONAME for MODULE library targets (#15705)
The SONAME field is only useful for shared libraries that application
link against.
2015-08-20 10:45:09 -04:00
Rolf Eike Beer b0f277db38 HP aCC: record compiler flag for Ansi C++98 support for version 3.80 onwards
Old versions of aCC need a special compiler flag to get full C++98 template
support as e.g. CMake itself or the Complex and ComplexOneConfig tests need.
The same versions need a special flag to get a proper C++ library, too.
2014-04-25 17:59:57 +02:00
Stephen Kelly 30ff6cf9e9 Refactor the Plugin test.
Policy CMP0024 was introduced to disallow the include() of a file
generated by export().

Use ExternalProject to test the plugins after building.
2013-10-24 19:03:49 +02:00
Kitware Robot 77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -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
Brad King fdb3f878fe Test NO_SONAME property (#13155)
Teach the Plugin test to check that the NO_SONAME target property works
as documented.  Check that the IMPORTED targets are written with the
correct properties.  When readelf is available use it to check the
actual binary files for SONAME fields.
2012-04-30 11:53:27 -04:00
Brad King d1aa17a7b0 ENH: Remove CMAKE_ANSI_CFLAGS from tests
As of CMake 2.6 this variable is not defined, and the ANSI flags for the
HP compiler are simply hard-coded in the default C flags.
2009-07-08 11:41:48 -04:00
Brad King f4b3bdc6be BUG: Create an exe's implib output dir for VS
If an executable marks symbols with __declspec(dllexport) then VS
creates an import library for it.  However, it forgets to create the
directory that will contain the import library if it is different from
the location of the executable.  We work around this VS bug by creating
a pre-build event on the executable target to make the directory.
2009-06-15 10:55:21 -04:00
Ken Martin ce8810c4e7 ENH: preclean some warnings 2008-03-25 11:27:18 -04:00
Bill Hoffman 226993c970 ENH: fix memory leak 2007-09-10 17:10:40 -04:00
Brad King 03dfb39bd0 ENH: Added function call argument to module function to make sure calling convention matches on lookup. Fixed for Watcom. 2007-04-19 11:32:43 -04:00
Brad King b3a05f57dd COMP: Need to enable ansi C features. 2007-04-17 23:27:30 -04:00
Brad King fc9ceda5e7 ENH: Fixed Plugin test on Cygwin. 2007-04-17 18:18:42 -04:00
Brad King c1a6e4dcc6 ENH: Configure location of plugin files so that the executable can run with any current working directory. 2007-04-17 13:52:50 -04:00
Brad King aabcf981e2 ENH: Added test for executables with plugins that use an API exported by the executable itself. 2007-04-17 13:43:03 -04:00