Skip to content

Commit

Permalink
Bugfix: Fix ROSEnv quotes for CMAKE_TOOLCHAIN_FILE var (#17270)
Browse files Browse the repository at this point in the history
* fix quotes

* fix test

* check file content too

* Update test/integration/tools/ros/test_rosenv.py

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

---------

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
  • Loading branch information
danimtb and czoido authored Nov 4, 2024
1 parent dba212f commit e077183
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conan/tools/ros/rosenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ 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
Expand Down
7 changes: 5 additions & 2 deletions test/integration/tools/ros/test_rosenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit e077183

Please sign in to comment.