Commit Graph

44201 Commits

Author SHA1 Message Date
gnaggnoyil 3bbd85d5ff FindProtobuf: Fix usage of protobuf dynamic libraries on Windows
Define `PROTOBUF_USE_DLLS` on Windows when linking against dynamic
protobuf libraries so that we import symbols from them.

We use the condition `MSVC` to enable this because that is what
the upstream buildsystem uses.
2019-07-18 07:40:40 -04:00
Brad King 74ad28fa6a Merge topic 'cmake-qch-no-version-in-filename'
0518e675ea CMake.qch: Don't include the version in the file name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3558
2019-07-17 07:49:12 -04:00
Craig Scott 0518e675ea CMake.qch: Don't include the version in the file name
Fixes: #19374
2019-07-17 21:35:12 +10:00
Brad King 3143e9ffc5 Merge topic 'project-version-0'
0ba5891ead project: Keep leading `0` in PROJECT_VERSION components
5f84669806 Tests: Factor out RunCMake.project helper macro into module
b1f387a7ea Refactor: Use raw string literals instead of escaping
41b85968d8 Refactor: Use initializer lists instead of `push_back` series
45e85dd2b2 Refactor: Add some `const` to vars
90f91e4d21 Refactor: Replace a "magic" number w/ a named constant
638383c38f Refactor: Eliminate one-time-used variables
9b6a53292f Refactor: Eliminate `sep` from the loop

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3517
2019-07-17 07:28:05 -04:00
Brad King 119fb8606a Merge branch 'release-3.15' 2019-07-17 07:20:47 -04:00
Brad King 3f84ff212c Merge topic 'find_package-fix-NO_MODULE'
f2edccea66 find_package: Fix NO_MODULE under CMAKE_FIND_PACKAGE_PREFER_CONFIG

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3557
2019-07-17 07:20:20 -04:00
Kitware Robot b119968048 CMake Nightly Date Stamp 2019-07-17 00:01:08 -04:00
Brad King c3d9d80015 Merge topic 'aix-explicit-exports'
c2c3d22504 Tests: Drop RunCMake workaround for AIX ld warnings about GNU atexit
9f5c2040bf AIX: Explicitly compute executable exports for both XL and GNU
0f150b69d3 AIX: Explicitly compute shared object exports for both XL and GNU
a5bf4e7921 AIX: Drop redundant -brtl flags
9cb5f040d7 XL: De-duplicate shared object creation flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3556
2019-07-16 10:30:38 -04:00
Brad King 76a540bab5 Merge topic 'doc-ENABLE_EXPORTS'
84ddeb8fa5 Help: Clarify ENABLE_EXPORTS per-platform link behavior
e29ccfcafb Help: Simplify CMAKE_ENABLE_EXPORTS documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3560
2019-07-16 10:28:54 -04:00
Brad King 84ddeb8fa5 Help: Clarify ENABLE_EXPORTS per-platform link behavior
Spell out the behavior on each platform in a bullet list.
2019-07-16 10:09:40 -04:00
Brad King e29ccfcafb Help: Simplify CMAKE_ENABLE_EXPORTS documentation
In real projects the variable form should rarely be used because the
decision to export symbols from an executable is very specific.
Remove its main description, which duplicates the `ENABLE_EXPORTS`
target property, and simply reference the property instead.
2019-07-16 10:09:06 -04:00
Brad King 185e6a1288 Merge branch 'find_package-fix-NO_MODULE' into release-3.15
Merge-request: !3557
2019-07-16 09:12:56 -04:00
Cristian Adam f2edccea66 find_package: Fix NO_MODULE under CMAKE_FIND_PACKAGE_PREFER_CONFIG
The module mode fallback added by commit 22e65d10c1 (find_package: Fixed
CMAKE_FIND_PACKAGE_PREFER_CONFIG Module fallback, 2019-06-13,
v3.15.0-rc2~6^2) should not be used unless the `find_package` call
allows module mode.  Doing so can lead to infinite recursion if a find
module tries to call config mode with `find_package(...  NO_MODULE)`.
Fix the logic and add a test case.

Fixes: #19478
2019-07-16 09:09:24 -04:00
Brad King 09b4dfb92a Merge branch 'release-3.14' 2019-07-16 08:36:40 -04:00
Alex Turbov 0ba5891ead project: Keep leading 0 in PROJECT_VERSION components
Introduce CMake policy `CMP0096` to make `project()` keep leading zeros
in version components.  As a side effect, it now allows really long
version numbers.

