Commit Graph

1196 Commits

Author SHA1 Message Date
Sean McBride 5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Sean McBride 37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings 2021-09-28 10:53:54 -04:00
Marc Chevrier cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier 3a1e6f5f59 remove cmToCStr function 2021-09-19 19:11:07 +02:00
Marc Chevrier 7e154ebd59 cmSystemTools::VersionCompare: use std::string for arguments 2021-09-17 11:58:46 +02:00
Cristian Adam 3b9e04accb PCH: MSVC: Restrict OBJECT library INTERFACE_LINK_LIBRARIES usage
The pch object file could cause problems when the reused pch is passed
through an OBJECT library, which would use INTERFACE_LINK_LIBRARIES to
link the pch object file.

Fixes: #22630
2021-09-15 10:39:46 -04:00
Brad King 69c0a5daf9 Merge topic 'pch-xcode-multiple-languages'
bbcdac4e5d PCH: Fix all-language precompile header support in Xcode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6435
2021-09-14 09:48:00 -04:00
Cristian Adam bbcdac4e5d PCH: Fix all-language precompile header support in Xcode
Fixes: #22384
2021-09-13 08:12:11 -07:00
Marc Chevrier dc3aa4024e Refactor: Use new SetProperty signatures 2021-08-25 10:09:10 +02:00
Marc Chevrier 5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Brad King c9cd039e5f Merge topic 'LWYU-externalization'
14e57e9637 LINK_WHAT_YOU_USE feature: externalize configuration
9c5132a586 PGI: Fix "LINKER:" prefix generated separator
8a93de080c cmGeneratorTarget: Add method for LINKER: prefix translation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6306
2021-07-12 08:43:32 -04:00
Marc Chevrier 14e57e9637 LINK_WHAT_YOU_USE feature: externalize configuration
Currently, this feature is only supported on ELF platforms. So, the property
LINK_WHAT_YOU_USE will be ignored for other plateforms.
Moreover, flags and commands are now controled by CMake variables.

Fixes: #20174
2021-07-09 14:50:50 +02:00
Alexander Grund c00f928ce1 Do not exclude include directory symlinks to entries of CPATH
Extend the fix from commit 2d0b0e2b9d (Do not exclude include
directories made implicit by CPATH, 2019-05-29, v3.14.5~2^2) to cover
include directories that are symlinks to paths listed in `CPATH`.

Compare resolved paths against resolved entries of `CPATH`.
Resolve the entries as late as possible in case symlinks change.

Fixes: #22383
2021-07-07 08:04:59 -04:00
Alexander Grund 5c02964aff cmLocalGenerator: Simplify CPATH lookup loop 2021-07-07 08:04:30 -04:00
Alexander Grund 86595b3002 cmLocalGenerator: Clarify check for membership in multiple sets 2021-07-07 08:04:30 -04:00
Alexander Grund 10969fd003 cmLocalGenerator: Remove unnecessary parentheses in a condition 2021-07-07 08:04:29 -04:00
Alexander Grund 3fd56472c6 cmLocalGenerator: Store realpath lookup result in a variable 2021-07-07 08:04:15 -04:00
Alexander Grund 429fb28f25 cmLocalGenerator: Factor out repeated condition into local variable 2021-07-06 19:19:46 -04:00
Ben Boeckel f29e1874ad Compiler/MSVC: use the -external:I flag for system includes
See: #17904
2021-06-18 09:54:17 -04:00
Robert Maynard b50bfc8913 HIP: Add language to CMake 2021-06-07 19:25:33 +00:00
Raul Tambre 1cb4f592a0 add_custom_command: Target-dependent generator expression support
OUTPUT variant with a TARGET given to allow resolving target-based generator
expressions wouldn't work because OUTPUT is resolved before generator targets
are created, i.e. FindGeneratorTargetToUse() returns nullptr.
This is a known limitation, see #21364.

Implements #21336.
2021-05-31 10:39:58 +03:00
Nils Gladitz 99ff75455e install: Implement new install(CODE|SCRIPT) option ALL_COMPONENTS
In a per-component installation the generated installation scripts
are invoked once for each component.

Per default custom installation script code added by install(CODE|SCRIPT)
only runs for one specific component in this context.

