Skip to content

Commit

Permalink
add vs_debugger info to incubating CMakeDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Jan 10, 2025
1 parent b4936c2 commit ca8cd7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion conan/tools/cmake/cmakedeps2/cmakedeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def generate(self):
{% endfor %}
{% if host_runtime_dirs %}
set(CONAN_RUNTIME_LIB_DIRS {{ host_runtime_dirs }} )
# Only for VS, needs CMake>=3.27
set(CMAKE_VS_DEBUGGER_ENVIRONMENT "PATH=${CONAN_RUNTIME_LIB_DIRS};%PATH%")
{% endif %}
{% if cmake_program_path %}
list(PREPEND CMAKE_PROGRAM_PATH {{ cmake_program_path }})
Expand Down Expand Up @@ -250,7 +252,10 @@ def _get_host_runtime_dirs(self):
host_runtime_dirs.setdefault(config, []).append(paths)

is_win = self._conanfile.settings.get_safe("os") == "Windows"
for req in self._conanfile.dependencies.host.values():

host_req = self._conanfile.dependencies.host
test_req = self._conanfile.dependencies.test
for req in list(host_req.values()) + list(test_req.values()):
config = req.settings.get_safe("build_type", self._cmakedeps.configuration)
aggregated_cppinfo = req.cpp_info.aggregated_components()
runtime_dirs = aggregated_cppinfo.bindirs if is_win else aggregated_cppinfo.libdirs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def test_runtime_lib_dirs_multiconf(self):
runtime_lib_dirs = re.search(pattern_lib_dirs, contents).group(1)
assert "<CONFIG:Release>" in runtime_lib_dirs
assert "<CONFIG:Debug>" in runtime_lib_dirs
# too simple of a check, but this is impossible to test automatically
assert "set(CMAKE_VS_DEBUGGER_ENVIRONMENT" in contents


@pytest.mark.tool("cmake")
Expand Down

0 comments on commit ca8cd7f

Please sign in to comment.