Hi all, I'm having a problem understanding how I can link to an archive in another directory which is not a subdirectory. For example:
myproj +-- main +-- CMakeLists.txt +-- source files for main program +-- dir-A +-- CMakeLists.txt +-- source files for sub-program A +-- dir-B +-- CmakeLists.txt +-- source files for sub-program B Basically, I would like to make a larger project (main) and I'm building and testing each of its components separately. Right now, the main's CMakeLists.txt looks something like this: INCLUDE_DIRECTORIES (../dir-A) SUBDIRS (../dir-A) ADD_EXECUTABLE (main ${MAIN_SRCS}) TARGET_LINK_LIBRARIES (main subprogA_ar) which works fine so far (the CMakeLists.txt in dir-A generates the archive subprogA_ar). However, I just found out that SUBDIRS is deprecated and so, replaced it with "ADD_SUBDIRECTORY". That's when I got an error about "dir-A" not being a subdirectory. Obviously, I was not using "SUBDIRS" before as it was intended... :-) I've also tried adding "dir-A" as a LINK_DIRECTORIES with no success. It is unable to find subprogA_ar. I'm not sure if it is possible, but ideally, when I run "make" in main/, I would like it to rebuild the targets in "dir-A" (including the archive) and link that in. I'm also open to the possibility that I got the above organization all wrong and should have only one large CMakeLists.txt in a directory structure like this: myproj +-- main +-- CMakeLists.txt +-- source files for main program +-- dir-A +-- source files for sub-program A +-- dir-B +-- source files for sub-program B Is this what I should have done?? Thank you! 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