cpm-cmake / CPM.cmake

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Packages depending on BuildType

DNKpp opened this issue · 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

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