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

Location of children's artifacts, copying artifacts, etc #14

Open
SteffenL opened this issue Aug 4, 2015 · 0 comments
Open

Location of children's artifacts, copying artifacts, etc #14

SteffenL opened this issue Aug 4, 2015 · 0 comments

Comments

@SteffenL
Copy link

SteffenL commented Aug 4, 2015

What is the proper way to gather source files and generated artifacts (*.dll, *.lib, etc) from CPM modules my top-level CMake project depends on?

Due to the way CPM organizes source repositories and artifacts, it seems to be a bit difficult to reliably do things like copy *.dll files to where my main executable resides (for easier debugging, packaging, etc).

Some examples:

  • My top-level CMake project (main product) depends on a shared library generated by a child (CPM module), which must be bundled with the product when released.
  • The linker input file (*.lib) and source header files for the same shared library must also be released independently for use by third parties.

I have seen some solutions for CMake which involves...

  • Setting CMAKE_RUNTIME_OUTPUT_DIRECTORY in the parent; however, CPM overrides it.
  • Setting the same variable in the CPM modules; the result is the same.

My next idea was to set a cached variable in each child, e.g. something like this:

set(${CPM_MODULE_NAME}_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" CACHE INTERNAL "")

My issues with this approach are:

  1. The desired path differs depending on whether there is a single or there are multiple possible build types (debug, release, etc) (Visual Studio).
  2. This only works for modules I created/modified myself.
  3. I would actually prefer each module/child to be as ignorant as possible about all this.

Thank you for any assistance you can provide!

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

1 participant