Commit Graph

4549 Commits

Author SHA1 Message Date
Brad King
3313bf06eb Merge topic 'ios-combined-prune-archs'
5852b8867f CMakeIOSInstallCombined: Enforce disjoint architecture sets
79098d23eb Tests: Avoid warnings about unused arguments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5111
2020-08-17 14:52:08 -04:00
Josef Angstenberger
5b17421bdc Help: Improve formatting for IMPLICIT_DEPENDS_INCLUDE_TRANSFORM 2020-08-14 01:51:59 +02:00
Kyle Edwards
8b5aa9051b Merge topic 'optimize-static-library-deps'
2e42651dff Add option to optimize link dependencies for static libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5103
2020-08-13 14:16:25 -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
Brad King
b3196fe864 Merge topic 'msvc_c11'
f7347f28c7 MSVC: Record support for C11 and c_restrict

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5115
2020-08-12 11:14:52 -04:00
Raul Tambre
f7347f28c7 MSVC: Record support for C11 and c_restrict
MSVC >=19.27 supports a C11 switch.
The `c_restrict` feature has also been implemented.

Fixes: #21069
2020-08-11 09:08:21 -04:00
Brad King
121c3717ee Merge topic 'automoc-path-prefix-off'
5b5be34811 Help: Add 3.18.2 release note about AUTOMOC_PATH_PREFIX default change
db659e18bc Merge branch 'backport-3.17-automoc-path-prefix-off'
e503fbe38a Merge branch 'backport-3.16-automoc-path-prefix-off'
4c33b305a0 Autogen: Turn off moc path prefix generation by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5105
2020-08-11 08:51:02 -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
Joerg Bornemann
5b5be34811 Help: Add 3.18.2 release note about AUTOMOC_PATH_PREFIX default change 2020-08-10 10:49:55 -04:00
Brad King
db659e18bc Merge branch 'backport-3.17-automoc-path-prefix-off' 2020-08-10 10:49:18 -04:00
Brad King
e503fbe38a Merge branch 'backport-3.16-automoc-path-prefix-off' 2020-08-10 10:41:06 -04:00
Joerg Bornemann
4c33b305a0 Autogen: Turn off moc path prefix generation by default
Change the default value of `CMAKE_AUTOMOC_PATH_PREFIX` to `OFF` to
restore compatibility with behavior of CMake 3.15 and below.

C++ source files that are generated by Qt's meta object compiler (moc)
include the header file that was passed as input argument to moc. This
is usually a path relative to the source directory, for example

    #include "../../source/dir/myobject.h"

That is problematic for reproducible builds as described in #18815.
To cope with that, the target property AUTOMOC_PATH_PREFIX was
introduced in CMake 3.16 by commit d018d27c10 (Autogen: Add moc path
prefix generation (AUTOMOC_PATH_PREFIX), 2019-09-13, v3.16.0-rc1~94^2~4).
The property is default-initialized from the variable
`CMAKE_AUTOMOC_PATH_PREFIX`, which defaults to `ON`.

If this property is ON, and myobject.h is located in an include
directory of the target, moc-generated C++ files include the file
without the "path prefix":

    #include "myobject.h"

This behavior, however, can break projects that have equally named
header files in different include directories.  As "not breaking
existing projects" trumps "have reproducible builds by default" we
change the default of `CMAKE_AUTOMOC_PATH_PREFIX` to `OFF`.

Also, it is now possible to pass `-DCMAKE_AUTOMOC_PATH_PREFIX=ON` on the
CMake command line.  Before, it was overridden in `CMakeGenericSystem`.

Fixes: #20598
Issue: #18815
2020-08-10 10:36:17 -04:00
Gregor Jasny
5852b8867f CMakeIOSInstallCombined: Enforce disjoint architecture sets
Starting with Xcode 12 the arm64 architecture is supported
as an iOS device as well as simulator architecture.

But the fat macho file format does not distinguish by SDK,
only by architecture. That makes lipo (rightfully) complain
that it cannot add both architectures to a single file.

To work around we make sure that both SDKs are built for a
disjoint set of architectures. If an architecture is present
for both SDKs we prefer the currently configured one.

