1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Commit Graph

53112 Commits

Author SHA1 Message Date
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
Brad King
4cb6a53bf5 cmListFileCache: Simplify relative path conversion in backtraces
Printing paths to CMake input files does not need to use the
generator-wide relative path conversion rules because we are not
actually generating a relative path for the build system that needs to
be consistent with anything else.  Instead, simply print a relative path
if it does not need to start in `../`, and otherwise an absolute path.
2021-05-17 10:03:33 -04:00
Brad King
5b3a71a83f cmSystemTools: Adopt RelativeIfUnder helper
This returns a relative path if it does not start in `../`.
2021-05-17 10:02:16 -04:00
Brad King
ea9b1d36b8 cmStateDirectory: Clarify relative path top selection logic
Re-implement the same algorithm using direct iteration without
collecting a vector first.
2021-05-17 10:02:16 -04:00
Brad King
2d9109df7c cmStateDirectory: Remove network path logic from relative path top selection
The logic skipping relative paths for build trees on network paths came
from commit b5035770bc (BUG: On Windows network paths do not really
work..., 2003-12-24, v2.4.0~3517).  However, since commit ad4055f3e2
(ENH: Set RelativePathTopSource and RelativePathTopBinary independently
..., 2007-03-07, v2.6.0~2061) we effectively ignore this logic if the
build tree is inside the source tree on a network path.  Also, it is not
clear that logic using `RelativePathTopBinary` is prepared for it to be
empty.  Remove the logic for now.  If a problem comes up, we can choose
a new approach.
2021-05-17 10:02:16 -04:00
Brad King
b4f07bfe5a cmStateDirectory: Fix comment on relative path top directory selection
Fix the comment added by commit f6d4fa63f8 (cmStateDirectory: Comment
relative path top directory selection approach, 2021-05-13) to describe
the actual behavior.
2021-05-17 10:02:16 -04:00
Brad King
d8d0f3ec37 Makefiles: Remove non-functioning relative path conversion
In CMake 3.6 and below, running

    cmake --build . --target "$(pwd)/SomeTarget"

with a Makefiles generator automatically converted the target
name and invoked `make SomeTarget`.  This made the build command
work even though

    make "$(pwd)/SomeTarget"

would fail.  This behavior was not implemented for any other generators,
and does not make sense because `cmake --build` is supposed to be a thin
wrapper around the native build tool.  It has also been broken since
commit 8d47a20f13 (cmOutputConverter: use new ConvertToRelativePath
signature internally, 2016-06-16, v3.7.0-rc1~90^2~1) because cmState's
relative path conversion logic is not initialized in `cmake --build`.

Remove the non-functioning code.
2021-05-17 10:01:57 -04:00
Brad King
f3b4605741 Merge topic 'doc-ep-configure-build-passthrough'
cf3bc271d1 Help: Clarify details passed to ExternalProject configure and build

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6135
2021-05-17 09:45:43 -04:00
Brad King
ea07390703 Merge topic 'doc-cmake_minimum_version'
b00a171b2b Help: Clarify calling cmake_minimum_required() inside a function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6129
2021-05-17 09:43:24 -04:00
Brad King
afac27d488 Merge topic 'OBJECT-lib-PIC-transitive'
929c8a7860 INTERFACE_POSITION_INDEPENDENT_CODE must be transitive for OBJECT library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6127
2021-05-17 09:42:35 -04:00
Brad King
161f8f42c5 Merge topic 'IncludeInfo-var-expand'
caea48eec9 CMakeParseImplicitIncludeInfo: remove needless variable expansions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6125
2021-05-17 09:41:43 -04:00
Kitware Robot
33185217b0 CMake Nightly Date Stamp 2021-05-17 00:01:11 -04:00
Craig Scott
cf3bc271d1 Help: Clarify details passed to ExternalProject configure and build
Fixes: #22116
2021-05-16 20:28:00 +10:00
Kitware Robot
49975358fc CMake Nightly Date Stamp 2021-05-16 00:01:06 -04:00
Craig Scott
b00a171b2b Help: Clarify calling cmake_minimum_required() inside a function
Fixes: #21519
2021-05-15 15:26:01 +10:00
Kitware Robot
639a6bd4c7 CMake Nightly Date Stamp 2021-05-15 00:01:09 -04:00
Brad King
4d579f83e1 Merge branch 'release-3.20' 2021-05-14 10:55:16 -04:00
Brad King
fa8599e9a6 Merge topic 'sphinx-4'
bb9c69ed70 Utilities/Sphinx: Update man page config for Sphinx 4

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6126
2021-05-14 10:55:16 -04:00
Brad King
3a4bb26953 Merge topic 'sphinx-4' into release-3.20
bb9c69ed70 Utilities/Sphinx: Update man page config for Sphinx 4

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6126
2021-05-14 10:55:16 -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
bb9c69ed70 Utilities/Sphinx: Update man page config for Sphinx 4
Sphinx 4 by default generates `man/#/foo.#`, but older versions generate
`man/foo.#` as our install rules expect.  Update our Sphinx config file
to tell Sphinx 4 to use the old layout.

