[geos-devel] CMake, with GEOS as a dependency of a project
Mateusz Loskot
mateusz at loskot.net
Sun Feb 21 12:14:01 EST 2010
Gavin Heavyside wrote:
> 2010/2/21 Mateusz Loskot <mateusz at loskot.net>
>
>> Gavin Heavyside wrote:
>>> This means that GEOS will be built whenever a binary from my main project
>>> specifies GEOS as a dependency. I use this technique successfully with
>>> boost, googlemock and others.
>> Gavin, interesting idea.
>
> It works well for me, as I build projects on multiple machines with
> different architectures, and building dependencies as part of the project
> means I can upgrade dependencies or change their configuration in a single
> place. The strategy is the one described in the boost CMake docs:
>
> http://sodium.resophonic.com/boost-cmake/current-docs/exported_targets.html#with-boost-source-in-a-subdirectory-of-your-source
I use the Troy's ideas for Boost quite often but I have missed this
trick. Thanks.
> As I've investigated further, there are a couple more places that need
> changing:
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 21a6c50..020dc3b 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -206,13 +206,13 @@ endif()
> #################################################################################
>
> # for including GEOS C++ API headers
> -include_directories(${CMAKE_SOURCE_DIR}/include)
> +include_directories(${geos_SOURCE_DIR}/include)
>
> # for including build-specific GEOS C API headers
> -include_directories(${CMAKE_BINARY_DIR}/capi)
> +include_directories(${geos_BINARY_DIR}/capi)
>
> # for including build-specific version.h, platform.h and geos_c.h
> -include_directories(${CMAKE_BINARY_DIR}/include)
> +include_directories(${geos_BINARY_DIR}/include)
>
> #################################################################################
> # Setup checks and generate config headers
Applied to trunk. Thanks!
By the way, I'm going to hack 'make uninstall' target soon.
I know general CMake approaches for this but perhaps you would
have some helpful tricks how to do it neatly for GEOS?
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
More information about the geos-devel
mailing list