[CMake] Testing shared library
Brad King
brad.king at kitware.com
Mon Jul 24 16:12:08 EDT 2006
Flávio P. Duarte wrote:
> 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 ?
CMake will generate a command line like
g++ -o test1 obj1.o obj2.o -L../src -lmylib
What problem are you having with this version?
Note also that when linking to another target in the same project with
TARGET_LINK_LIBRARIES you do not need to add the LINK_DIRECTORIES
explicitly.
-Brad
More information about the CMake
mailing list