An open API service indexing awesome lists of open source software.

https://github.com/sarcasm/cmake-superbuild

CMake SuperBuild template using External_Projects
https://github.com/sarcasm/cmake-superbuild

Last synced: 9 months ago
JSON representation

CMake SuperBuild template using External_Projects

Awesome Lists containing this project

README

          

cmake-superbuild
================

CMake SuperBuild template using External_Projects

How does it work?
-----------------

The top-level CMakeLists.txt works in a has 2 stages:

1. `USE_SUPERBUILD=ON` [the default]: Deleguates the generation to
SuperBuild.cmake which will download and build the dependencies and then
re-invoke the top-level CMakeLists.txt but this time with `USE_SUPERBUILD`
set to `OFF`.

2. This step, when `USE_SUPERBUILD=OFF`, is the usual CMakeLists of the project,
in a SuperBuild mode this will reside in the subdirectory blah of the
SuperBuild directory.

Example using with the default method `USE_SUPERBUILD=ON`:

$ mkdir super-build && cd super-build
$ cmake ..
$ # assuming the Unix Makefile generator was the default
$ make


$ # the project build directory is resides in blah/
$ cd blah/
$ pwd
<...>/cmake-superbuild/build/blah
$ ./bin/blah
Hello World!

Example without the superbuild, the dependencies are taken care in some other
ways:

$ mkdir build && cd build
$ # assuming a proper version of Boost has been built and resides
$ # in ~/pkg/boost_1_55_0
$ cmake -DUSE_SUPERBUILD=OFF -DBOOST_ROOT=~/pkg/boost_1_55_0 ..
$ make
$ ./bin/blah
Hello World!