[CMake] How can I write CMakeLists.txt to link a special library?
Werner Smekal
smekal at iap.tuwien.ac.at
Sat Dec 13 16:51:49 EST 2008
Hi,
Kermit Mei wrote:
> Hello, all.
> I used sigc++ library in my program, so I must compile my main.cc like
> this:
>
> c++ -Wall main.cc -o main -I/usr/include/sigc++-2.0
> -I/usr/lib/sigc++-2.0/include -lsigc-2.0
>
> Then, how can I write the CMakeLists.txt? I worte it like this:
>
> cmake_minimum_required(VERSION 2.6)
>
> PROJECT(MEM_BER)
> SET(SRC_LIST main.cc)
>
> MESSAGE(STATUS "This is BINARY dir " ${HELLO_BINARY_DIR})
> MESSAGE(STATUS "This is SOURCE dir " ${HELLO_SOURCE_DIR})
>
> INCLUDE_DIRECTORIES(/usr/include/sigc++-2.0)
> INCLUDE_DIRECTORIES(/usr/lib/sigc++-2.0/include)
>
> LINK_DIRECTORIES(/usr/lib/)
>
> ADD_EXECUTABLE(main ${SRC_LIST})
>
> #################################
>
> But I can't link the libsigc.
http://www.cmake.org/cmake/help/cmake2.6docs.html#command:target_link_libraries
target_link_libraries(main /usr/lib/libsigc-2.0.so)
(whatever sigc library is called and where it is, don't know)
HTH,
Werner
More information about the CMake
mailing list