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

CMakeToolchain: implement vs debugger path #15830

Conversation

jcar87
Copy link
Contributor

@jcar87 jcar87 commented Mar 7, 2024

Changelog: Feature: Set CMAKE_VS_DEBUGGER_ENVIRONMENT from CMakeToolchain to point to all binary directories when using Visual Studio. This negates the need to copy DLLs to launch executables from the Visual Studio IDE (requires CMake 3.27 or newer).

Docs: conan-io/docs#3639

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great

conan/tools/cmake/toolchain/blocks.py Outdated Show resolved Hide resolved
conan/tools/cmake/toolchain/blocks.py Outdated Show resolved Hide resolved
Comment on lines 140 to 147
if os.path.exists(CONAN_TOOLCHAIN_FILENAME):
existing_include = load(CONAN_TOOLCHAIN_FILENAME)
vs_debugger_environment = re.search(r"set\(CMAKE_VS_DEBUGGER_ENVIRONMENT \"PATH=([^)]*)>;%PATH%\"\)",
existing_include)
if vs_debugger_environment:
capture = vs_debugger_environment.group(1)
matches = re.findall(r"\$<\$<CONFIG:([A-Za-z]*)>:(.*)", capture)
config_dict = dict(matches)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part we might want to refactor, but that might be done later in another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the string generation from the jinja, and into python, although still very tricky to get right with the regexes. Fixed some issues when we have more than 2 configs, so it should be more robust.

IN a later PR I have some ideas for how to support multiconfig in a more straightforward way

@jcar87 jcar87 marked this pull request as ready for review March 8, 2024 12:21
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, but tests are not passing, please check.

@memsharded memsharded added this to the 2.2.0 milestone Mar 12, 2024
@memsharded memsharded self-assigned this Mar 12, 2024
Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😁 I'm only missing a test checking when the VS variable is not appearing.

conan/tools/cmake/toolchain/blocks.py Show resolved Hide resolved
conan/tools/cmake/toolchain/blocks.py Outdated Show resolved Hide resolved
@memsharded memsharded merged commit df77297 into conan-io:develop2 Mar 12, 2024
2 checks passed
@memsharded memsharded changed the title [WIP] CMakeToolchain: implement vs debugger path CMakeToolchain: implement vs debugger path Mar 12, 2024
@jcar87 jcar87 deleted the lcc/feature/vs-debugger-environment-cmake-toolchain branch March 12, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants