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