Commit Graph

997 Commits

Author SHA1 Message Date
Brad King
9502276f82 Prefix implicit include directories with sysroot on construction
Since commit 7cd65c97fa (Add CMAKE_SYSROOT variable to set --sysroot
when cross compiling., 2013-04-13, v3.0.0-rc1~342^2) we have prefixed
the value of `CMAKE_SYSROOT` to implicit include directories.  This was
done because we hard-coded `/usr/include` as an implicit include
directory without accounting for the sysroot.  Instead we should prefix
the hard-coded paths when they are constructed.  Update the
`Platform/UnixPaths` module to do this as `Platform/Darwin` already
does.

Since commit 5990ecb741 (Compute implicit include directories from
compiler output, 2018-12-07, v3.14.0-rc1~108^2) the values of the
`CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` variables are computed from
a real compiler invocation so they already account for the sysroot
prefix.  In commit 6fc3382944 (Update logic for sysroot in detected
implicit include directories, 2019-02-13, v3.14.0-rc2~6^2) we attempted
to apply the prefix conditionally, but that is incorrect because the
compiler's real implicit include directories are not all under the
sysroot.  Instead assume that all implicit include directories in
`CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` already have the sysroot
prefix if needed.  Code that constructs the value must be responsible
for that because it is the only place that knows.
2019-02-18 17:09:26 -05:00
Brad King
557b2d6e65 Fix regression in -I/usr/include exclusion logic
The change in commit 15ad830062 (Refactor exclusion of -I/usr/include to
avoid per-language values, 2019-01-21, v3.14.0-rc1~108^2~4) caused the
exclusion to apply to Fortran, but it was only meant for C, CXX, and
CUDA.  The purpose of the change was to prepare for the value of
`CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` to be computed from the
actual compiler instead of hard-coded.  We need to preserve exclusion of
`-I/usr/include` if the compiler has any implicit include directory that
looks intended to replace it, e.g. `<sdk>/usr/include` on macOS.

Fixes: #18914
2019-02-13 09:52:20 -05:00
Brad King
017598a444 macOS: Fix addition of <sdk>/usr/include to default implicit include dirs
In commit 1293ed8507 (ParseImplicitIncludeInfo: keep implicit incl.
consistent when rerunning cmake, 2019-01-30, v3.14.0-rc1~26^2) the
`Platform/UnixPaths` module was updated to add `/usr/include` to
`CMAKE_{C,CXX,CUDA}_IMPLICIT_INCLUDE_DIRECTORIES` through an
initialization variable used by `CMakeDetermineCompilerABI` instead of
directly.  This approach makes it only a default that can be overridden
by detection of the implicit include directories really used by the
compiler.

The addition of `<sdk>/usr/include` to default implicit include
directories by the `Platform/Darwin` module needs the same update but
was accidentally left out of the original commit.
2019-02-13 09:52:19 -05:00
Brad King
c03072f2f7 Merge topic '17870-iphone-friendly-cmake'
e8ee8cab97 Xcode: Completely disable code signing for compiler id detection
11da882a12 Apple: Introduce separate system name for iOS, tvOS, and watchOS
36cf44a7a3 Tests: Isolate RunCMake.XcodeProject per-device cases from host arch

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2392
2019-02-05 07:33:04 -05:00
Gregor Jasny
11da882a12 Apple: Introduce separate system name for iOS, tvOS, and watchOS
- Remove code signing requirements for non-macOS
- Do not set deployment target for non-macOS
- Build static library for compiler feature detection for non-macOS
- Use framework to run CompilerId tests for watchOS
- Port tests to new SDK handling
- Add new Apple cross-compiling section to toolchain documentation

Closes: #17870
2019-02-04 09:03:35 -05:00
Brad King
0479ae492a Merge topic 'implicit-incs-cleanup'
1293ed8507 ParseImplicitIncludeInfo: keep implicit incl. consistent when rerunning cmake
eaf53158f4 CrayPrgEnv/ParseImplicitIncludes: simplify for new implict include parser
ef8f237686 ParseImplicitIncludeInfo: add SunPro Fortran and PGI compiler, Cray fix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2894
2019-02-01 08:12:42 -05:00
Brad King
a624a3e1b3 Ninja: Use deps=gcc for Intel Compiler on Windows
Ninja 1.9 supports the depfile format generated by this compiler.
Use `deps = gcc` when the version of Ninja is new enough.

Unfortunately the Intel Compiler for Windows does not properly
escape spaces in paths written to a depfile so if there is a
space in the path we must still fall back to `deps = msvc`.

Fixes: #18855
2019-01-30 14:59:23 -05:00
Chuck Cranor
1293ed8507 ParseImplicitIncludeInfo: keep implicit incl. consistent when rerunning cmake
The first time you run cmake, it sets the implicit include path
to the value reported by the parser (and this value gets saved
in CMake${lang}Compiler.cmake).  But if you re-run cmake,
UnixPaths.cmake blindly appends an extra /usr/include to the
value saved in CMake${lang}Compiler.cmake.  That should not be
harmful in most cases, but we want later runs of cmake to be
consistent with the initial one.  Resolve using a solution
suggested by Brad King:

  - UnixPaths now sets the default implicit include path in a new
    variable named _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT
    This value is only used the first time cmake is run (by
    CMakeDetermineCompilerABI.cmake when it calls the implicit
    include parser).

  - if CMakeDetermineCompilerABI.cmake successfully calls the
    implicit include parser, it overwrites the value in
    _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT with the
    value returned by the parser

  - CMakeDetermineCompilerABI.cmake always sets
    CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES to the above value
    of _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT

  - the final value of CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES gets
    saved to CMake${lang}Compiler.cmake when it is regenerated after
    the compiler tests are done.

  - CMakeDetermineCompilerABI.cmake is only executed the first time cmake
    is run.  Additional runs of cmake directly load the implicit include
    path from the value saved in CMake${lang}Compiler.cmake (the parser
    and _INIT variable are not used).

The above depends on UnixPaths.cmake being loaded to set the _INIT value
before CMakeDetermineCompilerABI.cmake runs the implicit include parser.
2019-01-30 12:05:21 -07:00
Brad King
15ad830062 Refactor exclusion of -I/usr/include to avoid per-language values
Add a `CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES` to contain the
hard-coded list of paths to be excluded from `-I` arguments so that the
values remain excluded even if the per-language
`CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` variants change.

This is needed to preserve our historical exclusion of `-I/usr/include`
even when it is not a real implicit include directory.  A policy may be
needed to remove it later.
2019-01-21 11:14:07 -05:00
Fred Baksik
a42e40e78d GHS: Only print bsp and os directives if specified by user
-- standalone platforms will not build if bsp/os is specified in project file
-- integrity platforms will always print these directives because they are required
-- cleanup -os_dir setting
   allow customization of the actual setting because it is determined by tool-set customization files
   remove variable that was set but never used
-- add message when using default values
2019-01-16 10:40:59 -05:00
Brad King
beb991110d Remove now-unused code once used on IRIX
We dropped support for IRIX as a host platform long ago.
Remove some leftover code.
2019-01-11 13:50:46 -05:00
Marc Chevrier
f255280fd9 PIE link options: Update strategy to fix performance regression
Fixes: #18700
2018-12-19 19:41:27 +11:00
Marc Chevrier
c4b4d8b3a6 POSITION_INDEPENDENT_CODE: Manage link flags for executables
Fixes: #14983, #16561
2018-11-11 17:34:09 +01:00
Brad King
a052479a5c Merge topic 'msvc-custom-rc-mt'
bd9bfc6449 MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}
0033676796 CUDA: Enable RC language on Windows
02f566a559 MSVC: Factor out enable_language(RC) call into helper macro
b601bb6f1c CUDA: Find CMAKE_LINKER on Windows
3eebe28ef4 cmLocalNinjaGenerator: Simplify CreateRulePlaceholderExpander

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2424
2018-11-02 07:57:06 -04:00
Mateusz Zych
bd9bfc6449 MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}
CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC,
are responsible for calling resource compiler and manifest tool.

