Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cmaketoolchain error when output folder in different Win drive #13248

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions conan/tools/cmake/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,11 @@ def _save_cmake_user_presets(conanfile, preset_path, user_presets_path, preset_p
data = _append_user_preset_path(conanfile, data, preset_path)

data = json.dumps(data, indent=4)
relpath = os.path.relpath(user_presets_path, conanfile.generators_folder)
ConanOutput(str(conanfile)).info(f"CMakeToolchain generated: {relpath}")
try:
presets_path = os.path.relpath(user_presets_path, conanfile.generators_folder)
except ValueError: # in Windows this fails if in another drive
presets_path = user_presets_path
ConanOutput(str(conanfile)).info(f"CMakeToolchain generated: {presets_path}")
save(user_presets_path, data)


Expand Down