[CMake] Running find_package after dependencies are built

Olaf Ryder devbits01 at gmail.com
Fri Oct 18 07:34:51 EDT 2013


Here's the problem I'm trying to solve:

* External Project A has no dependencies and generates LibraryA
* External Project B is dependent on LibraryA

Root CMakeLists.txt:
add_subdirectory(external_project_a)
add_subdirectory(external_project_b)

External Project A CMakeLists.txt:
ExternalProject_Add(projectA ...)

External Project B CMakeLists.txt:
find_package(LibraryA)
ExternalProject_Add(projectB ...)


When I configure CMake, it finds an old, locally installed version of
LibraryA. When cross-compiling, I want External Project B's
find_package(LibraryA) to find the newly cross-compiled LibraryA.

It feels like I need to somehow "run find_package again" at that point so
it finds the right one. Right now I can manually make it work by
building/installing External Project A then manually clearing my build
folder and re-running CMake.

How do I get External Project B to see the new cross-compiled LibraryA?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131018/16e6dda9/attachment.htm>


More information about the CMake mailing list