Hi, I build targets with different possible build types:
- Debug (with my own flags)
- Release (with my own flags)
- Custom, with a given name
I observed the following behavior, which, as far as I understand, is the default CMake one.
Let say I have a target A which is a static library and a target B that is an application, linking A.
If I build and install A in Debug with a proper configuration file, I get a ATargets-debug.cmake file, that references /Debug/libA.a.
Now I build B in Release, using find_package(A) in my CMakeLists.txt.
B, compiled in Release, gets linked with A compiled in Debug, which I’d like not to.
Actually I stumbled on that from an error I got when I had deleted /Debug/libA.a but forgot to delete also ATargets-debug.cmake. Even if /Release/libA.a exists, I cannot configure for B anymore as the find_package is looking for /Release/libA.a AND /Debug/libA.a.
Thus my question is: is there a way, when using find_package to look only for the exact same build type? (based solely on its name, for simplification)?
(NB I exhumed an old question slightly related to the subject: find_package and build configuration).
Regards,
A.