Commit Graph

1881 Commits

Author SHA1 Message Date
Brad King
8d5f4c4db9 Xcode: Switch to the "new build system" for Xcode 12 and above
Provide an option to switch back to the original build system via
`-T buildsystem=1`.

Fixes: #18088
2020-09-18 13:02:14 -04:00
Brad King
b4fc4da903 ExternalProject: Add policy CMP0114 to refine step target dependencies
`ExternalProject_Add_StepTargets` and `INDEPENDENT_STEP_TARGETS` have
some limitations and lack some sanity checks.  They can cause confusing
build systems to be generated.  The basic problems are:

* The notion of step independence is attached to the step target
  rather than the step itself.

* The custom commands implementing the steps are duplicated in the
  step targets and the primary targets.  This can cause races.
  It is also incompatible with the Xcode "new build system".

Fix this by introducing policy CMP0114 to change the way step target
dependencies are handled.  Define independence from external
dependencies as a property of each individual step regardless of whether
there is a target for it.  Add dependencies among the primary target and
the step targets such that each custom command only appears in one
target.  When some steps are disconnected from the primary target, add
step targets for the steps commonly depended upon so that there is a
place to hold their custom commands uniquely.

Fixes: #18663
2020-09-14 10:48:16 -04:00
Brad King
48ed3bae58 Merge topic 'pch-instantiate-templates'
8c8f03422e PCH: Template instantiation support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Acked-by: Cristian Adam <cristian.adam@gmail.com>
Tested-by: Raul Tambre <raul@tambre.ee>
Merge-request: !5168
2020-09-10 16:32:39 -04:00
Brad King
487c711230 Merge topic 'custom-command-dedup'
45fedf0e17 Makefile: Add policy CMP0113 to avoid duplication of custom commands
844779bdc1 cmMakefileTargetGenerator: Simplify custom command output collection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5204
2020-09-10 10:12:30 -04:00
Brad King
45fedf0e17 Makefile: Add policy CMP0113 to avoid duplication of custom commands
Do not attach a custom command to a target if it is already attached to one of
the target's dependencies.  The command's output will be available by the time
the target needs it because the dependency containing the command will have
already been built.

This may break existing projects that do not properly mark non-created
outputs with the `SYMBOLIC` property.  Previously a chain of two custom
commands whose intermediate dependency is not created would put both
commands in a dependent project's Makefile even if the first command is
also in its dependency's Makefile.  The first command would run twice
but the build would work.  Now the second command needs an explicit
`SYMBOLIC` mark on its input to tell CMake that it is not expected to
exist.  To maintain compatibility with projects that left out the mark,
add a policy activating the behavior.
2020-09-08 15:38:40 -04:00
Marc Chevrier
be36266dab file(): Add REAL_PATH sub-command 2020-09-08 18:33:57 +02:00
Marc Chevrier
eb583b0a66 cmake_path command: path management
Fixes: #19568, #20922
2020-09-06 10:52:25 +02:00
Tobias Hieta
8c8f03422e PCH: Template instantiation support
Adds PCH_INSTANTIATE_TEMPLATES target property for enabling template
instantiation in precompiled headers.
Enabled by default. Currently only supported for Clang 11 and newer.

Implements #21133.
2020-09-02 08:30:55 +02:00
Brad King
8f73ff0c37 Merge topic 'target_genex_dependency'
f14b390198 GenEx: Remove unneeded dependencies from target info queries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Merge-request: !5127
2020-09-01 09:59:08 -04:00
Craig Scott
3001e8b5d9 Merge topic 'xcode-link-phase-all'
525464ed2a Xcode: Use "Link Binary With Libraries" build phase in some cases
dc0898205c Xcode: Add special case for file type extension map for .xcassets
7b3d8411a2 Xcode: Refactor build setting append code and attribute getter naming

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5036
2020-09-01 09:38:05 -04:00
Robert Maynard
f14b390198 GenEx: Remove unneeded dependencies from target info queries
Only generate a graph dependency between a custom command and
a target when the custom command queries for the file path
of an artifact of the target.

This makes generator expressions such as `TARGET_FILE_DIR`
behave the same way as `TARGET_PROPERTY` which never generated
a graph dependency.
2020-09-01 09:25:19 -04:00
Brad King
2d723e66f1 Merge topic 'cuda_host_compiler_fail'
01428c5560 CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work during detection
9f81aa0f69 CUDA: Fail if compiler detection using the host compiler fails

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5155
2020-09-01 09:20:23 -04:00
Brad King
f7fbe40513 Merge topic 'file_chmod'
7de60beddf file: Add CHMOD and CHMOD_RECURSE subcommands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Marc Chevrier <marc.chevrier@gmail.com>
Merge-request: !5122
2020-09-01 09:19:18 -04:00
Brad King
f10682b796 Merge topic 'ispc_lang_support'
5ece12b7e4 gitlab-ci: add ISPC to the Fedora CI image
8976817d6d ISPC: Update help documentation to include ISPC
2368f46ba4 ISPC: Support building with the MSVC toolchain
e783bf8aa6 ISPC: Support ISPC header generation byproducts and parallel builds
34cc6acc81 Add ISPC compiler support to CMake
419d70d490 Refactor some swift only logic to be re-used by other languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5065
2020-09-01 09:15:39 -04:00
Gusts Kaksis
525464ed2a Xcode: Use "Link Binary With Libraries" build phase in some cases
OBJECT and STATIC libraries (framework or non-framework) do not use
this build phase. Not all items to be linked use this build phase either.

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2020-09-01 07:38:48 +10:00
Raul Tambre
01428c5560 CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work during detection
Also re-ordered the code to avoid testing flags for other compilers, since
we know the vendor before full detection.
2020-08-29 13:06:45 +03:00
Raul Tambre
9f81aa0f69 CUDA: Fail if compiler detection using the host compiler fails
If an user specified a host compiler we should fail if we are unable to perform
compiler detection with it.
Previously we would try without and likely succeed and continue. Then we'd fail
during ABI detection and compiler testing since we'd still try to use it.

This is particularly problematic when crosscompiling since we extract the host
linker from the compiler detection link line. This would result in the wrong
host linker being used and a linking error due to architecture mismatch during
ABI detection where other necessary flags may already be present to make the
host compiler work. See #21076 for an example.

Fix this by adding CMAKE_<LANG>_COMPILER_ID_REQUIRE_SUCCESS to
CMakeDetermineCompilerId, which throws a fatal error if executing the compiler
results in a non-zero exit code.

Fixes #21120.
2020-08-29 13:06:44 +03:00
Robert Maynard
8976817d6d ISPC: Update help documentation to include ISPC 2020-08-28 11:21:31 -04:00
Sibi Siddharthan
7de60beddf file: Add CHMOD and CHMOD_RECURSE subcommands
Fixes: #21057

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
2020-08-26 21:22:50 +05:30
Brad King
efdd143459 Merge topic 'vs-win-sdk-custom-max'
ba497111f6 VS: Add option for custom Win10 SDK version maximum

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5150
2020-08-26 10:28:07 -04:00
jonathan molinatto
ba497111f6 VS: Add option for custom Win10 SDK version maximum
Since commit 83ddc4d289 (VS: Do not select a Windows SDK too high for
current VS version, 2017-08-07, v3.13.0-rc1~72^2~2) we enforce a maximum
SDK version for the VS 2015 generator.  The blog post linked in the
original commit is no longer available, but it can be seen here:

* https://web.archive.org/web/20190108032520/https://blogs.msdn.microsoft.com/chuckw/2018/10/02/windows-10-october-2018-update/

In particular, it states:

> VS 2015 Users: The Windows 10 SDK (15063, 16299, 17134, 17763)
> is officially only supported for VS 2017.

However, in some circumstances a higher version can be used.

Add a `CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` to override the
generator's default maximum SDK version.

