`cmake_path(GET "foo/.." STEM out)` is supposed to set `out` to `".."`,
the entire `cmake_path(GET "foo/.." FILENAME)` result.
However, the `GetNarrowStem()` logic in `cmCMakePath` was lacking
the `.` and `..` special-casing logic present in other methods.
As a result, it would erroneously trim the second `.` off of a stem
of `..` and return only `.`.
This caused the result of `cmake_path(GET "foo/.." STEM)` to be `"."`.
Making the standard empty-or-.-or-.. checks and bailing out early
fixes the result of `cmCMakePaths{".."}.GetNarrowStem()`.
Fixes: #26235
ceeea4e511 cmake_parse_arguments: Set variable if empty string given after keyword
2f5cc6afa1 cmParseArgumentsCommand: Use cmStrCat() for string concatenation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9748
If a single-value keyword is followed by an empty string, the
command unsets the variable for that keyword instead of setting
it to the empty string. This is inconsistent and unexpected. Add
policy CMP0174 which ensures the variable for a single-value
keyword is always set when any value is given, not just for a
non-empty value.
The new CMP0174 policy only affects the PARSE_ARGV form of
cmake_parse_arguments. The older form silently drops all empty
string arguments before processing the argument list.
Fixes: #25972
8d1803d463 AutoGen: Run batch scripts using cmd.exe on windows platforms explicitly
9ab270f47d cmSystemTools: Add GetComspec method to get cmd on Windows
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9733
The CreateProcessW function requires to use the cmd.exe when
attempting to execute batch scripts. AutoMoc RunProcess relies on
CreateProcessW in it's internals. Currently the cmd.exe run happens
implicitly for batch files(perhaps by luck), but this is not
documented anywhere.
This replaces the .bat files in the AutoGen related command lines with
explicit 'cmd.exe /c' call. Also 'cmd.exe /c' has own limitation
related to the arguments. The very first argument shouldn't be quoted
otherwise this lead to the parsing issues. So for the .bat files that
contain spaces in their paths use short name conversion.
Fixes#26208
The function attempts to read the path to cmd executable from the
COMSPEC environment variable. Falls back to cmd.exe if the respective
environment variable is not set or path doesn't exist.
The call is unnecessary since commit 438809d3ba (cmCPackGenerator: Add
option to FindTemplate to use alternate builtin path, 2024-03-06,
v3.30.0-rc1~353^2~4).
"Console" unexpectedly matches the reserved name regex. This revealed
that `cmCPackNSISGenerator::CreateComponentDescription()` needs to use
the name returned by `GetSanitizedDirOrFileName()` for the component
file glob.
Fix the change from commit a1af593291 (CPack: Support arbitrary
component name when packaging, 2024-05-01, v3.30.0-rc1~151^2~1) to
address these issues and add related checks to the `CPackNSISGenerator`
test case.
Issue: #23612
When a library file name is encountered multiple times, reuse the result
from the first time. This more closely matches the behavior of the
dynamic loader on Linux.
Fixes: #24621
And use it in the `cmCMakePresetsGraphReadJSON.cxx` to check
presets schema version in the declarative way.
Co-authored-by: Martin Duffy <martin.duffy@kitware.com>
The check added by commit 40af103402 (cmCMakePath: do not use
std::filesystem::path with RH gcc-toolset-10, 2023-12-02, v3.28.0~5^2)
fails unnecessarily in some cases due to not inheriting
`std::string_view` publicly.
Inheritance into a class is private by default, and this std class has
public members that would be access restricted when used to create
public objects in the current scope.
On some versions of GCC, depending on standards options, this causes
either template instantiation errors, or "inaccessible base" or "not
declared" errors.
Fix by setting the inheritance to public. This does not affect the
intention of the previous fix because the check still fails when using
gcc-toolset-10's standard library with clang.
Issue: #25458, #25453