The log output has been extended to reflect that:

```
[iOS combined] Architectures (iphoneos): arm64 arm64e armv7 armv7s
[iOS combined] Architectures (iphonesimulator): arm64 arm64e i386 x86_64
[iOS combined] Architectures (iphonesimulator) after pruning: i386 x86_64
```
2020-08-08 15:22:12 +02: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
bafa9fe887 fileapi: Add INTERFACE libraries with SOURCES to codemodel-v2
INTERFACE libraries with SOURCES now appear in the generated
buildsystem, so include them in the codemodel output too.

We do not need to bump the `codemodel-v2` object kind minor
version because that was already done in post-3.18 development
by commit 7d6861f367 (fileapi: Extend codemodel targets with
language standard, 2020-06-18).

Fixes: #18608
2020-08-07 08:46:34 -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
Brad King
a5466e42c8 Merge topic 'improve_standard_required_doc'
2cc1159653 Help: Clarify what MSVC compilers ignore <LANG>_STANDARD_REQUIRED

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5093
2020-08-06 10:49:29 -04:00
Brad King
1f1feb72f8 Help: Document in add_library that IMPORTED_IMPLIB is for DLL import libs
Fixes: #21053
2020-08-04 09:29:42 -04:00
Fred Baksik
db486da265 Toolchain: Update documentation for initial compiler flags 2020-08-03 12:34:46 -04:00
Robert Maynard
2cc1159653 Help: Clarify what MSVC compilers ignore <LANG>_STANDARD_REQUIRED
Fixes #20953
2020-08-03 11:58:04 -04:00
Brad King
afb998704e Remove filtering of allowed INTERFACE library properties
Previously we disallowed use of arbitrary properties on INTERFACE
libraries.  The goal was to future-proof projects using them by not
allowing properties to be set that may affect their future inclusion in
the generated buildsystem.  In order to prepare to actually include
INTERFACE libraries in the generated buildsystem, drop the filter and
allow arbitrary properties to be set.

Issue: #19145
2020-08-03 10:04:23 -04:00
Craig Scott
bda967bcb9 Merge topic 'doc-add_library-updates'
ee5b58f491 Help: State in add_library that INTERFACE libraries have no build targets
99b1e85f07 Help: Consolidate add_library documentation on IMPORTED libraries
716e76be3e Help: Re-order add_library sections
1b0adeea81 Help: Clarify target_sources PRIVATE/PUBLIC/INTERFACE scopes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5086
2020-08-01 19:59:55 -04:00
Brad King
ee5b58f491 Help: State in add_library that INTERFACE libraries have no build targets 2020-07-31 12:04:17 -04:00
Brad King
99b1e85f07 Help: Consolidate add_library documentation on IMPORTED libraries
Move documentation on IMPORTED INTERFACE libraries to the main section
on Imported Libraries.  Revise the section to clarify the different
kinds of imported libraries that can be created and what properties they
need.

Issue: #18975
2020-07-31 11:40:15 -04:00
Brad King
716e76be3e Help: Re-order add_library sections
Put all the sections that create in-project targets first,
and move Imported Libraries and Alias Libraries at the end.
2020-07-31 11:22:28 -04:00
Brad King
1b0adeea81 Help: Clarify target_sources PRIVATE/PUBLIC/INTERFACE scopes 2020-07-31 10:32:59 -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
Brad King
40d3f5a227 Merge topic 'revert-add_test-special-chars'
5fc5f4d26e add_test: Revert "Allow special characters in test name"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5067
2020-07-28 08:24:34 -04:00
Brad King
5fc5f4d26e add_test: Revert "Allow special characters in test name"
Revert commit f84af8e270 (add_test: Allow special characters in test
name, 2020-05-16, v3.18.0-rc1~142^2).  Unfortunately the fix breaks
projects that were working around the limitation with manual escaping.
The fix can be re-introduced with a policy in a future version.

Also add a 3.18.1 release note explaining the change.

Fixes: #21017, #20965
Issue: #19391
2020-07-28 08:04:11 +10:00
Kyle Edwards
fed7d8f76d file(DOWNLOAD): Make file argument optional 2020-07-27 11:26:50 -04:00
Brad King
11cf196fd2 Merge topic 'EXCLUDE_FROM_ALL-genex'
22bd267388 Help: Add release note for EXCLUDE_FROM_ALL genex support
807c8aa9f0 Tests: Simplify RunCMake.ExcludeFromAll single-config case
36743436cf Tests: Fix RunCMake.ExcludeFromAll test program warning
99c131c5a3 cmGlobalGenerator: Fix spelling of EXCLUDE_FROM_ALL in error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5049
2020-07-27 10:40:56 -04:00
Brad King
2cb664fd77 Merge topic 'file-GET_RUNTIME_DEPENDENCIES-terms'
2b60088d14 Help: Update file(GET_RUNTIME_DEPENDENCIES) prose to match option names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5053
2020-07-23 14:11:53 -04:00
Brad King
16327086f0 Merge topic 'file-GET_RUNTIME_DEPENDENCIES-terms' into release-3.18
2b60088d14 Help: Update file(GET_RUNTIME_DEPENDENCIES) prose to match option names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5053
2020-07-23 14:11:52 -04:00
Brad King
2b60088d14 Help: Update file(GET_RUNTIME_DEPENDENCIES) prose to match option names 2020-07-23 13:47:24 -04:00
Brad King
9d9a6a8532 Merge topic 'tutorial-update'
63af35019a Tutorial: Add missing `language` option to literalinclude

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5046
2020-07-23 11:08:38 -04:00
Brad King
e3b5abd068 Merge topic 'fix-typos-identified-using-codespell'
207373802e Fix typos identified using codespell

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5040
2020-07-23 08:28:21 -04:00
Brad King
22bd267388 Help: Add release note for EXCLUDE_FROM_ALL genex support 2020-07-23 07:14:48 -04:00
Betsy McPhail
63af35019a Tutorial: Add missing language option to literalinclude 2020-07-22 16:17:41 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Brad King
d45f0d719e Merge topic 'EXCLUDE_FROM_ALL-genex'
2cdaf43d96 Allow generator expressions in the EXCLUDE_FROM_ALL target property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5021
2020-07-22 11:23:34 -04:00
Betsy McPhail
d103e34030 Documentation: Add missing links to DEBUG_POSTFIX target property
Add links to the `<CONFIG>_POSTFIX` target property when it is
referenced in the `DEBUG_POSTFIX` documentation.
2020-07-21 12:53:53 -04:00
Joerg Bornemann
2cdaf43d96 Allow generator expressions in the EXCLUDE_FROM_ALL target property
This allows for setting EXCLUDE_FROM_ALL, conditional on the build
configuration. However, only the Ninja Multi-Config generator supports
different property values per config. All other multi-config
generators will yield an error in that situation.

Fixes: #20923
2020-07-21 17:16:26 +02:00
Brad King
51c14d4daf Merge topic 'tutorial-index-update'
8a80b8fbe4 Tutorial: Clarify Steps 1, 2 and 3

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5029
2020-07-21 07:32:12 -04:00
Craig Scott
8abeec58f3 Merge topic 'xcode-native-arch'
26673bf480 Xcode: Explicitly specify default native architecture on macOS
ce624cfbd4 cmGlobalXCodeGenerator: Save CMAKE_SYSTEM_NAME in member

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5023
2020-07-21 07:19:02 -04:00
Brad King
26673bf480 Xcode: Explicitly specify default native architecture on macOS
When `CMAKE_OSX_ARCHITECTURES` is not specified, we add the Xcode
setting `ONLY_ACTIVE_ARCH = YES` with the intention of targeting the
native architecture of the host.  However, the default `ARCHS` value
chosen by "Xcode 12 Universal Apps" includes multiple architectures.
Add an explicit `ARCHS` setting with value `$(NATIVE_ARCH_ACTUAL)`
to tell Xcode to use the host's native architecture only.

Fixes: #20893
2020-07-20 10:03:15 -04:00
Betsy McPhail
8a80b8fbe4 Tutorial: Clarify Steps 1, 2 and 3 2020-07-17 12:17:26 -04:00