[geos-devel] CMake, with GEOS as a dependency of a project
Mateusz Loskot
mateusz at loskot.net
Sun Feb 21 09:51:49 EST 2010
Gavin Heavyside wrote:
> I like to build dependencies of my projects as subprojects using CMake.
> To
> do this for GEOS I do the following from my main project CMakeLists.txt:
>
> # GEOS
> set(GEOS_ENABLE_TESTS off CACHE INTERNAL "")
> add_subdirectory(vendor/osgeo/geos EXCLUDE_FROM_ALL)
>
> 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.
> For this to work properly, the subproject CMake configuration must not
> assume that its directory is also the global project root. The following
> patch makes building as a subproject work correctly, and to the best of my
> knowledge does not alter the behaviour when building GEOS in isolation.
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index ec589e7..21a6c50 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -19,7 +19,7 @@ if(NOT CMAKE_VERSION)
> endif()
>
> # Location of custom CMake modules with macros used by GEOS
> -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
> +set(CMAKE_MODULE_PATH "${geos_SOURCE_DIR}/cmake/modules")
Applied to trunk, thanks!
http://trac.osgeo.org/geos/changeset/2916
Best regards,
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the geos-devel
mailing list