[CMake] howto include libs ?
Reinhard Thies
Reinhard.Thies at web.de
Sun Feb 15 09:54:45 EST 2009
Hi,
its my first projekt with cmake and I am getting crazy with the following:
I am using libconfuse, which is installed under /usr/lib/
Here is my cmakefile:
cmake_minimum_required(VERSION 2.6)
PROJECT (DS309 C)
ADD_EXECUTABLE(ds309 ds309.c ds309_3_parser.c ds309toccp.c serveritf.c
serial2itf.c conf_parse.c linked_list.c logging.c dbgitf.c debug.c ccp/ccp.c
ccp/crcccitt.c)
INCLUDE_DIRECTORIES( . ccp )
TARGET_LINK_LIBRARIES(libconfuse)
IF (NOT CMAKE_BUILD_TYPE)
#MESSAGE(STATUS "DBG setting CMAKE_BUILD_TYPE (once) because it does not
exits.")
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type determining compiler
flags" FORCE )
#ELSE (NOT CMAKE_BUILD_TYPE)
# IF (CMAKE_BUILD_TYPE MATCHES "")
# MESSAGE("DBG setting CMAKE_BUILD_TYPE once beacuse it is empty.
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
# SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type determining
compiler flags" FORCE )
# ENDIF (CMAKE_BUILD_TYPE MATCHES "")
ENDIF (NOT CMAKE_BUILD_TYPE)
and here the error I get
Linking C executable ds309
CMakeFiles/ds309.dir/conf_parse.c.o: In function `read_config':
/home/can/ds309/src/conf_parse.c:39: undefined reference to `cfg_free'
/home/can/ds309/src/conf_parse.c:41: undefined reference to `cfg_init'
/home/can/ds309/src/conf_parse.c:42: undefined reference to `cfg_parse'
collect2: ld returned 1 exit status
Do I have to use something diffrent then TARGET_LINK_LIBRARIES ?
Thanks for your help
Reinhard
More information about the CMake
mailing list