Before this commit, both of these tools were called directly, with the
expectation that they are available in the `PATH`. This has been fixed
by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT`
defining paths to these tools.

Fixes: #17804
2018-10-29 13:40:47 -04:00
Brad King
0033676796 CUDA: Enable RC language on Windows
We need the resource compiler to place manifests in binaries.
Make sure it is available.
2018-10-29 13:40:47 -04:00
Brad King
02f566a559 MSVC: Factor out enable_language(RC) call into helper macro
This will be useful to call from elsewhere later.
2018-10-29 13:40:47 -04:00
Peter Wu
95bd6317bc RPATH: Record support for $ORIGIN on various *BSD
All of NetBSD, FreeBSD, OpenBSD and DragonFly BSD support `$ORIGIN`,
but the last two require `-z origin` as documented at

    https://lekensteyn.nl/rpath.html

The `-z origin` option causes a flag bit to be set and has no effect if
the `RPATH` does not contain expandable tokens.
2018-10-26 09:27:29 -04:00
Peter Wu
c9b8c79271 RPATH: Record support for $ORIGIN on Haiku and Solaris
Solaris 7 and Haiku (since 2013) both support $ORIGIN as documented at
https://lekensteyn.nl/rpath.html
2018-10-26 09:26:47 -04:00
Peter Wu
6114d85a7d RPATH: Add option for using $ORIGIN in build tree
This makes binaries independent of the build directory by not embedding
the build directory via RPATH.  The tests are partially based on the
existing RuntimePath test, but with the check moved into a POST_BUILD
command such that it can be skipped when the platform lacks support.

Fixes: #18413
2018-10-26 09:25:51 -04:00
Brad King
20e14baae7 Merge topic 'autogen-moc-predef-cross-compile'
66f49d1f9a Android: Add clang --target= flag to compiler predefines command
39534c58c5 Autogen: Add clang --target= flag to compiler predefines command

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: André Klitzing <aklitzing@gmail.com>
Merge-request: !2452
2018-10-08 11:10:19 -04:00
Brad King
66f49d1f9a Android: Add clang --target= flag to compiler predefines command
When we set `CMAKE_<LANG>_COMPILER_TARGET` to the Android target
architecture, add it to `CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND` also.
This is needed to make moc predefines aware of `__ANDROID__`.

Fixes: #18425
2018-10-05 10:23:52 -04:00
Svante Signell
c990649b8c Platform/GNU: Add Debian shared library permissions policy
Copy the `CMAKE_INSTALL_SO_NO_EXE` setting from `Platform/Linux`.

Fixes: #18376
2018-10-03 13:12:21 -04:00
Craig Scott
8ede35523e IN_LIST: Ensure policy allows if(IN_LIST) if used by a module 2018-09-12 14:50:16 +08:00
Brad King
14553ab64b Merge topic 'android-ndk-r18'
ca97d4cb5f Android: Add support for NDK r18

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2319
2018-08-30 09:14:32 -04:00
Brad King
ca97d4cb5f Android: Add support for NDK r18
NDK r18 drops GCC toolchains and some STL types.  We need to choose a
clang toolchain by default when no gcc toolchains are available.  Switch
the STL type default to `c++_static` when the old `gnustl_static`
default is not available.

Update the test suite to not run tests for STL types that do not exist.
Also do not expect the gcc toolchain `cpp` tool to be available because
r18 does not provide it.  Also teach it to tolerate `gcc -dumpmachine`
output like `arm--linux-android` that differs from the toolchain prefix.

Fixes: #18301
2018-08-28 09:27:26 -04:00
Brad King
36f49faa3c Merge topic 'cuda-no-cublas_device'
122c79748c CUDA: Avoid using deprecated cublas_device to identify device lib dirs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2296
2018-08-24 13:35:01 -04:00
Robert Maynard
122c79748c CUDA: Avoid using deprecated cublas_device to identify device lib dirs
Use `curand_static` to identify directories containing device libraries
because `cublas_device` is deprecated and will be removed in the future.

Issue: #18290
2018-08-23 14:43:31 -04:00
yrHeTaTeJlb
ef6a08f6f7 Intel: Use xilib as librarian on Windows
We already use `xilink` instead of `link`, so use `xilib` instead of lib
too.

Suggested-by: Christian Pfeiffer <cpfeiffer@live.de>
Issue: #18240
2018-08-07 08:32:31 -04:00
Brad King
f6f5f9f75f Merge topic 'ghs'
ce4f20ba62 GHS: Add release notes
281c601024 GHS: Update default BSP name
01c98c6ccc GHS: Update setting default OS location for Integrity platforms
bb77dc0cee GHS: Set primary target using arch/platform values (or user specified value)
f80692cf60 GHS: Add platform selection support
a37a4a00c8 GHS: Add toolset selection support
5d40d2b44f GHS: Support ARM, PPC, 86 architectures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Matt Soucy <matthew.soucy@baesystems.com>
Merge-request: !798
2018-07-12 09:15:18 -04:00
Fred Baksik
281c601024 GHS: Update default BSP name
-- Use default value of sim<arch> if not user defined
-- Also no reason to trim quotes or changes slashes; it is just a name not a path
2018-07-11 08:48:23 -04:00
Fred Baksik
01c98c6ccc GHS: Update setting default OS location for Integrity platforms
-- Update how the latest OS is determined; scan the location GHS_OS_ROOT and sort it
   No longer use registry settings looking for installations
     The registry values are assigned in installation order for Green Hills tools not version order
   Filter out files from the list of directories (i.e if int1234.zip and int1234 are both in root folder)
2018-07-11 08:46:26 -04:00
Fred Baksik
bb77dc0cee GHS: Set primary target using arch/platform values (or user specified value) 2018-07-11 08:44:49 -04:00
Martin Storsjö
de5a4653d7 Add WindowsPhone and WindowsStore platform modules for Clang/GNU C/CXX
Just like the existing WindowsPhone and WindowsStore platform modules
for MSVC, just include the corresponding Windows platform modules.

MinGW tools (both with GCC and Clang) can be used for building for
Windows Store, even though it isn't a very common or simple setup.
2018-07-08 00:06:37 +03:00
Marc Chevrier
66ea1a3795 LINK_OPTIONS: Add support of "LINKER:" prefix 2018-06-06 17:22:41 +02:00
Sebastian Holtermann
caa138c1a5 Move GNU COMPILER_PREDEFINES_COMMAND from Platform to Compiler
Moves `CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND` from linux specific
[Modules/Platform/Linux-GNU.cmake](Modules/Platform/Linux-GNU.cmake) to
[Modules/Compiler/GNU.cmake](Modules/Compiler/GNU.cmake).
This enables compiler predefines generation (in AUTOMOC) on all
platforms that run gcc (and clang).
2018-06-01 09:21:06 +02:00
Brad King
edf0ea9bb2 CUDA: Drop unused/broken platform link flags placeholder
The `<CMAKE_CUDA_LINK_FLAGS>` placeholder in CUDA rule variables comes
from the `<CMAKE_CXX_LINK_FLAGS>` placeholder from which the CUDA rule
variables were originally derived.  It is not a public interface for
adding link flags so no projects should be using it.  It is needed for
platform information modules to specify platform-specific link flags for
the language.  None of our platform modules set it, so it is unused.

Furthermore, it is broken as currently implemented.  Some of the
contexts in which it is used need `-Xlinker` and some do not.
Therefore it is not possible to use the placeholder at all.

Simply remove it for now.  If some need for platform-specific CUDA link
flags arises a new solution will be needed.
2018-05-25 10:03:03 -04:00
Brad King
541b53375d Merge topic '17870-effective-system-name'
4597396784 Apple: Use include_guard() within compiler config
e95b3fd9bb Apple: Use CMAKE_EFFECTIVE_SYSTEM_NAME to share compiler info
84f9f63fcc Modules: Introduce CMAKE_EFFECTIVE_SYSTEM_NAME to lookup compiler info
9fa0f2eb56 CMakeFindPackageMode: Perform platform-specific initialization

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1964
2018-04-19 08:20:15 -04:00
Gregor Jasny
4597396784 Apple: Use include_guard() within compiler config 2018-04-18 07:41:44 -04:00
Gregor Jasny
e95b3fd9bb Apple: Use CMAKE_EFFECTIVE_SYSTEM_NAME to share compiler info
Apple platforms macOS, iOS, tvOS, and watchOS can all share the same
compiler information.  Rename `Darwin-*` modules to `Apple-*` and load
them all through `CMAKE_EFFECTIVE_SYSTEM_NAME`.  This saves duplication
of 4 * 21 compiler information modules.

Issue: #17870
2018-04-18 07:41:42 -04:00
Brad King
da294a039d Android: Add support for NDK r17
The `armeabi` ABI is no longer available, so we can no longer use it by
default unconditionally.  Instead detect all available ABIs and choose
the oldest arm ABI that is available.

Also update the test suite to account for the lack of `armeabi` support
and pass as of Android NDK r17-beta2.
2018-04-17 11:21:15 -04:00
Brad King
308d21b225 Merge topic 'msvc-toolset-version-variable'
45bf6f6246 Modules: Use MSVC_TOOLSET_VERSION variable to simplify logic
304f493e57 MSVC: Add MSVC_TOOLSET_VERSION variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1882
2018-04-05 13:26:49 -04:00
Arkady Shapkin
304f493e57 MSVC: Add MSVC_TOOLSET_VERSION variable
Provide the MSVC toolset version number based on the compiler version.

Fixes: #16923
2018-04-04 13:21:09 -04:00
Brad King
8496d11ef8 Merge topic 'android-no-libstdc++'
843d55de29 Android: Suppress implicit -lstdc++ linker flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1919
2018-04-04 11:14:36 -04:00
Brad King
640bc9def4 Merge topic 'cuda_support_system_libraries_with_device_symbols'
41eab150a8 CUDA: Pass more link libraries to device linking
88c7abb740 CUDA: Pass host linker directories to device linker

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1634
2018-04-04 11:12:52 -04:00
Brad King
843d55de29 Android: Suppress implicit -lstdc++ linker flag
The chosen STL libraries are already linked explicitly so we shouldn't
let the compiler add its implicit `-lstdc++` (the default) when invoking
the linker.

Fixes: #17863
NDK-Issue: https://github.com/android-ndk/ndk/issues/105
Inspired-by: Tom Hughes <tomtheengineer@gmail.com>
2018-04-03 14:34:57 -04:00
Brad King
eb80af9093 Drop Visual Studio 8 2005 generator
This generator has been deprecated since CMake 3.9.  Remove it.
2018-04-02 10:08:10 -04:00
Brad King
88c7abb740 CUDA: Pass host linker directories to device linker
In some environments, libraries containing device code are installed in
directories searched by the host linker but not passed by nvcc to
nvlink.  Make these libraries available by explicitly passing the
host linker search directories during device linking.

Issue: #16317
2018-03-28 09:38:43 -04:00
xoviat
a18147e933 MSVC,Clang,Flang: Add IPO support
Fixes: #17692
2018-02-23 10:27:57 -05:00
Brad King
e1f0518de0 GNU: Use -fvisibility on AIX when supported
Revise the logic from commit v3.7.0-rc1~173^2~2 (GNU: Do not use
-fvisibility on AIX or HP-UX, 2016-09-03) to add a version check.
The GCC 7 release notes [1] state that visibility support has been
added for AIX 7.1 and above.

[1] https://gcc.gnu.org/gcc-7/changes.html
2018-01-12 11:50:10 -05:00