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

Hotfix/cmaketoolchain fulldeploy #16434

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion conan/tools/cmake/toolchain/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ def _get_host_runtime_dirs(self, host_req):
return host_runtime_dirs

def _join_paths(self, paths):
paths = [relativize_path(p, self._conanfile, "${CMAKE_CURRENT_LIST_DIR}") for p in paths]
paths = [p.replace('\\', '/').replace('$', '\\$').replace('"', '\\"') for p in paths]
paths = [relativize_path(p, self._conanfile, "${CMAKE_CURRENT_LIST_DIR}") for p in paths]
czoido marked this conversation as resolved.
Show resolved Hide resolved
return " ".join([f'"{p}"' for p in paths])

def context(self):
Expand Down
16 changes: 16 additions & 0 deletions test/integration/toolchains/cmake/test_cmaketoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@ def layout(self):
presets = json.loads(c.load(user_presets["include"][0]))
assert os.path.isabs(presets["configurePresets"][0]["toolchainFile"])


def test_output_dirs_gnudirs_local_default():
# https://github.com/conan-io/conan/issues/14733
c = TestClient()
Expand Down Expand Up @@ -1630,3 +1631,18 @@ def test_toolchain_extra_variables():
toolchain = client.load("conan_toolchain.cmake")
assert 'set(CACHE_VAR_DEFAULT_DOC "hello world" CACHE PATH "CACHE_VAR_DEFAULT_DOC")' in toolchain


def test_variables_wrong_scaping():
# https://github.com/conan-io/conan/issues/16432
c = TestClient()
c.save({"tool/conanfile.py": GenConanfile("tool", "0.1"),
"pkg/conanfile.txt": "[tool_requires]\ntool/0.1\n[generators]\nCMakeToolchain"})
c.run("create tool")
c.run("install pkg")
toolchain = c.load("pkg/conan_toolchain.cmake")
cache_folder = c.cache_folder.replace("\\", "/")
assert f'list(PREPEND CMAKE_PROGRAM_PATH "{cache_folder}' in toolchain

c.run("install pkg --deployer=full_deploy")
toolchain = c.load("pkg/conan_toolchain.cmake")
assert 'list(PREPEND CMAKE_PROGRAM_PATH "${CMAKE_CURRENT_LIST_DIR}/full_deploy' in toolchain