mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-07 00:00:57 +00:00
cmake: Restore normalization of -P script to on-disk path
This was missed in commitee83165923(cmake: Explicitly normalize input paths as they exist on disk, 2024-10-17, v4.0.0-rc1~597^2), causing `CMAKE_CURRENT_LIST_FILE` in `cmake -P` scripts to be regressed by the KWSys behavior change merged by commite9bd437a43(Merge branch 'upstream-KWSys' into normalize-input-paths, 2024-10-24, v4.0.0-rc1~589^2~1). Issue: #27750
This commit is contained in:
@@ -661,7 +661,7 @@ bool cmake::SetCacheArgs(std::vector<std::string> const& args)
|
||||
state->SetWorkingMode(SCRIPT_MODE);
|
||||
state->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
|
||||
state->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
|
||||
state->ReadListFile(args, path);
|
||||
state->ReadListFile(args, cmSystemTools::ToNormalizedPathOnDisk(path));
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -802,7 +802,7 @@ void cmake::ReadListFile(std::vector<std::string> const& args,
|
||||
snapshot.SetDefaultDefinitions();
|
||||
cmMakefile mf(gg, snapshot);
|
||||
if (this->GetWorkingMode() != NORMAL_MODE) {
|
||||
mf.SetScriptModeFile(cmSystemTools::ToNormalizedPathOnDisk(path));
|
||||
mf.SetScriptModeFile(path);
|
||||
mf.SetArgcArgv(args);
|
||||
}
|
||||
if (!cmSystemTools::FileExists(path, true)) {
|
||||
|
||||
2
Tests/RunCMake/CommandLine/P_PathOnDisk-stdout.txt
Normal file
2
Tests/RunCMake/CommandLine/P_PathOnDisk-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
^-- CMAKE_SCRIPT_MODE_FILE='[^']*/Tests/RunCMake/CommandLine/P_PathOnDisk.cmake'
|
||||
-- CMAKE_CURRENT_LIST_FILE='[^']*/Tests/RunCMake/CommandLine/P_PathOnDisk.cmake'$
|
||||
2
Tests/RunCMake/CommandLine/P_PathOnDisk.cmake
Normal file
2
Tests/RunCMake/CommandLine/P_PathOnDisk.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
message(STATUS "CMAKE_SCRIPT_MODE_FILE='${CMAKE_SCRIPT_MODE_FILE}'")
|
||||
message(STATUS "CMAKE_CURRENT_LIST_FILE='${CMAKE_CURRENT_LIST_FILE}'")
|
||||
@@ -1,2 +1,4 @@
|
||||
^CMake Error: Not a file: nosuchscriptfile.cmake
|
||||
CMake Error: Error processing file: nosuchscriptfile.cmake$
|
||||
^CMake Error: Not a file: [^
|
||||
]*/Tests/RunCMake/CommandLine/P_no-file-build/nosuchscriptfile.cmake
|
||||
CMake Error: Error processing file: [^
|
||||
]*/Tests/RunCMake/CommandLine/P_no-file-build/nosuchscriptfile.cmake$
|
||||
|
||||
@@ -70,6 +70,12 @@ run_cmake_command(P_P_in_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_D
|
||||
run_cmake_command(P_P_in_arbitrary_args_2 ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -P -o)
|
||||
run_cmake_command(P_fresh ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_fresh.cmake" --fresh)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
run_cmake_command(P_PathOnDisk ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/../CommandLine/P_pathondisk.cmake")
|
||||
else()
|
||||
run_cmake_command(P_PathOnDisk ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/../CommandLine/P_PathOnDisk.cmake")
|
||||
endif()
|
||||
|
||||
run_cmake_command(build-no-dir
|
||||
${CMAKE_COMMAND} --build)
|
||||
run_cmake_command(build-no-dir2
|
||||
|
||||
Reference in New Issue
Block a user