Hi Victor,
On Sat, Sep 3, 2011 at 02:27, Victor Yankee <[email protected]> wrote: > build/ > src/ > utils > a > A.h > unittest_a.cpp > > b > B.h // needs a.h > > unittest_b.cpp > > common > c > C.h // needs A.h and B.h > testit.cpp // needs C.h, B.h and A.h > > > The directory src/utils/a has a header file A.h. Likewise src/utils/b has a > > header file B.h that #includes a.h. > Finally, c has a header file C.h that #includes a.h and b.h. > > > This is just a short example of my large project. In reality there are other > directories and levels of subdirectories. > > > What can I do in the local CMakeLists.txt files so that the directories > where the header files live are automatically made part of the others as > needed, > so I do not have to keep remembering all of them for every header-only > > library all the way down the dependency chain? I'm not much of a CMake expert, but it sounds like something I've done and I think the INCLUDE_DIRECTORIES command is all you need: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:include_directories So in each of: src/utils/a src/utils/b src/common/c src/ you would have a CMakeLists.txt . The first 3 performs the unit testing. And the top-level one in src/ is the one that builds your executable. In the CMakeLists.txt that refers to the header file in another directory, you would put INCLUDE_DIRECTORIES. You would then tie up their dependencies using ADD_DEPENDENCIES so that an executable is made once something else is made: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_dependencies I *think* that is all you need. I've also used ADD_SUBDIRECTORY but I'm not too sure if you need it too in your situation. Hope this helps! Ray _______________________________________________ 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
