Hi, I am trying to test a shared library using cmake. In my top level directory, I have the source directory (src), which contains the source files to build the library, and a test directory (test), which contains the source files to build the binaries that will be used to test the shared library. The problem is the binaries in the test diretory are not being compiled properly, i. e., they are not being linked against the shared library in the src directory. In autotools, the shared library was added as one obj file, like: g++ -o test1 obj1.o obj2.o ../src/libmylib.so I was not able to configure CMake to produce a similar command line. How can I achieve this ?
I am using the following piece of code: SET( SRC test1.cpp test2.cpp test3.cpp ) ENABLE_TESTING() MACRO( ADD_TESTS SRC_LIST ) FOREACH( IN_FILE ${SRC_LIST} ) STRING( REGEX REPLACE ".cpp" "" TARGET_NAME "${IN_FILE}" ) ADD_EXECUTABLE( ${TARGET_NAME} ${IN_FILE} test.cpp ) TARGET_LINK_LIBRARIES( ${TARGET_NAME} mylib ) ADD_TEST( ${TARGET_NAME} ${TARGET_NAME} ) ENDFOREACH( IN_FILE ) ENDMACRO( ADD_TESTS ) LINK_DIRECTORIES( ../src ) ADD_TESTS( "${SRC}" ) Flavio _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake