Commit Graph

4185 Commits

Author SHA1 Message Date
Brad King 4f17baccad Merge topic 'file-glob-sort'
edcccde7 file: Sort GLOB results to make it deterministic (#14491)
2016-05-18 09:30:59 -04:00
Geoff Viola d7233a0472 GHS: Use shorter object file names on collision 2016-05-18 09:27:19 -04:00
Reiner Herrmann edcccde7d6 file: Sort GLOB results to make it deterministic (#14491)
Even though the `file(GLOB)` documentation specifically warns against
using it to collect a list of source files, projects often do it anyway.
Since it uses `readdir()`, the list of files will be unsorted.
This list is often passed directly to add_executable / add_library.
Linking binaries with an unsorted list will make it unreproducible,
which means that the produced binary will differ depending on the
unpredictable `readdir()` order.

To solve those reproducibility issues in a lot of programs (which don't
explicitly `list(SORT)` the list manually), sort the resulting list of
the `file(GLOB)` command.

A more detailed rationale about reproducible builds is available
[here](https://reproducible-builds.org/).
2016-05-17 10:12:11 -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 856804f9a9 Merge topic 'findpkgconfig-target'
df97b979 FindPkgConfig: optionally create imported target for the found libraries
2016-05-16 10:11:38 -04:00
Brad King d3db070e9e Merge topic 'cpack-rpm-adding-dist-to-release-tag'
f5089cfc CPack/RPM adding dist to release tag test
f7003a60 CPack/RPM release dist tag support
2016-05-16 10:11:35 -04:00
Brad King bc7598fde0 Merge topic 'cpack-rpm-different-package-names'
44ee2d71 CPack/RPM different package names
2016-05-16 10:11:32 -04:00
Brad King 2b25174da6 Merge topic 'cpack-deb-improvements'
4461e8bb CPack/Deb cpack-deb-improvements release notes
7e940bf7 CPack/Deb test changes due to breaking changes
3b648894 CPack/Deb package release number in file name
316dd613 CPack/Deb proper package file naming
271e03f0 CPack/Deb per-component package architecture
23baaf8d CPack/Deb inter package dependencies
3a55a0e7 CPack/Deb proper component packages file naming
c7f388e7 CPack/Deb generation of postinst and postrm ldconfig files
2d589653 CPack/Deb generation of DEBIAN/shlibs control file
2016-05-16 10:11:30 -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
Domen Vrankar f5089cfccd CPack/RPM adding dist to release tag test
Tests and release notes
2016-05-14 20:21:32 +02:00
Rolf Eike Beer df97b9793f FindPkgConfig: optionally create imported target for the found libraries 2016-05-14 09:31:41 +02:00
Domen Vrankar 7e940bf74a CPack/Deb test changes due to breaking changes
New CPack/Deb tests and changes to old tests
as package file names and inter component dependency
detection was changed.
2016-05-13 10:46:05 -04:00
Brad King 6b0b066074 InstallRequiredSystemLibraries: Optionally install Windows UCRT (#16073) 2016-05-12 11:10:23 -04:00
Brad King 062593273f Tests: Wrap long comment lines in VSXaml test
Manually wrap the lines and remove literal tab characters.  This avoids
problems with incremental formatting by clang-format.
2016-05-11 15:16:04 -04:00
Brad King 18df6a9a78 Tests: Protect unicode literals from clang-format Cpp03 formatting
Since CMake is written in C++98 any clang-format configuration must
set `Standard` to `Cpp03` so that `A<A<int> >` is not rewritten as
`A<A<int>>`.  However, this will cause `U"foo"` to be rewritten as
`U "foo"`.  Add markup to turn clang-format off in the one place
that the latter case occurs so that we do not need a separate
`.clang-format` config file for it.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-05-11 10:37:45 -04:00
Brad King b30b32a493 Drop find_(library|file|path) prefixes from PATH on non-Windows
Since commit v3.3.0-rc1~430^2 (Teach find_(library|file|path) to get
prefixes from PATH, 2015-02-18) we search in <prefix>/include and
<prefix>/lib directories for prefixes with bin directories in the PATH
environment variable.  The motivation was to support MSYS, MinGW and
similar Windows platforms in their default environments automatically.
At the time this behavior was thought to be worthwhile in general.

Suggested-by: Chuck Atkins <chuck.atkins@kitware.com>
2016-05-09 12:58:08 -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 d95fbdb709 Merge topic 'custom-command-CROSSCOMPILING_EMULATOR'
8c2cedc6 CustomCommandGenerator: Add support for CROSSCOMPILING_EMULATOR
2016-05-09 09:01:10 -04:00
Jean-Christophe Fillion-Robin 8c2cedc624 CustomCommandGenerator: Add support for CROSSCOMPILING_EMULATOR
Teach the `add_custom_command` and `add_custom_target' commands to
substitute argv0 with the crosscompiling emulator if it is a target with
the `CROSSCOMPILING_EMULATOR` property set.
2016-05-09 08:56:27 -04:00
Brad King afca373510 Help clang-format wrap after braces on long initializer lists
Add a long comment inside a few braced initializer lists in order to
convince clang-format to break after the opening brace and format the
list without indenting every value past the opening brace.
2016-05-06 15:54:32 -04:00
Jean-Christophe Fillion-Robin eccfc0d185 Tests: Improve source file name in RunCMake.CrosscompilingEmulator
The test executable returns with an error, so indicate this in the
source name.
2016-05-03 10:42:21 -04:00
Jean-Christophe Fillion-Robin 8de778118b Tests: Cover genex behavior in CROSSCOMPILING_EMULATOR test case
A `$<TARGET_FILE:tgt>` generator expression does not cause insertion of
the emulator.  Add a test covering this.  While at it, extend the test
case to cover executables in a subdirectory.  Also make the test
matching expressions more robust to support multiple add_test calls
without mixing them while matching.
2016-05-03 10:41:52 -04:00
Brad King 3fc49c50b0 Merge topic 'doc-cmake-policies-manual-improvements'
5f948d2a Help: Add policy summaries to cmake-policies(7)
b74d73e5 Help: Organize cmake-policies(7) manual by version of introduction
de370656 cmRST: Parse toctree lines with Sphinx cross-reference syntax
845cb217 CMP0059: Fix typo in policy description
2016-05-03 10:17:00 -04:00
Brad King a0d31f3bb3 Merge topic 'clang-format-include-order'
54f71cd7 Source: Sort includes the way clang-format would
7b6ffa59 Source: Sort includes of sys/types.h as clang-format would
be14fe48 Source: Stabilize include order of sys/types.h before sys/stat.h
5e871f70 Tests: Sort includes of sys/types.h as clang-format would
a20d7d48 Tests: Fix Plugin test include order
2016-05-03 10:16:55 -04:00
Brad King 5e871f7089 Tests: Sort includes of sys/types.h as clang-format would 2016-05-03 10:08:41 -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 845cb217a7 CMP0059: Fix typo in policy description 2016-05-02 15:16:07 -04:00
Brad King 24b2a36778 Merge topic 'test-watcom-workaround'
47c29885 Tests: Fix RunCMake.BuildDepends filesystem delay for Watcom WMake
26790ad9 Tests: Add workaround to Wrapping test for Watcom failure
2016-05-02 09:24:23 -04:00
Brad King 067b21b675 Merge topic 'clang-format-include-order'
e1c77472 Format include directive blocks and ordering with clang-format
180538c7 Source: Stabilize include order
0e7bca92 Utilities/Release: Stabilize include order in WiX custom action
eb817be0 Tests: Stabilize include order in MFC, VSXaml, and VSWinStorePhone
eda313b4 Tests: Stabilize include order in StringFileTest
7110b754 CursesDialog: add missing cmState include
d7a5f255 Modules: Remove unused CMakeTestWatcomVersion.c file
2016-05-02 09:24:21 -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
Brad King 47c298851b Tests: Fix RunCMake.BuildDepends filesystem delay for Watcom WMake
Our 1.125s delay does not seem to be long enough to be reliable with
the Watcom `wmake` tool.  Use a longer delay for Watcom.
2016-04-29 11:47:35 -04:00
Brad King eb817be034 Tests: Stabilize include order in MFC, VSXaml, and VSWinStorePhone
These tests use a precompiled header that must be included first.
Include the header in an isolated block so that tools that sort
includes do not move it.
2016-04-29 10:56:59 -04:00
Daniel Pfeifer eda313b485 Tests: Stabilize include order in StringFileTest
This test generates a header file which is not self-contained.
Include it in a separate block of includes so that tools that
sort includes do not move it.
2016-04-29 10:56:58 -04:00
Brad King 26790ad93b Tests: Add workaround to Wrapping test for Watcom failure
The Watcom tools do not seem to like our wrapFLTK executable
to mix C and C++ sources.  Work around this by using C++ for
both sources.
2016-04-28 10:20:40 -04:00
Brad King ce82e0a53f Deprecate Visual Studio 7 .NET 2003 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2016-04-28 10:09:20 -04:00
Brad King 6a501b6519 Tests: Drop test for VS 7.0 generator deprecation warnings
We removed this generator but forgot to remove this now-unused test
case.
2016-04-28 10:04:09 -04:00
Brad King 5b4f771fd7 Merge topic 'intel-compiler-features'
21b1fa5c Help: Add notes for topic 'intel-compiler-features'
9addce99 Features: Record standard flags for Intel C/C++ on Windows
15a6c950 WCDH: Add Intel to list of supported compilers
36f32ede Features: Record standards and features for Intel C on UNIX
d028b948 Features: Specify minimum version Intel C++ 12.1
be910f00 Features: Record standards and features for Intel C++ on UNIX
7f401ae4 Features: Detect C default dialect on MSVC-like compilers
2016-04-28 09:26:09 -04:00
Brad King 954c06803d Merge topic 'ExternalProject-git-clone-shallow'
7db9f3f2 ExternalProject: Add option to perform a shallow Git clone (#15291)
2016-04-28 09:26:07 -04:00
Robert Maynard 15a6c9502d WCDH: Add Intel to list of supported compilers 2016-04-28 09:16:36 -04:00
Robert Maynard 36f32ede8d Features: Record standards and features for Intel C on UNIX
Record features for Intel C 12.1 and above.  Skip this for now on
Windows (where Intel C simulates MSVC).
2016-04-28 09:16:35 -04:00
Levi Morrison be910f00b5 Features: Record standards and features for Intel C++ on UNIX
Skip this for now on Windows (where Intel C++ simulates MSVC).
2016-04-28 09:15:25 -04:00
Brad King 7db9f3f294 ExternalProject: Add option to perform a shallow Git clone (#15291)
Inspired-by: Ilya Kulakov <kulakov.ilya@gmail.com>
2016-04-27 10:58:07 -04:00
Geoff Viola 1703a6d2c4 GHS: Fix handling of duplicate source filenames (#16046)
Green Hills MULTI project files must specify explicitly distinct object
file names for source files with the same name.
2016-04-25 10:46:09 -04:00
Brad King 76e793b9ad Merge topic 'autogen-updates'
84946c73 Tests: QtAutogen: Same source name in different directories test
9c6fa684 Autogen: Generate qrc_NAME.cpp files in subdirectories
488ea8c7 Autogen: Generate not included moc files in subdirectories (#12873)
66caae45 Autogen: Check added for name collisions of generated qrc_NAME.cpp files
663d093d Autogen: Check added for name collisions of generated ui_NAME.h files
8295d437 Autogen: Check added for name collisions of generated moc files
d350308a Help: Improve AUTOMOC documentation layout
2016-04-22 09:02:03 -04:00
Sebastian Holtermann 84946c735c Tests: QtAutogen: Same source name in different directories test
The test features multiple .cpp and .qrc files with the same name
in different subdirectories. This requires AUTOMOC and AUTORCC to
generate files with names that respect the path information of
the source files.
2016-04-22 08:55:44 -04:00
Roger Leigh 2c1b720e64 FindBoost: Define Boost::boost for all boost versions 2016-04-19 22:07:45 +01:00
Brad King 7c36d2067b cmListFileBacktrace: Refactor storage to provide efficient value semantics
Since commit v3.4.0-rc1~321^2~2 (Genex: Store a backtrace, not a pointer
to one, 2015-07-08) we treat cmListFileBacktrace instances as
lightweight values.  This was true at the time only because the
backtrace information was kept in the cmState snapshot hierarchy.
However, that forced us to accumulate a lot of otherwise short-lived
snapshots just to have the backtrace fields available for reference by
cmListFileBacktrace instances.  Recent refactoring made backtrace
instances independent of the snapshot hierarchy to avoid accumulating
short-lived snapshots.  This came at the cost of making backtrace values
heavy again, leading to lots of string coying and slower execution.

Fix this by refactoring cmListFileBacktrace to provide value semantics
with efficient shared storage underneath.  Teach cmMakefile to maintain
its call stack using an instance of cmListFileBacktrace.  This approach
allows the current backtrace to be efficiently saved whenever it is
needed.

Also teach cmListFileBacktrace the notion of a file-level scope.  This
is useful for messages about the whole file (e.g. during parsing) that
are not specific to any line within it.  Push the CMakeLists.txt scope
for each directory and never pop it.  This ensures that we always have
some context information and simplifies cmMakefile::IssueMessage.
Push/pop a file-level scope as each included file is processed.  This
supersedes cmParseFileScope and improves diagnostic message context
information in a few places.  Fix the corresponding test cases to expect
the improved output.
2016-04-18 09:21:19 -04:00
Brad King eae4cee0b5 Merge topic 'try_compile-config-flags'
bd581a37 try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes (#16054)
82ef90fc cmCoreTryCompile: Factor out config lookup for re-use
2016-04-13 09:58:18 -04:00
Daniel Pfeifer 5e62444cff Add options to run clang-tidy with the compiler
Create a <LANG>_CLANG_TIDY target property (initialized by a
CMAKE_<LANG>_CLANG_TIDY variable) to specify a clang-tidy command line
to be run along with the compiler.
2016-04-13 09:56:10 -04:00
Brad King bd581a3733 try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes (#16054)
In the `try_compile` source file signature we propagate the caller's
value of `CMAKE_<LANG>_FLAGS` into the test project.  Extend this to
propagate `CMAKE_<LANG>_FLAGS_<CONFIG>` too instead of always using the
default value in the test project.  This will be useful, for example, to
allow the MSVC runtime library to be changed (e.g. `-MDd` => `-MTd`).
2016-04-11 11:25:08 -04:00