Преглед на файлове

Merge topic 'backport-4.0-cmake-P-script-case' into release-4.0

a3358bb66a cmake: Restore normalization of `-P` script to on-disk path

Acked-by: Kitware Robot <[email protected]>
Merge-request: !11930
Brad King преди 1 ден
родител
ревизия
6cc7d52bc6

+ 2 - 2
Source/cmake.cxx

@@ -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 - 0
Tests/RunCMake/CommandLine/P_PathOnDisk-stdout.txt

@@ -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 - 0
Tests/RunCMake/CommandLine/P_PathOnDisk.cmake

@@ -0,0 +1,2 @@
+message(STATUS "CMAKE_SCRIPT_MODE_FILE='${CMAKE_SCRIPT_MODE_FILE}'")
+message(STATUS "CMAKE_CURRENT_LIST_FILE='${CMAKE_CURRENT_LIST_FILE}'")

+ 4 - 2
Tests/RunCMake/CommandLine/P_no-file-stderr.txt

@@ -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$

+ 6 - 0
Tests/RunCMake/CommandLine/RunCMakeTest.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