CMake compile from source vs find_package

Viewed 154

Let's assume I have a shared library A and a shared library B. I have sources for both and both are CMake-aware. A is vendor-provided and B is mine.

Case 1: Install and build on Windows

I can install A on the system and use find_package(A) in B/CMakeLists.txt. Works fine.

Case 2: Build from source for another platform, but from Windows

I want to recompile everything from source for some other ABI (use case: I want to recompile the library A and B for Android). Now a call to include(B/CMakeLists.txt) would make more sense so that I can pick up the source and compile it using Android Studio.

However A/CMakeLists.txt contains now a call to find_package(B), which breaks the CMake build.

So I guess my question here is "What did I miss in a typical CMake workflow ?".

I know I can use flags and conditions for MSVC and Android, but I have the feeling I'm missing the bigger picture.

0 Answers
Related