Fixes: #22192
2021-05-14 10:30:34 -04:00
Brad King
21da0f83a2 Merge topic 'relative-paths'
f6d4fa63f8 cmStateDirectory: Comment relative path top directory selection approach
f0ffb1e2d4 cmGlobalGenerator: Simplify relative path conversion in AddRuleHash
d346805e41 cmLocalCommonGenerator: Select work directory semantically
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
1879f1bcbc cmLocalCommonGenerator: Factor out relative path conversion helper
1d1d88d3c8 cmMakefileTargetGenerator: Clarify name of relative path conversion helper
ec1ea13066 cmDependsFortran: Simplify relative path conversion helper
ba7b939831 cmStateDirectory: Rename ConvertToRelPathIf{Not => }Contained
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6122
2021-05-14 08:37:24 -04:00
Brad King
40a7572e4f Merge topic 'VS-include_external_msproject-CSharp-targets-references'
c7aa3bdefc Tests/include_external_msproject: Check C# project reference
65b58b0316 VS Generator: Properly reference included external C# projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6123
2021-05-14 08:35:36 -04:00
Brad King
ad58b4407c Merge topic 'FetchContent-local-vars'
5d32ce320b FetchContent: Use private local variables in FetchContent_MakeAvailable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !6114
2021-05-14 08:34:48 -04:00
Brad King
91219e52dc Merge branch 'release-3.20' 2021-05-14 08:33:29 -04:00
Brad King
e2c5209532 Merge topic 'cmake_build_and_install_command_error_when_given_bad_arguments'
f78b167a23 cmCommandLineArgument: Provide more information syntax error messages
5aa0dec6b0 cmake: `--build` and `--install` error out when encountering bad flags
928cdb17c5 cmCommandLineArgument: Correctly record parsing failures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6119
2021-05-14 08:33:29 -04:00
Brad King
0348b22a0c Merge topic 'cmake_build_and_install_command_error_when_given_bad_arguments' into release-3.20
f78b167a23 cmCommandLineArgument: Provide more information syntax error messages
5aa0dec6b0 cmake: `--build` and `--install` error out when encountering bad flags
928cdb17c5 cmCommandLineArgument: Correctly record parsing failures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6119
2021-05-14 08:33:28 -04:00
Brad King
02e50a4c0a Merge topic 'scandep-format'
db8e0beeac cmGlobalNinjaGenerator: Clarify semantics of Fortran scanning info
bd12b97d05 cmScanDepFormat: Drop unused "outputs", "inputs", and "depends" fields

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !6115
2021-05-14 08:32:05 -04:00
Kitware Robot
1acc937719 CMake Nightly Date Stamp 2021-05-14 00:01:09 -04:00
Brad King
f6d4fa63f8 cmStateDirectory: Comment relative path top directory selection approach 2021-05-13 12:48:43 -04:00
Brad King
f0ffb1e2d4 cmGlobalGenerator: Simplify relative path conversion in AddRuleHash
Revert commit 204aecdf82 (cmGlobalGenerator: Port configure-time code to
cmMakefile., 2015-08-02, v3.4.0-rc1~234^2~8).  `AddRuleHash` is
generate-time code.
2021-05-13 12:48:43 -04:00
Brad King
d346805e41 cmLocalCommonGenerator: Select work directory semantically 2021-05-13 12:48:22 -04: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
1879f1bcbc cmLocalCommonGenerator: Factor out relative path conversion helper 2021-05-13 12:47:25 -04:00
Brad King
1d1d88d3c8 cmMakefileTargetGenerator: Clarify name of relative path conversion helper 2021-05-13 12:47:25 -04:00
Brad King
ec1ea13066 cmDependsFortran: Simplify relative path conversion helper
Revert commit 8377d9e00b (Fortran: Inline conversion to relative path,
2016-10-04, v3.8.0-rc1~494^2~4).  The inline implementation is still
identical to what was previously called.  Restore the call again.
2021-05-13 12:46:26 -04:00
Dario Passet
c7aa3bdefc Tests/include_external_msproject: Check C# project reference 2021-05-13 18:38:01 +02:00
Rolf Eike Beer
caea48eec9 CMakeParseImplicitIncludeInfo: remove needless variable expansions
They seem to actually cause trouble, like an error reported on IRC where some
but not all CMake invocations may end up with an error like this:

   CMake Warning (dev) at /usr/share/cmake/Modules/CMakeParseImplicitIncludeInfo.cmake:74 (if):
     Policy CMP0054 is not set: Only interpret if() arguments as variables or
     keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
     details.  Use the cmake_policy command to set the policy and suppress this
     warning.

     Quoted keywords like ")" will no longer be interpreted as keywords when the
     policy is set to NEW.  Since the policy is not set the OLD behavior will be
     used.
   Call Stack (most recent call first):
     /usr/share/cmake/Modules/CMakeParseImplicitIncludeInfo.cmake:179 (cmake_parse_implicit_include_line)
     /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:119 (cmake_parse_implicit_include_info)
     /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
     CMakeLists.txt:24 (project)
   This warning is for project developers.  Use -Wno-dev to suppress it.

   CMake Error at /usr/share/cmake/Modules/CMakeParseImplicitIncludeInfo.cmake:74 (if):
     if given arguments:

       "GNU" "STREQUAL" "SunPro" "AND" "(" ")" "MATCHES" "-D__SUNPRO_C" "OR" ")" "MATCHES" "-D__SUNPRO_F" ")"

