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

[bug] conan_toolchain.cmake in 2.4.0 incorrectly escapes cmake variables #16432

Closed
sykhro opened this issue Jun 7, 2024 · 6 comments
Closed
Assignees
Milestone

Comments

@sykhro
Copy link

sykhro commented Jun 7, 2024

Describe the bug

OS: Windows 11
Conan version: 2.4.0, doesn't happen on 2.3.2

The generated conan_toolchain.cmake incorrectly escapes CMake variables leading to failures in find_program() and others.

2.4.0:

list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR} )
list(PREPEND CMAKE_PROGRAM_PATH "\${CMAKE_CURRENT_LIST_DIR}/full_deploy/build/flatbuffers/24.3.25/Release/x86_64/bin")
list(PREPEND CMAKE_LIBRARY_PATH "\${CMAKE_CURRENT_LIST_DIR}/full_deploy/host/flatbuffers/24.3.25/Release/x86_64/lib")

2.3.2:

list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR} )
list(PREPEND CMAKE_PROGRAM_PATH "${CMAKE_CURRENT_LIST_DIR}/full_deploy/build/flatbuffers/24.3.25/Release/x86_64/bin")
list(PREPEND CMAKE_LIBRARY_PATH "${CMAKE_CURRENT_LIST_DIR}/full_deploy/host/flatbuffers/24.3.25/Release/x86_64/lib" )

How to reproduce it

  1. Example conanfile:
    requires = [
        "flatbuffers/24.3.25@gamemaker/externals",
    ]
    tool_requires = [
        "flatbuffers/24.3.25",
    ]

    def generate(self):
        cd = CMakeDeps(self)
        cd.build_context_activated = ["flatbuffers"]
        cd.build_context_build_modules = ["flatbuffers"]
        cd.build_context_suffix = {"flatbuffers": "_BUILD"}
        cd.generate()

        tc = CMakeToolchain(self)
        tc.blocks.select("find_paths", "rpath", "shared")
        tc.user_presets_path = ""
        tc.generate()
  1. conan install conanfile.py --deployer full_deploy --output-folder out
  2. Cross-compile with CMake, observe that find_program() fails because CMAKE_PREFIX_PATH doesn't resolve to the bin folder of flatbuffers
@memsharded memsharded added this to the 2.4.1 milestone Jun 7, 2024
@memsharded memsharded self-assigned this Jun 7, 2024
@memsharded
Copy link
Member

Thanks for the report @sykhro

Are you sure this happens with conan install .? I see full_deploy in the paths, which implies that at least the --deployer=full_deploy was used?

@sykhro
Copy link
Author

sykhro commented Jun 7, 2024

Thanks for the report @sykhro

Are you sure this happens with conan install .? I see full_deploy in the paths, which implies that at least the --deployer=full_deploy was used?

Ah yes, sorry, let me correct the command

@memsharded
Copy link
Member

Thanks again for the report, and sorry for the regression, it was indeed a side issue of some bugfix around the relativization of paths for deployers in CMakeToolchain.

I have submitted a fix in #16434, for next Conan 2.4.1 patch release, in case you want to give a try from source.

@sykhro
Copy link
Author

sykhro commented Jun 7, 2024

Thanks again for the report, and sorry for the regression, it was indeed a side issue of some bugfix around the relativization of paths for deployers in CMakeToolchain.

No worries, I always test releases before rolling them out company-wide as a way to contribute back (in terms of QA? dunno!) :)

I have submitted a fix in #16434, for next Conan 2.4.1 patch release, in case you want to give a try from source

Haven't done this in a while, are the setup instructions in readme still good?

@memsharded
Copy link
Member

No worries, I always test releases before rolling them out company-wide as a way to contribute back (in terms of QA? dunno!) :)

Excellent

Haven't done this in a while, are the setup instructions in readme still good?

Yes, that hasn't been changed in a while, pip install -e . should be mostly it, so add my memsharded remote, git fetch and checkout my branch, then pip install -e . (recommended in a virtualenv) would make conan ... to run from the checked-out branch in that source.

@czoido
Copy link
Contributor

czoido commented Jun 10, 2024

Closed by #16434 thanks a lot for reporting. It will be released in Conan 2.4.1 today.

@czoido czoido closed this as completed Jun 10, 2024
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

No branches or pull requests

3 participants