CPM.cmake icon indicating copy to clipboard operation
CPM.cmake copied to clipboard

Add Packages depending on BuildType

Open DNKpp opened this issue 2 years ago • 1 comments

Hey, I'm currently trying to add Open3D's pre-built packages into my project. They come as several individual packages (differ mainly in platform and build type). Each of these come with its own proper cmake Config files and they all declare the target Open3D::Open3D, thus simply adding all of them and reference the desired one via GeneratorExpression doesn't seem to work here.

I would like to link the debug package into my debug build and the release package into the release build. The straight forward way would be to use a if/else setup, checking for CMAKE_BUILD_TYPE, but that seems like an improper solution as this won't work for multi-config environments.

Is there anything cpm can do for me here? Or does a proper solution in vanilla cmake already exist?

For the reference: I'm using a package-lock file and thus add the packages via CPMGetPackage

DNKpp avatar Feb 13 '23 13:02 DNKpp

Thanks for the issue! Unfortunately I don't know enough about multi-config builds to understand if or how CPM could help out here.

TheLartians avatar Feb 19 '23 14:02 TheLartians