add_subdirectory and common libraries

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

add_subdirectory and common libraries

Harry Mallon-2
Hello all,

Has anyone got any good recommendations for the following setup?

“large_repo” contains code for a binary and two git submodules. One is “library” which is added with add_subdirectory(). The other is some common library “util_library” (something like gtest which is generally useful) which is added as a git submodule with add_subdirectory(). “library” also needs “util_library” which is added to its repo in the same git submodule style.

It is possible to namespace the names in an add_subdirectory call? Or something like that? Or maybe I should go back to the install and find_package() methods I used to use?

========
└── large_repo
    ├── library
    │   └── util_library
    └── util_library
========


Thanks,
Harry


Harry Mallon
CODEX | Senior Software Engineer
60 Poland Street | London | England | W1F 7NT
E [hidden email] | T +44 203 7000 989
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: add_subdirectory and common libraries

Craig Scott-3


On Tue, Dec 12, 2017 at 5:13 AM, Harry Mallon <[hidden email]> wrote:
Hello all,

Has anyone got any good recommendations for the following setup?

“large_repo” contains code for a binary and two git submodules. One is “library” which is added with add_subdirectory(). The other is some common library “util_library” (something like gtest which is generally useful) which is added as a git submodule with add_subdirectory(). “library” also needs “util_library” which is added to its repo in the same git submodule style.

It is possible to namespace the names in an add_subdirectory call? Or something like that? Or maybe I should go back to the install and find_package() methods I used to use?

========
└── large_repo
    ├── library
    │   └── util_library
    └── util_library
========

It won't really help you right now, but this is a classic scenario that the new FetchContent module would address. It's not part of CMake 3.10 but it is on master and should be available from CMake 3.11 when it is eventually released.


--
Craig Scott
Melbourne, Australia

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake