On adding external projects and libraries, using Boost as a primary learning vehicle

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

On adding external projects and libraries, using Boost as a primary learning vehicle

Veikko Eeva

I'm relatively new to CMake and I'm trying to use https://github.com/veikkoeeva/cmaketest as a learning vehicle. My goal is to make a small, but sufficiently self-contained "Hello, World" project with a few other added projects. It looks to me this e-mail list might be a format suitable for a few starter questions and maybe a few follow-up ones if anyone has the time and inclination for little hand-holdng.

Currently I have Boost added so it is downloaded on the fly, compiled and then the headers and link directories added. I would like to add and compile Boost like that at using https://github.com/veikkoeeva/cmaketest/blob/master/CMakeLists.txt#L77 *ExternalProject_Add*, but I've since learned from http://stackoverflow.com/questions/39178338/compile-a-compiler-as-an-external-project-and-use-it/39186321#39186321 and perusing Craig Scott's blog at https://crascit.com/ that what I'm doing currently may not be achievable in the way I'm trying to do currently.

I have a few clear problems and then some others that I don't fully understand or that I'm not even aware of. For instance, I would to compile and add Boost headers and libraries dynamically, but I wouldn't like to have the Boost libraries to show in the IDE projects. Other less obvious is the libraries are added to the linker paths twice, which comes from my incomplete understanding of CMake build steps, I assume. The script has other mistakes too, I think, in how I add manually some Boost paths that perhaps could use less trouble (but the Boost build is a separate thing, so it might be required anyhow). Or in find_package(Boost).

Could anyone give advice, hints, fragments etc. on how to deal with the issues? I think I try to complete this endeavor by adding an already compiled library dependency (such as OpenSSL, Sodium or LevelDb, that are common occurrences) and a source include at some point, so in that sense too understanding this Boost case looks like prevalent. And then after that adding tests, for instance. I made a question related to this at http://stackoverflow.com/questions/41674055/running-externalproject-add-in-configure-time-or-preventing-it-from-running-ever too, but as noted, it looks like to make an e-mail list perhaps would be a more appropriate vehicle.

So, to recap:

How could I add Boost as downloading dynamically, perhaps using ExternalProject_Add and compile it, but then not having it in the IDE projects but having the headers and compiled libraries included appropriately. I would appreciate even a slick code example "doing it right" so as not to just learn one way of hacking things together.


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: