9584 Commits

Author SHA1 Message Date
Brad King
f22a2a1fa5 Merge topic 'CheckCXXSymbolExists-c++-syntax'
72fcadb007 CheckCXXSymbolExists: Make C++-syntax symbols work on more compilers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3545
2019-07-29 11:50:42 -04:00
Hong Xu
72fcadb007 CheckCXXSymbolExists: Make C++-syntax symbols work on more compilers
On some compilers the syntax `#ifndef std::fopen` will always lead to
compilation error.  Avoid generating it in the check.
2019-07-26 15:09:28 -04:00
Brad King
97bca2f9fa Android: Use unified toolchain in NDK r19+
The NDK build system now uses only a single toolchain in

    <ndk>/toolchains/llvm/prebuilt/<host>

Its compilers are always `bin/{clang,clang++}` and its binutils are
always `bin/<triple>-*`.  It is a standalone toolchain:

* The Anrdoid API level is specified at the end of `--target=`.
* The standard library may be specified via `-stdlib=`.
* No need to pass system includes or libraries explicitly.
* No need to pass `--sysroot` or `-gcc-toolchain`.

Teach CMake to recognize NDK versions that have a unified
toolchain with its own sysroot and use the above approach.

Fixes: #18739
2019-07-26 14:17:07 -04:00
Brad King
f3e32ddae9 Android: Re-order system initialization to select sysroot last 2019-07-26 14:17:07 -04:00
Brad King
9a0720b819 Android: Clarify name of internal variable for arch triple
The triple applies to more than just header locations.
2019-07-26 14:17:07 -04:00
Brad King
4e6c58d937 Android: Select NDK host tag while determining system
The host tag is tied to the host platform and does not depend on any
specific language or compiler.
2019-07-26 14:17:07 -04:00
Kyle Edwards
8fd481a899 Merge topic 'ep_support_no_submodule_init'
d6be117ca0 ExternalProject: Support not initializing any submodules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3579
2019-07-26 12:02:34 -04:00
Brad King
f54c9f6cc3 Merge topic 'FindMPI-link-flags'
cf04da7e70 FindMPI: make sure computed link flags are not de-duplicated

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: Ben Boeckel <ben.boeckel@kitware.com>
Tested-by: Robert Maynard <robert.maynard@kitware.com>
Acked-by: Axel Huebl <axel.huebl@plasma.ninja>
Merge-request: !3605
2019-07-26 07:12:08 -04:00
Robert Maynard
cf04da7e70 FindMPI: make sure computed link flags are not de-duplicated
In commit f7eaa342de (FindMPI: Store imported target link flags as a
list instead of a string, 2019-06-14, v3.15.0-rc2~2^2) we used
`separate_arguments` to parse the extracted link flags and add them to
`INTERFACE_LINK_LIBRARIES`.  That property is not meant for link flags
and CMake may de-duplicate them.  This is particularly problematic for
flags like `-Wl,-rpath -Wl,/path1 -Wl,-rpath -Wl,/path2`.

In commit 39c572c9c9 (FindMPI: Updated to use INTERFACE_LINK_OPTIONS,
2019-06-24) we moved the parsed flags over to `INTERFACE_LINK_OPTIONS`,
but that may still perform de-duplication.  Avoid the parsing and
de-duplication of flags by passing the original string via `SHELL:`
instead.

Fixes: #19516
2019-07-25 12:59:21 -04:00
Robert Maynard
d6be117ca0 ExternalProject: Support not initializing any submodules
Fixes #15592
2019-07-24 09:36:30 -04:00
Brad King
5cfc39127e Merge branch 'backport-clang-gnulike-support' into clang-gnulike-support 2019-07-24 08:00:53 -04:00
Brad King
d50b31be35 Clang: For MSVC ABI do not use modes older than C++14
Since commit d44c0db0b2 (clang: setup correct configuration in gnu mode,
2019-02-20, v3.15.0-rc1~41^2~5) we support the GNU-like Clang that
targets the MSVC ABI.  However, Clang cannot compile with the MSVC
standard library unless it runs in a mode aware of C++14 (since MSVC
itself does not even have a lower mode).  When `CMAKE_CXX_STANDARD` is
set to 98 or 11, use C++14 anyway.

Since Clang's default mode is aware of C++14, another option is to not
add any flags for 98 or 11.  However, if a future Clang version ever
defaults to a higher C++ standard, setting the standard to 98 or 11
should at least not use a mode higher than 14.

Also revert test updates from commit 4819ff9647 (Tests: fix failures
with gnu mode clang on windows, 2019-03-21, v3.15.0-rc1~41^2~3) that
were meant to work around the standard selection problem.

Fixes: #19496
2019-07-24 07:40:30 -04:00
Brad King
452419efb9 Merge topic 'InstallRequiredSystemLibraries-redist'
13c3ec545b IRSL: Fix discovery of VS 2019 v141 toolset redistributables
0484165da0 IRSL: Fix typo in v143 toolset version check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3585
2019-07-23 07:38:12 -04:00
James Butler
13c3ec545b IRSL: Fix discovery of VS 2019 v141 toolset redistributables
Since VS 2019, the v141 toolset redistributables can be found in
either the VS 2019 or VS 2017 install directory. Update the logic
to search multiple versions of VS.

Fixes: #19488
2019-07-22 10:06:45 -04:00
James Butler
0484165da0 IRSL: Fix typo in v143 toolset version check
Fix the toolset v143 check from commit 33ee779330 (IRSL: Fix discovery
of VS 2019 v142 toolset redistributables, 2019-04-03, v3.14.2~6^2) to
check the correct variable.
2019-07-22 10:06:44 -04:00
Craig Scott
9e42075498 Merge topic 'cpack-install-scripts'
5f96601675 CPack: Introduce CPACK_INSTALL_SCRIPTS variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3531
2019-07-22 07:04:00 -04:00
Alex Turbov
5f96601675
CPack: Introduce CPACK_INSTALL_SCRIPTS variable
The singular name `CPACK_INSTALL_SCRIPT` has existed but was not linked
from the CPack documentation.  Also, it supported multiple values and
should have had a plural name.  Add a plural-named alternative now.
If both `CPACK_INSTALL_SCRIPTS` and `CPACK_INSTALL_SCRIPT` are set then
ignore the latter with a warning.

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-22 02:01:44 +03:00
Brad King
123384da2e Merge topic 'swift-deduplicate'
151ef7cef4 Swift: refactor rule construction to reduce duplication

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3551
2019-07-19 12:08:08 -04:00
Brad King
a6cc72595f Merge topic 'FindProtobuf-DLLs'
3bbd85d5ff FindProtobuf: Fix usage of protobuf dynamic libraries on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3555
2019-07-19 12:05:31 -04:00
NeroBurner
6cc4ca31d5 Fix repeated word in FindVulkan.cmake 2019-07-18 17:25:04 -04:00
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
ae84427e32 Merge topic 'FindPython-interpreter-crosscompiling'
696d0f9caf FindPython: ensure interpreter is founded when cross-compiling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3564
2019-07-18 07:15:48 -04:00
Marc Chevrier
696d0f9caf FindPython: ensure interpreter is founded when cross-compiling
Fixes: #19473
2019-07-18 07:13:20 -04:00
Brad King
3fb3157dae AIX: Do not enable runtime linking by default anymore
We've long created shared objects on AIX using the linker's `-G` option
(also offered by the XL front-end).  The `-G` option implies `-brtl` and
enables runtime linking.  This has been largely unnecessary because we
provide all dependencies on the link line and both XL and GNU compilers
offer builtin behavior to export symbols.  Since commit 0f150b69d3 (AIX:
Explicitly compute shared object exports for both XL and GNU,
2019-07-11) we compute exports explicitly and consistently.
Therefore runtime linking is no longer necessary for shared objects.

We've also long created executables on AIX using the linker's `-brtl`
option to enable runtime linking in case they load plugins at runtime.
Since commit 9f5c2040bf (AIX: Explicitly compute executable exports for
both XL and GNU, 2019-07-12) and commit 2fa920c0cd (AIX: Create import
library for executables with exports, 2019-07-16) we now provide the
linker enough information to fully resolve symbols in plugins up front.
Therefore runtime linking is no longer necessary for executables.

Drop use of `-G` for creating shared objects and use the XL `-qmkshrobj`
and GCC `-shared` options instead.  Both invoke the linker with the
`-bM:SRE -bnoentry` options to create a shared object without runtime
linking enabled.  Also drop use of `-brtl` for creating executables.

Issue: #19163
2019-07-17 14:21:37 -04:00
Saleem Abdulrasool
151ef7cef4 Swift: refactor rule construction to reduce duplication
Use the placeholder expansion to avoid constructing the `-target` option
by hand if specified.  This reduces duplication and simplifies the
rules.
2019-07-17 10:26:46 -07:00
Brad King
2fa920c0cd AIX: Create import library for executables with exports
On AIX, plugins meant to be loaded into executables via `dlopen` must be
linked with access to a list of symbols exported from the executable in
order to use them (when not using runtime linking).  The AIX linker
supports specifying this list as an "import file" passed on the command
line either via the `-bI:...` option or (with a leading `#! .` line) as
a normal input file like any other library file.

The linker import file plays the same role on AIX as import libraries do
on Windows.  Teach CMake to enable its import library abstraction on AIX
for executables with the `ENABLE_EXPORTS` target property set.  Teach
our internal `ExportImportList` script to optionally generate a leading
`#! .` line at the top of the generated export/import list.  Update our
rule for linking an executable with exports to generate a public-facing
"import library" implemented as an AIX linker import file.

With this approach, our existing infrastructure for handling import
libraries on Windows will now work for AIX linker import files too:

* Plugins that link to their executable's symbols will be automatically
  linked using the import file on the command line.

* The executable's import file will be (optionally) installed and
  exported for use in linking externally-built plugins.

This will allow executables and their plugins to build even if we later
turn off runtime linking.

Issue: #19163
2019-07-16 14:15:13 -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
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
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
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
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
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
Brad King
7242d81269 Merge branch 'FindBISON-CMP0088-SourcePath' into release-3.15
Merge-request: !3549
2019-07-12 16:21:26 -04:00
Brian Carlson
f84d2045e9 FindBISON: Fix CMP0088 NEW behavior for non-absolute input paths
Now that the working directory is in the build tree, relative input
paths must be converted to an absolute path to remain relative to the
source directory.

Fixes: #19472
2019-07-12 16:20:08 -04:00
Saleem Abdulrasool
6af97178ef Swift: support SONAME on ELFish targets
We should enable the soname to be setup for ELF shared libraries.
Failure to do so generates binaries with incorrect names which prevents
loading.
2019-07-11 11:12:26 -07:00
Brad King
14f69fab54 Merge branch 'fortran-submodule-cray' into release-3.15
Merge-request: !3504
2019-07-11 13:01:02 -04:00
Brad King
d1f38ba65d CMakeDetermineCompilerId: Consider UTF-16 encodings of INFO strings
Our compiler identification source encodes `INFO:compiler[...]` and
similar strings in compiled objects or binaries that we then extract to
get information about the compiler.  With most compilers the strings are
encoded in the binaries as a simple byte sequence.  However, some
compilers use other encodings.  For example, the MS CSharp compiler uses
UTF-16LE and a TI compiler uses UTF-16BE.  Try each encoding.

Fixes: #19459
2019-07-11 09:50:30 -04:00
Brad King
c30939a713 Merge topic 'CheckSymbolExists-doc'
bf2244681b CheckSymbolExists: Add examples for check_symbol_exists
cafaa5883a CheckCXXSymbolExists: Clarify documented role

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3522
2019-07-11 08:51:22 -04:00
Kyle Edwards
bb4b394fac Merge topic 'fix/move-more-cpack-internals'
98617f1be0 Refactor: Move CPack internal files to `Internal/CPack/` directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3530
2019-07-10 12:48:12 -04:00
Hong Xu
bf2244681b CheckSymbolExists: Add examples for check_symbol_exists
Add examples in `CheckCXXSymbolExists` too.

Co-Author: Brad King <brad.king@kitware.com>
2019-07-10 09:51:38 -04:00
Brad King
cafaa5883a CheckCXXSymbolExists: Clarify documented role 2019-07-10 09:51:38 -04:00
Brad King
4fc10431f0 Merge topic 'elseif'
f4ed56ab63 Fix elseif() in place of else()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Acked-by: Rolf Eike Beer <eike@sf-mail.de>
Merge-request: !3515
2019-07-10 09:26:39 -04:00
Brad King
96a35a8eed Merge topic 'implicit-includes-cray-hlist'
0a7b61269c Merge branch 'backport-implicit-includes-cray-hlist'
98e371f13e Cray: Fix include parsing when the -hlist= flag is present

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3532
2019-07-10 09:21:24 -04:00