From c1609c2408a55df1c2161dc2c9d90393b6f5d500 Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 23 Nov 2024 22:24:34 +0800 Subject: [PATCH 1/2] Improve cmake & ninja cpoy pdb --- xmake/modules/package/tools/cmake.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 04f6dabc010..fcd35ad6869 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -471,9 +471,15 @@ function _get_configs_for_windows(package, configs, opt) elseif package:has_runtime("MDd") then table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL") end + + local pdb_dir = path.unix(path.join(os.curdir(), "pdb")) if not opt._configs_str:find("CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY") then - table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=pdb") + table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=" .. pdb_dir) + end + if not opt._configs_str:find("CMAKE_PDB_OUTPUT_DIRECTORY") then + table.insert(configs, "-DCMAKE_PDB_OUTPUT_DIRECTORY=" .. pdb_dir) end + if package:is_cross() then _get_configs_for_cross(package, configs, opt) else From b2930435d1cda1d4ae3115fdd5ce354828eadc21 Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 23 Nov 2024 22:41:48 +0800 Subject: [PATCH 2/2] improve find string --- xmake/modules/package/tools/cmake.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index fcd35ad6869..ca01fe11ae0 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -473,10 +473,10 @@ function _get_configs_for_windows(package, configs, opt) end local pdb_dir = path.unix(path.join(os.curdir(), "pdb")) - if not opt._configs_str:find("CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY") then + if not opt._configs_str:find("CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY", 1, true) then table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=" .. pdb_dir) end - if not opt._configs_str:find("CMAKE_PDB_OUTPUT_DIRECTORY") then + if not opt._configs_str:find("CMAKE_PDB_OUTPUT_DIRECTORY", 1, true) then table.insert(configs, "-DCMAKE_PDB_OUTPUT_DIRECTORY=" .. pdb_dir) end