In your top level CMakeLists.txt: add_subdirectory(B) add_subdirectory(A) add_subdirectory(C)
A & C must come after B since they both depend on B. Does that help? Hope so, David 2011/6/26 Klaim - Joël Lamotte <mjkl...@gmail.com> > Hi, > > I'm having trouble understanding how I should solve this case correctly in > CMake : > > I want my project A to include+link my project B. I already made it with > project C but it don't work with A. > I think the problems comes from the directory structure : > > /myrepo/tools/A (exe/Qt) > /myrepo/tools/B (shared library) > /myrepo/tools/B/C (exe) > > Each of those folders have a CMakeFiles.txt file that add_subdirectory( > the_sub_directories ). > > B uses include_directories() and C use target_link_libraries( C B ) > So C does include and compile+link with code using B code. > > A code runs fine alone, but now I need it to use B. > I've added > > target_link_libraries( A ${QT_LIBRARIES} B ) > > to make sure it does uses B but the generated projects don't have the B > include directory. > > I know that I could use an advanced variable to get the include file, but I > don't find it consistent with the fact that > C executable does implicitely use the include file from B. A being > configured the same, it should work too... no? > > I think it's related to the projects CMakeFiles.txt positions in the > directory hierarchy but I'm still often wrestling with CMake so I'm not > sure. > > What would be the idiomatic CMake way of making A include+link B? > > The real code is open source so I can show you exactly what is my current > setup if it helps (but I guess it's a noob question...) > > > Klaim - Joël Lamotte > > _______________________________________________ > 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 >
_______________________________________________ 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