[CMake] Linker Include Path
Hi all, I'm using cmake (2.8.5) to build a set of C++ libraries. I have a project directory structure which is basically organized like this: package/component/CMakeLists.txt package/component/inc/foo.hpp package/component/src/foo.cpp Boiled down, my CMakeLists.txt for this component looks like this: SET(HEADERS inc/foo.hpp) SET(SOURCES src/foo.cpp) SET(LIBS whatever) INCLUDE_DIRECTORIES(inc) ADD_LIBRARY(MyLib ${HEADERS} ${SOURCES}) TARGET_LINK_LIBRARIES(MyLib ${LIBRARIES}) This has worked fine for me. Now, however, I would like to add another subdirectory to the src tree (this has organizational reasons), resulting in something like this: package/component/CMakeLists.txt package/component/inc/foo.hpp package/component/src/foo.cpp package/component/src/xyz/xyz.cpp I modified the SOURCES assignment in my CMakeLists.txt like so: SET(SOURCES src/foo.cpp src/xyz/xyz.cpp) While this does compile, it does not link. I assume that this is because the xyz.o is put in CURRENT_BINARY_OUTPUT/xyz/xyz.o and the linker does not include that subdirectory. If I move the source file up by one level (i.e. into the src directory), everything compiles and links just fine, but that's not really an acceptable solution. Is there some (portable) way to tell CMake to include the xyz output path so that xyz.o is found at link time? Thanks in advance for your help! Matthias -- 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
Re: [CMake] Linker Include Path
Sorry, never mind: Problem has resolved itself. The linker error was due to some other dependency. On 28/10/11 20:44, Matthias Schweinoch wrote: Hi all, I'm using cmake (2.8.5) to build a set of C++ libraries. I have a project directory structure which is basically organized like this: package/component/CMakeLists.txt package/component/inc/foo.hpp package/component/src/foo.cpp Boiled down, my CMakeLists.txt for this component looks like this: SET(HEADERS inc/foo.hpp) SET(SOURCES src/foo.cpp) SET(LIBS whatever) INCLUDE_DIRECTORIES(inc) ADD_LIBRARY(MyLib ${HEADERS} ${SOURCES}) TARGET_LINK_LIBRARIES(MyLib ${LIBRARIES}) This has worked fine for me. Now, however, I would like to add another subdirectory to the src tree (this has organizational reasons), resulting in something like this: package/component/CMakeLists.txt package/component/inc/foo.hpp package/component/src/foo.cpp package/component/src/xyz/xyz.cpp I modified the SOURCES assignment in my CMakeLists.txt like so: SET(SOURCES src/foo.cpp src/xyz/xyz.cpp) While this does compile, it does not link. I assume that this is because the xyz.o is put in CURRENT_BINARY_OUTPUT/xyz/xyz.o and the linker does not include that subdirectory. If I move the source file up by one level (i.e. into the src directory), everything compiles and links just fine, but that's not really an acceptable solution. Is there some (portable) way to tell CMake to include the xyz output path so that xyz.o is found at link time? Thanks in advance for your help! Matthias -- 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
[CMake] How to specify out-of-source build/lib/bin directories
Hi all, I'm a new cmake user and I'm having a little trouble. Perhaps someone here can help me: I was wondering if it is possible to specify a build path manually within the toplevel CMakeLists.txt file? I did read the wiki about out-of-source build environments, but the examples all used ccmake for setting it up (or I missed it). The same applies to lib/bin paths, i.e. I would like to specify an out-of-source lib directory and an out-of-source bin directory to place the executables in... what would be the appropriate command for this? Finally, I use doxygen for documentation. What would I need to add to the CMakeLists.txt file such that when I run 'make', the command 'doxygen Doxyfile' is executed in the toplevel source directory? Thanks in advance for the help! Matthias Schweinoch -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger?did=10 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake