From 22aad9bfd916b48ea809c1c35e6bff9b505f60e5 Mon Sep 17 00:00:00 2001 From: loonghao Date: Wed, 18 Oct 2023 15:34:19 +0800 Subject: [PATCH] Fix CMake build in Windows for `CMAKE_MODULE_PATH` force to use "/" Signed-off-by: loonghao --- src/rezplugins/shell/_utils/powershell_base.py | 3 +++ src/rezplugins/shell/cmd.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/rezplugins/shell/_utils/powershell_base.py b/src/rezplugins/shell/_utils/powershell_base.py index 18759d102..62cb27516 100644 --- a/src/rezplugins/shell/_utils/powershell_base.py +++ b/src/rezplugins/shell/_utils/powershell_base.py @@ -256,6 +256,9 @@ def shebang(self): def setenv(self, key, value): value = self.escape_string(value, is_path=self._is_pathed_key(key)) + if platform_.name == "windows" and key == "CMAKE_MODULE_PATH": + # Fix CMake build in Windows for `CMAKE_MODULE_PATH` force to use "/" + value = value.replace("\\", "/") self._addline('Set-Item -Path "Env:{0}" -Value "{1}"'.format(key, value)) def prependenv(self, key, value): diff --git a/src/rezplugins/shell/cmd.py b/src/rezplugins/shell/cmd.py index c3afdcc01..5cd121a95 100644 --- a/src/rezplugins/shell/cmd.py +++ b/src/rezplugins/shell/cmd.py @@ -255,6 +255,9 @@ def shebang(self): def setenv(self, key, value): value = self.escape_string(value, is_path=self._is_pathed_key(key)) + if key == "CMAKE_MODULE_PATH": + # Fix CMake build in Windows for `CMAKE_MODULE_PATH` force to use "/" + value = value.replace("\\", "/") self._addline('set %s=%s' % (key, value)) def unsetenv(self, key):