[CMake] Add -lrt at the end of link.txt

Rolf Eike Beer eike at sf-mail.de
Wed Jan 8 03:59:06 EST 2014


Am 08.01.2014 08:42, schrieb Jakub Zakrzewski:
> Hello,
> I recommend reading some kind of CMake tutorial to get at least the
> basic concepts. In the mean time:
> 
> --- CMakeLists.txt ---
> cmake_minimum_required(VERSION 2.8.6)
> project(oci_object_test)
> 
> set(ORCLIB_HOME /home/jzakrzewski/local/ocilib/usr/local)
> 
> include_directories(${ORCLIB_HOME}/include)
> link_directories(${ORCLIB_HOME}/lib64)
> 
> link_directories(/usr/lib/oracle/11.2/client64/lib)

This is wrong. Don't use link_directories.

> set(SOURCES
> 	main.cpp
> )
> 
> add_executable(demo ${SOURCES})
> target_link_libraries(demo clntsh ocilib)
> --- CMakeLists.txt ---

Use target_link_libraries() with absolute pathnames to the libraries you 
need. find_library() can help you gathering those.

Eike


More information about the CMake mailing list