Fixes: #20633
2020-08-25 15:27:38 -04:00
Brad King
5e212cafba Merge topic 'osx_asm_architectures'
940fc62962 macOS: Respect OSX_ARCHITECTURES for ASM

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5152
2020-08-25 10:40:20 -04:00
Brad King
f035ddec4f Merge topic 'win32-executable-genex'
3ef0c40962 WIN32_EXECUTABLE: Add support for generator expressions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5146
2020-08-25 10:33:00 -04:00
Brad King
ea67dbc4cd Merge topic 'file_generate_target'
27a912193b file(GENERATE): Add TARGET argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5131
2020-08-25 10:31:02 -04:00
Raul Tambre
940fc62962 macOS: Respect OSX_ARCHITECTURES for ASM
Fixes #20771.
2020-08-22 09:16:21 +03:00
Kyle Edwards
3ef0c40962 WIN32_EXECUTABLE: Add support for generator expressions 2020-08-21 09:17:27 -04:00
Raul Tambre
359c500a24 cmTarget: Raise error if imported target location is not set
Previously we would synthesize <TARGET_NAME>-NOTFOUND as the location. This
would then end up on the link line and cause build failures.
Policy CMP0110 is added to control this behaviour.

Fixes #19080, #19943.
2020-08-21 08:38:39 -04:00
Raul Tambre
27a912193b file(GENERATE): Add TARGET argument
Adds TARGET argument to file(GENERATE) to make resolving generator expressions
requiring a target possible.

Implements #21101, fixes #21074.
2020-08-20 17:41:52 +03:00
Brad King
cb5c8e6f25 Merge topic 'cpack-wix-custom-xmlns'
267de3ba30 CPack/WiX: Add support for custom XML namespaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5132
2020-08-19 11:48:24 -04:00
Fritz Elfert
267de3ba30 CPack/WiX: Add support for custom XML namespaces
Add a `CPACK_WIX_CUSTOM_XMLNS` option to specify these.

Fixes: #21098
2020-08-18 07:50:49 -04:00
Brad King
fe3a404a73 Merge topic 'add_test-special-chars-in-name'
a20987732b add_test: Allow special characters in test name (w/ policy CMP0110)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5076
2020-08-17 14:58:49 -04:00
Kyle Edwards
2e42651dff Add option to optimize link dependencies for static libraries
Add an `OPTIMIZE_DEPENDENCIES` target property and supporting
`CMAKE_OPTIMIZE_DEPENDENCIES` variable to optionally enable pruning and
flattening of outgoing dependencies from static libraries.  Since they
do not actually link, they only depend on side effects of their
dependencies.  Therefore we can drop dependencies that contribute no
side effects.
2020-08-12 11:31:07 -04:00
Deniz Bahadir
a20987732b add_test: Allow special characters in test name (w/ policy CMP0110)
Restore the change from commit f84af8e270 (add_test: Allow special
characters in test name, 2020-05-16, v3.18.0-rc1~142^2) that had to be
reverted by commit f84af8e270 (add_test: Allow special characters in
test name, 2020-05-16, v3.18.0-rc1~142^2) for compatibility.

Add policy CMP0110 to make the change in a compatible way.
Also, support even more characters than before by generating the
test scripts using bracket arguments around the test names.

Fixes: #19391
Signed-off-by: Deniz Bahadir <dbahadir@benocs.com>
2020-08-12 10:44:07 -04:00
Brad King
d6ee9b4a43 Merge topic 'build-interface-targets'
bafa9fe887 fileapi: Add INTERFACE libraries with SOURCES to codemodel-v2
4391913133 Add INTERFACE libraries to generated buildsystem if they have SOURCES
afb998704e Remove filtering of allowed INTERFACE library properties
e7edba2baf Makefiles: Use IsInBuildSystem in global generator target type checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5078
2020-08-10 11:38:59 -04:00
Brad King
0953c0051e Merge topic 'clang-cl-vfs'
20ebaed972 Clang: Add support for passing VFS arguments
d993ebd4ca clang-cl: Add '--' before source file
a94672b919 cmake: Change cmake_llvm_rc separator from -- to ++ to avoid conflict

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5087
2020-08-10 11:33:19 -04:00
Thomas Bernard
20ebaed972 Clang: Add support for passing VFS arguments 2020-08-07 11:52:45 -04:00
Brad King
304f159af4 Merge topic 'CUDAToolkit-no-nvcc'
7cc815a2a6 CUDAToolkit: Detect CUDA SDK that don't have nvcc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: Raul Tambre <raul@tambre.ee>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !5061
2020-08-07 11:04:54 -04:00
Brad King
4391913133 Add INTERFACE libraries to generated buildsystem if they have SOURCES
INTERFACE libraries were created with the intention of collecting usage
requirements for use by other targets via `target_link_libraries`.
Therefore they were not allowed to have SOURCES and were not included in
the generated buildsystem.  In practice, this has become limiting:

* Header-only libraries do have sources, they just do not compile.
  Developers should be able to edit those sources (the header files)
  in their IDE.

* Header-only libraries may need to generate some of their header
  files via custom commands.

Some projects work around these limitations by pairing each interface
library with an `add_custom_target` that makes the header files and
custom commands appear in the generated buildsystem and in IDEs.

Lift such limitations by allowing INTERFACE libraries to have SOURCES.
For those with sources, add a corresponding build target to the
generated buildsystem.

Fixes: #19145
2020-08-07 08:46:32 -04:00
Brad King
4daf76e10a Merge topic 'compiler_flags'
f76c20da63 Toolchain: Test compiler initial settings
db486da265 Toolchain: Update documentation for initial compiler flags
deec2f587c Toolchain: Take CMAKE_<lang>_FLAGS_INIT into account during compiler detection
ca899af3e2 Toolchain: Handle repeated invocations of CMake with -DCMAKE_C_COMPILER
12ba89e142 Toolchain: Make `/path/comp;-argn' behave the same as 'comp;-argn'
6f1af899db Toolchain: Capture all arguments from CMAKE_<LANG>_COMPILER
ec1d3bc0b6 cmake: avoid exception when printing "changed variables" message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4136
2020-08-06 11:00:12 -04:00
Fred Baksik
db486da265 Toolchain: Update documentation for initial compiler flags 2020-08-03 12:34:46 -04:00
Robert Maynard
7cc815a2a6 CUDAToolkit: Detect CUDA SDK that don't have nvcc
When a CUDA sdk doesn't have nvcc, defer to the existence of
a version.txt file. When we do this fall back we also reconstruct
the CUDA version via version.txt

Fixes #20643
2020-07-30 15:56:52 -04:00
Craig Scott
22bfe014d0 Merge topic 'file-download-no-save'
fed7d8f76d file(DOWNLOAD): Make file argument optional

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5060
2020-07-28 10:23:35 -04:00
Kyle Edwards
fed7d8f76d file(DOWNLOAD): Make file argument optional 2020-07-27 11:26:50 -04:00
Brad King
22bd267388 Help: Add release note for EXCLUDE_FROM_ALL genex support 2020-07-23 07:14:48 -04:00
Brad King
c7b7547d8d Merge topic 'cmake-E-create_hardlink'
2fad00940d cmake: Add -E create_hardlink

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5015
2020-07-16 10:19:12 -04:00
Sibi Siddharthan
2fad00940d cmake: Add -E create_hardlink
Fixes: #20950
Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
2020-07-15 20:22:04 +05:30
Tor Arne Vestbø
17e13fb6d0 macOS: Always pick latest SDK if user has not set one explicitly
Apple tech note QA1806 recommends always building against the latest
SDK.

Fixes: #20949
2020-07-14 15:43:45 +02:00
Brad King
8d268f57b4 Merge topic 'cuda-memcheck'
cee92a9fb0 Help: add release notes for CTest cuda-memcheck support
f38e4a1871 Tests: Add cases for CTest cuda-memcheck parser
fe062800f0 CTest: add cuda-memcheck support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: tcojean <terry.cojean@kit.edu>
Merge-request: !4952
2020-07-13 07:58:38 -04:00
Tobias Ribizel
cee92a9fb0 Help: add release notes for CTest cuda-memcheck support 2020-07-09 19:08:36 +02:00
Craig Scott
8975c2a55b Merge topic 'remove-warn-unused-vars'
df6b077625 cmake: Remove broken '--warn-unused-vars' option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !4953
2020-07-01 07:03:54 -04:00