
Robert Bielik schrieb:
Fabio Fracassi skrev:
This is not true. The most commonly used CMake way is to use FindBoost.cmake (which comes with cmake) via find_package(Boost). and thus include and link to an installed version of boost.
Ok, its not *the* way, but when working in x-platform development (win/mac/linux) and you just want to checkout the source tree and have everything "work" directly (and not worry about what packages to install to make the project compile), its the best way imho.
I still don't agree, because you are intermingling separate modules, with the consequence that you impose certain requirements on those modules (i.e. you need them to build in a certain way, which is probably the reason for your orgiginal post). Using find_package doesn't preclude you from doing a single checkout, and have everything work. All you need to do is set the correct search path ( set (CMAKE_PREFIX_PATH <your_path>) ) before using find_package. Additionally you have a script (you can use CMake for this, too) which builds all your (external) modules in the right order. This is a bit more work to setup, but each module can be build and installed the way it is supposed to be, and work transparently. Additionally you gain a lot of flexibility, for example to test new versions of your external dependencies.
Working on linux I see that your described way is the normal way.
The same works on Windows, just as well (and I see no reason why it shouldn't work on Mac, though I haven't tried yet). Arguably it is somewhat easier on Linux, because of its superior package management. Regards Fabio