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

Using FetchContent for Workspace meta-project #17665

Open
memsharded opened this issue Jan 29, 2025 · 1 comment · May be fixed by #17675
Open

Using FetchContent for Workspace meta-project #17665

memsharded opened this issue Jan 29, 2025 · 1 comment · May be fixed by #17675

Comments

@memsharded
Copy link
Member

Originally posted by @mattangus in #15992

I am experimenting with the suggestion by @mattangus in this ticket, it is looking promising, a couple of quick comments:

  • The internal target names are not that common to be the same as the exported/installed ones. I am not even sure this is a CMake recommended practice, so it is likely we cannot rely strictly on this. What could be a good way do define such aliases somewhere, so they are injected dynamically.
  • For external dependencies, it is necessary to do a conan install first for one of the products, then pass the toolchain to the cmake command, so the generated ZLIB-config.cmake is found. But this file can be generated differently per sub-project, this is a bit uncertain how it will work together.
  • Not very clear why you comment that it is necessary to set_target_properties(project2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}), for me it works without it.

So the initial challenges to focus are:

  • Definition of alias for compatibility
  • Definition of paths for different subprojects to locate their dependencies (the xxx-config.cmake files can be different)
  • Definition and usage of a toolchain file if necessary
@memsharded
Copy link
Member Author

Some very early stage poc: #17675

# create an external dependency to the workspace first
mkdir myproj && cd myproj
conan new cmake_lib -d name=mymath
conan create .
rm -rf *

# now the actual workspace
conan new  workspace -d requires=mymath/0.1
conan workspace install
cmake --preset conan-default # conan-release in Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant