[CMake] Common CMake setup for several projects

John Drescher drescherjm at gmail.com
Fri Oct 14 08:05:28 EDT 2011


On Fri, Oct 14, 2011 at 7:33 AM, Paul Hansen <paul.hansen.name at gmail.com> wrote:
> Hi
>
> Is it possible to make a common CMake setup that can be used in several
> projects?
>
> The projects are independant but do use common libraries. Would be nice to
> set this up in one place and not in the CMakeLists.txt for each project.
>
> Can it be done "preprocessor-like":
> #include "/path/to/common/CMakeLists.txt"
>

Yes.

include(/path/to/common/CMakeLists.txt)

However I would change the name to something like the following:
include(/path/to/common/InitilaizeProjects.cmake)

> or is the way to make a top CMakeLists.txt that uses
> add_subdirectory(project1)
> add_subdirectory(project2)
>
> or a third way?
>
> Thank you very much
> Paul
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
John M. Drescher


More information about the CMake mailing list