summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
Commit message (Collapse)AuthorAgeFilesLines
* Modules: Consistently use 2 space indentationKitware Robot2019-05-142-7/+7
|
* iOS: Only set the CMAKE_FIND_ROOT_PATH_MODE_* variables when not definedAlexandru Croitor2019-04-301-3/+9
| | | | This allows overriding them in a toolchain file.
* iOS: Only look for packages in the provided CMAKE_FIND_ROOT_PATHsAlexandru Croitor2019-04-301-0/+1
| | | | | | | | | | | | | | | Both CMAKE_FIND_ROOT_PATH_MODE_INCLUDE and CMAKE_FIND_ROOT_PATH_MODE_LIBRARY are set to "ONLY" when cross building to iOS, but appears that CMAKE_FIND_ROOT_PATH_MODE_PACKAGE was overlooked. This causes packages to be searched for in the host system as well, which is incorrect and can lead to linking issues. Set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to "ONLY" as well. CMAKE_FIND_ROOT_PATH_MODE_PROGRAM is not touched, because a user might want to find programs / tools on the host system.
* iOS: Allow setting multiple CMAKE_FIND_ROOT_PATH valuesAlexandru Croitor2019-04-301-1/+1
| | | | | | | | | | | | | Currently the value is hardcoded to contain only the sysroot for the respective darwin platform. This means that it can not be changed in a custom toolchain file. Instead of overriding the value, simply append it. This is similar to how it is done in the Google provided Android toolchain file. The usecase is to allow specifying addiitonal roots to look for 3rd party packages which are definitely not present in the default sysroot.
* iOS: Allow specifying CMAKE_MACOSX_BUNDLE in toolchain fileAlexandru Croitor2019-04-301-1/+3
| | | | | | | | | | Currently CMAKE_MACOSX_BUNDLE is always set to true when compiling for iOS. This poses a problem when using the source file variant of try_compile. Even if a custom value is passed via the CMAKE_FLAGS option, it would still be overridden by the Darwin.cmake file. Only set the value in case no other value was provided before.
* MSVC: Do not add /W3 to CMAKE_<LANG>_FLAGS by defaultBrad King2019-04-193-4/+33
| | | | | | | | | | | | | | We do not add default warning flags on other compilers, and having a warning flag in the default flags makes it hard for projects to customize the warning level. They need to use string processing to remove `/W3` from `CMAKE_{C,CXX}_FLAGS`. Therefore we should drop it. However, projects may be using string processing to replace `/W3` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #18317
* MSVC: Add abstraction for runtime library selectionBrad King2019-04-172-10/+58
| | | | | | | | | | | | | | | | Replace our hard-coded defaults for `/MD` and `/MDd` with a first-class abstraction to select the runtime library from an enumeration of logical names. We've long hesitated to do this because the idea of "runtime library selection" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flags requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0091 to provide compatibility. Fixes: #19108
* Merge topic 'ghs_os_dir'Brad King2019-04-081-11/+12
|\ | | | | | | | | | | | | | | a1e6b414b9 GHS: Update GHS_BSP_NAME processing 266dadf868 GHS: Print status message regarding GHS_OS_DIR Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3123
| * GHS: Print status message regarding GHS_OS_DIRFred Baksik2019-03-291-11/+12
| | | | | | | | | | | | | | | | | | -- Rename platform script so it runs before initial try_compile() in project() command. -- Fix incorrect variable name GHS_OS_DIR_OPTION -- Remove unnecessary ".*" from REGEX expression for GHS_CANDIDATE_OS_DIRS -- Forward GHS_OS_DIR_OPTION to try_compile() and preserve trailing whitespace of the variable.
* | Merge topic 'vs2019-redist'Brad King2019-04-041-1/+4
|\ \ | |/ |/| | | | | | | | | | | 33ee779330 IRSL: Fix discovery of VS 2019 v142 toolset redistributables d8cf8380fb MSVC: Fix MSVC_TOOLSET_VERSION for VS 2019 v142 toolset Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3186
| * MSVC: Fix MSVC_TOOLSET_VERSION for VS 2019 v142 toolsetBrad King2019-04-031-1/+4
| | | | | | | | | | | | | | | | This was forgotten in commit 626c51f47b (VS: Update for Visual Studio 2019 Preview 2, 2019-01-24, v3.14.0-rc1~74^2) when the toolset was first renumbered to `v142`. Issue: #19125
* | GHS: Add support for GHS Multi Generator in LinuxNaren Manimohan2019-03-211-1/+5
| |
* | Merge topic 'android-versioned-soname'Brad King2019-03-061-3/+5
|\ \ | | | | | | | | | | | | | | | | | | 64e2c14c4a Android: allow user to enable versioned soname Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3063
| * | Android: allow user to enable versioned sonameTom Yan2019-03-051-3/+5
| | |
* | | Merge topic 'ios-variable'Brad King2019-03-061-0/+2
|\ \ \ | |/ / |/| / | |/ | | | | | | e427c7c1d8 iOS: Add IOS variable Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3051
| * iOS: Add IOS variableRuslan Baratov2019-03-051-0/+2
| | | | | | | | | | | | | | Since commit 11da882a12 (Apple: Introduce separate system name for iOS, tvOS, and watchOS, 2018-01-15, v3.14.0-rc1~14^2~1) we support setting `CMAKE_SYSTEM_NAME` to `iOS`. Existing iOS toolchain files already set `IOS` as a short-hand variable, so do the same here.
* | Merge topic 'llvm-rc'Brad King2019-03-041-2/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | e53a968ed5 MSVC: Use -D instead of /D in RC_FLAGS 1a281a1acd RC: Pass output file in a way that llvm-rc 7 and below understand fa339ced67 CMakeVersion.rc: Avoid preprocessor definitions to support llvm-rc Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3007
| * | MSVC: Use -D instead of /D in RC_FLAGSZsolt Parragi2019-03-011-2/+4
| | | | | | | | | | | | llvm-rc can't handle definitions given with /D and without a space.
* | | XLClang: Add a new compiler ID for the clang-based XL compilerChuck Atkins2019-02-253-0/+19
| | |
* | | XL: Look for CreateExportList only on AIXBrad King2019-02-251-0/+22
|/ / | | | | | | | | This tool comes with XL on AIX but not on Linux. Move the infrastructure to find and use it to the AIX-specific modules.
* | Cray: clean up CrayPrgEnv and CrayLinuxEnvironment modulesChuck Cranor2019-02-191-68/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CrayPrgEnv: - add a new function __cmake_craype_linktype() that determines what link mode the Cray compiler wrapper will use in a more sophisticated way than just MATCHing for static/dynamic on the command line. - add a new function __cmake_craype_setupenv() that does a once-per-cmake-run setup that does the following: 1. does a basic check of the wrapper's configuration. Running cmake and then changing module and/or linktype configuration may cause build problems (since the data in the cmake cache may no longer be correct after the change). We look for this and warn the user about it. 2. uses the "module" provided PKG_CONFIG_PATH environment variable to add additional prefixes to the system prefix path. This function used to be done by CrayLinuxEnvironment using the compiler implicit include/link paths but that is intended only for cross-compiling on Cray front-end nodes. Since CrayPrgEnv runs on both front-end and compute nodes, we migrate this function here. CrayLinuxEnvironment: - No need to set variables like CMAKE_SHARED_LIBRARY_PREFIX to values that have already been properly established by CMakeGenericSystem.cmake. Remove redundant sets of CMAKE_SHARED_LIBRARY_PREFIX, CMAKE_SHARED_LIBRARY_SUFFIX, CMAKE_STATIC_LIBRARY_PREFIX, CMAKE_STATIC_LIBRARY_SUFFIX, CMAKE_FIND_LIBRARY_PREFIXES, and CMAKE_DL_LIBS. - No need to add $ENV{SYSROOT_DIR}/usr/include to CMAKE_SYSTEM_INCLUDE_PATH when we already added $ENV{SYSROOT_DIR}/usr to CMAKE_SYSTEM_PREFIX_PATH. - Remove __cray_list_intersect(), __list_clean_dupes(), and buggy code that adds compiler implicit includes/libs to CMAKE_SYSTEM_INCLUDE_PATH and CMAKE_SYSTEM_LIBRARY_PATH. This function has migrated to CrayPrgEnv.cmake, as noted above. See discussion in issue #17413 for additional details.
* Prefix implicit include directories with sysroot on constructionBrad King2019-02-181-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix regression in -I/usr/include exclusion logicBrad King2019-02-131-5/+0
| | | | | | | | | | | | | 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
* macOS: Fix addition of <sdk>/usr/include to default implicit include dirsBrad King2019-02-131-1/+1
| | | | | | | | | | | | | | | 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.
* Merge topic '17870-iphone-friendly-cmake'Brad King2019-02-0511-1/+42
|\ | | | | | | | | | | | | | | | | 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
| * Apple: Introduce separate system name for iOS, tvOS, and watchOSGregor Jasny2019-02-0411-1/+42
| | | | | | | | | | | | | | | | | | | | | | - 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
* | Merge topic 'implicit-incs-cleanup'Brad King2019-02-011-4/+7
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | ParseImplicitIncludeInfo: keep implicit incl. consistent when rerunning cmakeChuck Cranor2019-01-301-4/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Ninja: Use deps=gcc for Intel Compiler on WindowsBrad King2019-01-302-0/+4
|/ | | | | | | | | | | 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
* Refactor exclusion of -I/usr/include to avoid per-language valuesBrad King2019-01-211-0/+7
| | | | | | | | | | | 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.
* GHS: Only print bsp and os directives if specified by userFred Baksik2019-01-161-1/+7
| | | | | | | | | -- 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
* Remove now-unused code once used on IRIXBrad King2019-01-112-126/+0
| | | | | We dropped support for IRIX as a host platform long ago. Remove some leftover code.
* PIE link options: Update strategy to fix performance regressionMarc Chevrier2018-12-198-0/+9
| | | | Fixes: #18700
* POSITION_INDEPENDENT_CODE: Manage link flags for executablesMarc Chevrier2018-11-1111-4/+20
| | | | Fixes: #14983, #16561
* Merge topic 'msvc-custom-rc-mt'Brad King2018-11-022-5/+10
|\ | | | | | | | | | | | | | | | | | | | | 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
| * MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}Mateusz Zych2018-10-292-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
| * CUDA: Enable RC language on WindowsBrad King2018-10-291-0/+2
| | | | | | | | | | We need the resource compiler to place manifests in binaries. Make sure it is available.
| * MSVC: Factor out enable_language(RC) call into helper macroBrad King2018-10-291-1/+4
| | | | | | | | This will be useful to call from elsewhere later.
* | RPATH: Record support for $ORIGIN on various *BSDPeter Wu2018-10-264-0/+11
| | | | | | | | | | | | | | | | | | | | 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.
* | RPATH: Record support for $ORIGIN on Haiku and SolarisPeter Wu2018-10-262-0/+2
| | | | | | | | | | Solaris 7 and Haiku (since 2013) both support $ORIGIN as documented at https://lekensteyn.nl/rpath.html
* | RPATH: Add option for using $ORIGIN in build treePeter Wu2018-10-261-0/+1
| | | | | | | | | | | | | | | | | | 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
* | Merge topic 'autogen-moc-predef-cross-compile'Brad King2018-10-081-0/+1
|\ \ | |/ |/| | | | | | | | | | | | | 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
| * Android: Add clang --target= flag to compiler predefines commandBrad King2018-10-051-0/+1
| | | | | | | | | | | | | | | | 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
* | Platform/GNU: Add Debian shared library permissions policySvante Signell2018-10-031-0/+27
|/ | | | | | Copy the `CMAKE_INSTALL_SO_NO_EXE` setting from `Platform/Linux`. Fixes: #18376
* IN_LIST: Ensure policy allows if(IN_LIST) if used by a moduleCraig Scott2018-09-121-0/+5
|
* Merge topic 'android-ndk-r18'Brad King2018-08-302-2/+15
|\ | | | | | | | | | | | | ca97d4cb5f Android: Add support for NDK r18 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2319
| * Android: Add support for NDK r18Brad King2018-08-282-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge topic 'cuda-no-cublas_device'Brad King2018-08-241-1/+1
|\ \ | | | | | | | | | | | | | | | | | | 122c79748c CUDA: Avoid using deprecated cublas_device to identify device lib dirs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2296
| * | CUDA: Avoid using deprecated cublas_device to identify device lib dirsRobert Maynard2018-08-231-1/+1
| |/ | | | | | | | | | | | | Use `curand_static` to identify directories containing device libraries because `cublas_device` is deprecated and will be removed in the future. Issue: #18290
* | Intel: Use xilib as librarian on WindowsyrHeTaTeJlb2018-08-071-1/+1
| | | | | | | | | | | | | | | | We already use `xilink` instead of `link`, so use `xilib` instead of lib too. Suggested-by: Christian Pfeiffer <cpfeiffer@live.de> Issue: #18240