On 4/15/16 11:45 AM, Hans Dembinski wrote:
Hello,
I am new to this list, so let me start by greeting everyone. :) I would like to add something to this CMake discussion.
I have a project "histogram" that I am currently preparing for the Boost Incubator. I am using the standard directory structure prescribed for Boost, and I use CMake for the build. There is only one CMakeLists.txt in the build directory. It is true that there is usually a top-level CMakeLists.txt, but it does not have to be there.
I build like this
cd /path/to/build cmake /path/to/project/build make
...where /path/to/project is the top-level directory of the project.
In the CMakeLists.txt in /path/to/project/build, I use a relative path to locate the source files.
add_executable(some_lib ../src/some_lib.cpp)
etc.
This sounds similar if not identical to the advice I give in the Boost Library Incubator. I came to that advice after spending a lot of time investigating and experimenting with all the build tool options. I found them all too complex, too fragile, and not well documentated. Of course I trolled the net looking for information and advice as well. I came to my advice as the most expedient, simplest way to help other users test your library with the minimum of fuss for all involved. That was my goal and I think I achieved it. Note that I didn't try to solve the "problem" of finding a replacement for boost build. Having said this and participated in this discussion, I'm now inclined to update my advice on this topic so that the method I propose will be closer to the more common way of using CMake. I think I can do this now while still avoiding decent into CMake arcana. Of course it still won't meet the standards of CMake gurus, but they're not addressing my problem. Good luck with your submission. Robert Ramey