[cmake-developers] Kind-of standard way to support also in-project find-modules
Pau Garcia i Quiles
pgquiles at elpauer.org
Tue Jan 11 18:13:31 EST 2011
On Tue, Jan 11, 2011 at 11:55 PM, Brad King <brad.king at kitware.com> wrote:
> Typically we use code of this form:
>
> if(FOO_USE_SYSTEM_BAR)
> find_package(BAR)
> else()
> add_subdirectory(bar)
> set(BAR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/bar/include)
> set(BAR_LIBRARY_DIRS ...)
> # ...set rest of variables normally provided by FindBAR.cmake
> endif()
What about something like this?
if( FOO_USE_LOCAL_BAR)
set( CMAKE_PREFIX_PATH ${PROJECT_SOURCE_DIR}/3rdparty )
endif(FOO_USE_LOCAL_BAR)
find_package(BAR)
It searches the local directory first, then goes for system. Looks easier to me.
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
More information about the cmake-developers
mailing list