From 4a5b19a75db9225316c8cb022a2dfb9705a2af34 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Nov 2024 14:05:43 +0100 Subject: [PATCH] Bugfix: Fix ROSEnv quotes for CMAKE_TOOLCHAIN_FILE var (#17270) * fix quotes * fix test * check file content too * Update test/integration/tools/ros/test_rosenv.py Co-authored-by: Carlos Zoido --------- Co-authored-by: Carlos Zoido --- conan/tools/ros/rosenv.py | 2 +- test/integration/tools/ros/test_rosenv.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/conan/tools/ros/rosenv.py b/conan/tools/ros/rosenv.py index 5a6eb644bcf..4115e780b1b 100644 --- a/conan/tools/ros/rosenv.py +++ b/conan/tools/ros/rosenv.py @@ -23,7 +23,7 @@ def __init__(self, conanfile): def generate(self): cmake_toolchain_path = os.path.join(self._conanfile.generators_folder, "conan_toolchain.cmake") - self.variables["CMAKE_TOOLCHAIN_FILE"] = f"\"{cmake_toolchain_path}\"" + self.variables["CMAKE_TOOLCHAIN_FILE"] = cmake_toolchain_path build_type = self._conanfile.settings.get_safe("build_type") if build_type: self.variables["CMAKE_BUILD_TYPE"] = build_type diff --git a/test/integration/tools/ros/test_rosenv.py b/test/integration/tools/ros/test_rosenv.py index 2865fb6c431..987558edc1e 100644 --- a/test/integration/tools/ros/test_rosenv.py +++ b/test/integration/tools/ros/test_rosenv.py @@ -32,9 +32,12 @@ def test_rosenv(): assert os.path.exists(conanrosenv_path) conanrosenvbuild_path = os.path.join(install_folder, "conanrosenv-build.sh") assert os.path.exists(conanrosenvbuild_path) - client.run_command(f". \"{conanrosenv_path}\" && env") toolchain_path = os.path.join(client.current_folder, "install", "conan", "conan_toolchain.cmake") - assert f"CMAKE_TOOLCHAIN_FILE=\"{toolchain_path}\"" in client.out + content = client.load(conanrosenvbuild_path) + assert f'CMAKE_TOOLCHAIN_FILE="{toolchain_path}"' in content + assert 'CMAKE_BUILD_TYPE="Release"' in content + client.run_command(f'. "{conanrosenv_path}" && env') + assert f"CMAKE_TOOLCHAIN_FILE={toolchain_path}" in client.out assert "CMAKE_BUILD_TYPE=Release" in client.out