The new ALL_COMPONENTS option allows custom script code to be run once
for each component being installed.
2021-05-19 19:17:58 +02:00
Brad King 8526756b61 cmOutputConverter: Adopt relative path conversion helpers
Move them up from cmLocalGenerator and out of cmStateDirectory.
2021-05-17 10:04:01 -04:00
Brad King 013ec595c8 cmLocalGenerator: De-duplicate StateSnapshot member
We have the member from the cmOutputConverter parent.
2021-05-17 10:03:43 -04:00
Brad King 24bfdbcffb cmLocalGenerator: Remove unused MaybeRelativeToCurSrcDir method
With the recent update to `GetObjectFileNameWithoutTarget`, we no longer
have any call sites for `MaybeRelativeToCurSrcDir`.  It does not make
sense for the generator to produce paths relative to the source tree in
general, so remove the method.
2021-05-17 10:03:43 -04:00
Brad King d6fe1bdb6d cmLocalGenerator: Localize logic mapping source path to object file name
We select an object file name based on the path to its source file.
Localize the logic for shortening this via relative paths.  It does not
need to use the generator-wide relative path conversion rules because we
are not actually generating a relative path that needs to be consistent
with anything else.
2021-05-17 10:03:43 -04:00
Marc Chevrier 929c8a7860 INTERFACE_POSITION_INDEPENDENT_CODE must be transitive for OBJECT library
Fixes: #22174
2021-05-14 16:40:53 +02:00
Brad King 15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work
directories (e.g. top of the build tree) as the local path.  Add helpers
for each of the common cases to simplify and clarify call sites.
2021-05-13 12:47:25 -04:00
Brad King ba7b939831 cmStateDirectory: Rename ConvertToRelPathIf{Not => }Contained
The "Not" in the method name is backward from its logic.
2021-05-12 15:53:37 -04:00
Vitaly Stakhovsky 5e8fa0b7bc Source: Minor code improvements 2021-05-11 11:20:04 -04:00
Vitaly Stakhovsky ce97b7909b Source: Remove unnecessary comparisons to nullptr 2021-05-10 11:44:53 -04:00
Josef Angstenberger 5950e54325 Source: Fix typos and spelling in comments 2021-05-07 17:00:18 +02:00
Brad King 50225fb306 Merge topic 'objc-osx-architectures'
5972094708 ObjectiveC: Respect OSX_ARCHITECTURES for OBJC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6090
2021-05-06 10:10:18 -04:00
Brad King 5972094708 ObjectiveC: Respect OSX_ARCHITECTURES for OBJC
Fix a typo from commit 940fc62962 (macOS: Respect OSX_ARCHITECTURES for
ASM, 2020-08-21, v3.19.0-rc1~270^2).

Fixes: #22152
2021-05-05 10:45:01 -04:00
Raul Tambre 56c759b000 Per-language Win32/Console flags
Allows using different compilers with different flags for different languages.
For example Clang with GNU-like commandline for CXX and MSVC as host compiler
for CUDA.

Should help with #21914.
2021-03-17 17:51:56 +02:00
Brad King a133a583d4 cmLocalGenerator: Clarify GetIncludeFlags signature
Make the `config` argument non-optional so all callers must be explicit.
Convert the path style argument to an enumeration to make its role clear
at call sites.

The path style argument is implemented by `ConvertToIncludeReference`,
which was introduced with the Ninja generator by commit 5b114c9bee
(Introduce a cmLocalGenerator::ConvertToIncludeReference function,
2011-09-07, v2.8.7~187^2~4).  Its only purpose is to allow the Ninja
generator to use relative paths in `-I` flags.  Add a comment explaining
this role.
2021-02-25 13:24:45 -05:00
Brad King ab3485d15b Merge topic 'autogen-cmp0116-fix'
339dbc901f Help: Note that CMP0116 is recorded at the time of CC creation
e3740e020e Tests: Test Qt autogen target with CMP0116 set to WARN
cf34011ce7 Tests: Test per-CC behavior of CMP0116
3a95503512 Ninja: Use CMP0116 status recorded at time of custom command's creation
f01f10e8fb cmCustomCommand: Record value of CMP0116 at time of creation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5848
2021-02-24 09:44:59 -05:00
Kyle Edwards f01f10e8fb cmCustomCommand: Record value of CMP0116 at time of creation 2021-02-23 09:14:31 -05:00
Craig Scott 28501fca94 PCH PDB: Fix misuse of IS_NEWER_THAN in timestamp check
When using a file system which only has second resolution timestamps,
there is a reasonably high likelihood of timestamps being the same.
The IS_NEWER_THAN test returns true when timestamps are the same,
so don't retry copying the PCH PDB file when they match exactly.
2021-02-22 11:02:38 -05:00
Brad King cab99f7dba Merge topic 'xcode12-ios_install_combined'
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5785
2021-02-09 08:23:30 -05:00
Craig Scott 0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory.
That means we can no longer do an install by building the install target
when IOS_INSTALL_COMBINED is true. We can, however, still do an install
by running the cmake_install.cmake script or executing cmake --install,
since there is no outer build and therefore the associated SDK can be
built as a sub-build.

The non-build methods previously didn't work when
IOS_INSTALL_COMBINED was true because the generated install script
and the CMakeIOSInstallCombined script both made certain assumptions
that relied on being part of a build. Those assumptions are now
removed. A side-effect of this work is that cpack now also works from the
command line when IOS_INSTALL_COMBINED is true.

Relates: #21282
Fixes: #20023
2021-02-08 18:02:46 +11:00
Cristian Adam c450d66daa PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 15:03:55 -05:00
Brad King 8d379e7406 Revert "PCH: Remove restrictions for REUSE_FROM signature for MSVC"
This reverts commit 9f06097141.
It was merged accidentally.
2021-02-02 15:02:08 -05:00
Cristian Adam 9f06097141 PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 19:11:44 +01:00
Ben Boeckel ef935b17ab clang-tidy: fix readability-use-anyofallof warnings 2021-01-27 08:54:18 -05:00
Ben Boeckel cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Ben Boeckel 808b17b120 clang-tidy: fix readability-make-member-function-const warnings 2021-01-27 08:45:45 -05:00
Craig Scott ee9da76972 Unity: Generate reproducible unity IDs for anonymous namespaces
Fixes: #21564
2021-01-23 07:14:05 +11:00
Oleksandr Koval 209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Craig Scott d2456b29f4 Merge topic 'unity-anon-ns'
0fe9c40494 Unity Build: Add option for generating per-file unique id

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4784
2020-12-16 07:40:41 -05:00