Fixes: #19421
Co-Author: Brad King <brad.king@kitware.com>
2019-07-16 07:48:40 -04:00
Brad King 79a21ba680 Merge topic 'FindPNG-msvc-static'
95f8b0aec7 FindPNG: Add static libpng names for MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3552
2019-07-16 07:24:14 -04:00
Brad King e0d45ddab5 Merge topic 'FindMatlab/pre-2018-fixes'
cd6bd8391a FindMatlab: code comment and ordering of the finders
9e6206c59b FindMatlab: fixing extension bat file invocation error
a9b36ea69f FindMatlab: Fixing compilation issues on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3554
2019-07-16 07:23:20 -04:00
Brad King 96541918c8 CMake 3.14.6 v3.14.6 2019-07-16 07:08:05 -04:00
Kitware Robot e653938b39 CMake Nightly Date Stamp 2019-07-16 00:01:06 -04:00
Brad King c2c3d22504 Tests: Drop RunCMake workaround for AIX ld warnings about GNU atexit
Drop the filtering added by commit e22c45d4c9 (Tests: Teach RunCMake to
ignore AIX ld warnings about GNU atexit, 2018-02-28, v3.12.0-rc1~419^2~6).
It is no longer needed now that we compute our own exports on AIX and
do not get these warnings when using shared libraries.
2019-07-15 13:27:16 -04:00
Brad King 9f5c2040bf AIX: Explicitly compute executable exports for both XL and GNU
On AIX, symbols in executables must be exported in order to be visible
to modules (plugins) they load via `dlopen`.  Prior to policy `CMP0065`,
CMake linked all executables with flags to export symbols, but the NEW
behavior for that policy is to do so only for executables that have the
`ENABLE_EXPORTS` target property set.  In both cases, CMake has always
used the AIX linker option `-bexpall` option to export symbols from
executables.

This has worked fairly well with the XL compiler, but with the GNU
compiler it works only for C ABI symbols.  The reason is that `-bexpall`
does not export symbols starting in `_` but the GNU C++ ABI mangles all
symbols with a leading `_`.  Therefore we have only supported C ABI
plugins with the GNU compiler on AIX.  Some projects have tried to work
around this by replacing `-bexpall` with `-bexpfull`, but the latter
often exports symbols that we do not want exported.

Avoid using `-bexpall` for executables by instead using by our own
internal `ExportImportList` script to compute symbol export lists from
the object files to be linked into an executable.  Pass the explicitly
computed export list to the AIX linker's `-bE:...` option.  We already
do this for shared object exports.

Issue: #19163
2019-07-15 13:27:16 -04:00
Brad King 0f150b69d3 AIX: Explicitly compute shared object exports for both XL and GNU
On AIX, symbols in shared objects must be exported in order to be
visible to dependents (similar to Windows).  The AIX linker provides a
`-bE:...` option to specify a file listing symbols to be exported.
Compilers offer some features to help:

* When the XL compiler is invoked with its `-qmkshrobj`/`-G` options for
  creating shared objects (without/with runtime linking), it recognizes
  when no explicit `-bE:...` linker option is specified and runs a
  `CreateExportList` tool provided with the compiler to compute one from
  the object files.  Since commit d468a2c2cb (XL: Avoid copying archives
  into shared libraries that link them, 2011-04-07, v2.8.5~153^2) CMake
  runs `CreateExportList` explicitly to ensure it only looks at the object
  files and not any library files.

* When the GNU compiler is invoked with its `-shared` option for creating
  shared objects, its internal `collect2` tool recognizes when no explicit
  `-bE:...` linker option is specified and computes one itself from the
  object files.  However, it sometimes includes extra symbols such as
  `.__init_aix_libgcc_cxa_atexit`.

Introduce our own internal `ExportImportList` script to compute symbol
export lists from object files.  Use a basic implementation for now: it
can be extended as needed later.  Update our shared library creation
rules to run the script explicitly for both the XL and GNU compilers.

Issue: #19163
2019-07-15 13:27:16 -04:00
Brad King a5bf4e7921 AIX: Drop redundant -brtl flags
We removed `-brtl` in commit bce7a2a3a5 (AIX: Do not use -brtl to create
shared libraries, 2013-03-11, v2.8.11~103^2~1) but it was added again by
commit f254276fc1 (AIX,HP-UX: Fix RPATH handling when CMP0065 is set to
NEW, 2015-12-11, v3.4.2~4^2).  Since the latter commit we initialize the
`CMAKE_{SHARED,MODULE}_LINKER_FLAGS` to use the `-brtl` linker flag.
This is unnecessary because we already use the `-G` linker flag which
implies `-brtl`.

The latter commit also moved `-brtl` to `CMAKE_EXE_LINKER_FLAGS` from
flags that were always included in executable link lines with CMP0065
OLD behavior and are not part of the change intended by CMP0065.  Leave
this for now as we've always enabled runtime linking for executables
(and implicitly done so via -G for shared libraries and modules).