I suspect that the line ends up being just ")", which then causes this error.
2021-05-13 17:52:13 +02:00
Robert Maynard
f78b167a23 cmCommandLineArgument: Provide more information syntax error messages 2021-05-13 09:33:30 -04:00
Robert Maynard
5aa0dec6b0 cmake: --build and --install error out when encountering bad flags
Fixes #22186
2021-05-13 09:28:42 -04:00
Arcturus Arcturus
5d32ce320b FetchContent: Use private local variables in FetchContent_MakeAvailable 2021-05-13 13:52:16 +01:00
Brad King
db8e0beeac cmGlobalNinjaGenerator: Clarify semantics of Fortran scanning info
Use `optional<>` instead of `unique_ptr<>` to hold optional value.
2021-05-13 08:33:04 -04:00
Brad King
bd12b97d05 cmScanDepFormat: Drop unused "outputs", "inputs", and "depends" fields
These fields are specified by our `P1689r3` paper, but are not actually
needed.  The dependencies of the scanning results themselves can be
captured via normal depfile logic.  Avoid saving this possibly-large
information in the scanning results.  It is not needed by later steps.
2021-05-13 08:33:00 -04:00
Brad King
96011ab06d Merge topic 'find_item-consistent-behavior-cache-variables'
08db1341a6 find_*: ensure consistent behavior for cache variables
f5fa6d53b0 class cmake: Store working directory at cmake launch
b1729200c3 find_*: refactor cache variable handling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6110
2021-05-13 08:12:36 -04:00
Brad King
414704e895 Merge topic 'ninja-fortran-symlink' into release-3.20
3a71534402 Ninja: Restore support for Fortran in a symlinked build tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6120
2021-05-13 08:11:25 -04:00
Brad King
3a254019ca Merge branch 'release-3.20' 2021-05-13 08:11:25 -04:00
Brad King
da6fd5842d Merge topic 'ninja-fortran-symlink'
3a71534402 Ninja: Restore support for Fortran in a symlinked build tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6120
2021-05-13 08:11:25 -04:00