Issue: #13997
Issue: #19163
2019-07-15 13:26:56 -04:00
Brad King 5f84669806 Tests: Factor out RunCMake.project helper macro into module 2019-07-15 08:17:36 -04:00
Alex Turbov b1f387a7ea Refactor: Use raw string literals instead of escaping 2019-07-15 08:17:36 -04:00
Alex Turbov 41b85968d8 Refactor: Use initializer lists instead of push_back series 2019-07-15 08:17:36 -04:00
Alex Turbov 45e85dd2b2 Refactor: Add some const to vars 2019-07-15 08:17:36 -04:00
Alex Turbov 90f91e4d21 Refactor: Replace a "magic" number w/ a named constant 2019-07-15 08:17:36 -04:00
Alex Turbov 638383c38f Refactor: Eliminate one-time-used variables 2019-07-15 08:17:36 -04:00
Alex Turbov 9b6a53292f Refactor: Eliminate sep from the loop 2019-07-15 08:17:34 -04:00
Steve Robinson 95f8b0aec7 FindPNG: Add static libpng names for MSVC
Add names produced by the png upstream buildsystem for static
libraries with MSVC.
2019-07-15 08:08:27 -04:00
Brad King 9cb5f040d7 XL: De-duplicate shared object creation flags
The XL `-qmkshrobj` flag creates shared objects on all platforms.
Move the flag out of the per-platform modules into the per-compiler
module for XL.
2019-07-15 07:45:04 -04:00
Brad King d7e53b4274 Merge topic 'cleanup-gen-lookups'
7ff9ab3b10 Makefile: De-duplicate executable link rule lookup
79f5ef19fe De-duplicate checks for whether a platform uses Windows DLLs
22d3eb5d5e Refactor checks for whether a target has an import library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3550
2019-07-15 07:41:52 -04:00
Brad King a92b7fd46b Merge topic 'modernize-cmCommand-memory-management'
1591f138f1 modernize: manage cmCommand instances using unique_ptr.
d9b2c7dae2 Introduce memory management helper: cm_memory.hxx

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Merge-request: !3513
2019-07-15 07:40:00 -04:00
Brad King 3376067bae Merge branch 'release-3.15' 2019-07-15 07:35:17 -04:00
Brad King 5133cab192 Merge branch 'release-3.14' 2019-07-15 07:34:54 -04:00
Brad King 0964a96972 Merge topic 'FindBISON-CMP0088-SourcePath'
f84d2045e9 FindBISON: Fix CMP0088 NEW behavior for non-absolute input paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3549
2019-07-15 07:34:01 -04:00
Brad King 1b8fdad269 Merge topic 'soname'
6af97178ef Swift: support SONAME on ELFish targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3543
2019-07-15 07:27:46 -04:00
Kitware Robot 0db8b7eb45 CMake Nightly Date Stamp 2019-07-15 00:01:07 -04:00
Raffi Enficiaud cd6bd8391a FindMatlab: code comment and ordering of the finders 2019-07-15 01:52:07 +02:00
Raffi Enficiaud 9e6206c59b FindMatlab: fixing extension bat file invocation error
If the environment variable MATLAB_ARCH is set prior to the call, the
called scripts do not return an error message.
2019-07-15 01:52:02 +02:00
Raffi Enficiaud a9b36ea69f FindMatlab: Fixing compilation issues on Windows 2019-07-15 01:46:12 +02:00
Marc Chevrier 1591f138f1 modernize: manage cmCommand instances using unique_ptr. 2019-07-14 15:37:30 +02:00
Marc Chevrier d9b2c7dae2 Introduce memory management helper: cm_memory.hxx 2019-07-14 15:37:30 +02:00
Kitware Robot 81389a5e8f CMake Nightly Date Stamp 2019-07-14 00:01:07 -04:00
Kitware Robot 82a4e07f8f CMake Nightly Date Stamp 2019-07-13 00:01:10 -04:00
Craig Scott a2319c04f6 Merge topic 'cleanup-statics-stream-flush'
af75ab7645 Refactor: Use anonymous namespace instead of `static`s in `cpack.cxx`
0db458a0ce Refactor: Use anonymous namespace instead of `static`s
0328b64efd Refactor: Remove one-time used macros
b821f9ad62 Refactor: Optimize some stream output operations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3535
2019-07-12 20:26:12 -04:00
Brad King 7ff9ab3b10 Makefile: De-duplicate executable link rule lookup
Use `GetCreateRuleVariable` instead of duplicating the variable lookup.
2019-07-12 17:37:02 -04:00
Brad King 79f5ef19fe De-duplicate checks for whether a platform uses Windows DLLs 2019-07-12 17:35:49 -04:00
Brad King 22d3eb5d5e Refactor checks for whether a target has an import library
Use `HasImportLibrary` for such checks.
2019-07-12 17:29:40 -04:00