Skip to content

Commit

Permalink
Option to use libconfig system libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
kornerc committed Aug 31, 2012
1 parent c3095dd commit e669174
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)

option(BUILD_QOPENTLD "Build with Qt-config-dialog." OFF)
option(USE_SYSTEM_LIBS "Use the installed version of libconfig++." OFF)

if(WIN32)
add_definitions(-DLIBCONFIGXX_STATIC -DLIBCONFIG_STATIC) #Needed when linking libconfig statically
Expand All @@ -67,7 +68,11 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
#-------------------------------------------------------------------------------
#add subdirectories
add_subdirectory(src/3rdparty/cvblobs)
add_subdirectory(src/3rdparty/libconfig)

if(NOT USE_SYSTEM_LIBS)
add_subdirectory(src/3rdparty/libconfig)
endif(NOT USE_SYSTEM_LIBS)

add_subdirectory(src/libopentld)
add_subdirectory(src/opentld)

Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/libconfig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if(WIN32)
add_definitions(-DLIBCONFIGXX_STATIC -DLIBCONFIG_STATIC -DYY_NO_UNISTD_H -DYY_USE_CONST -D_CRT_SECURE_NO_DEPRECATE -D_STDLIB_H)
endif(WIN32)

add_library(libconfig
add_library(config++
grammar.c
libconfig.c
libconfigcpp.cc
Expand Down
15 changes: 9 additions & 6 deletions src/opentld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ include_directories(main
../libopentld/mftracker
../libopentld/tld
../3rdparty/cvblobs
../3rdparty/libconfig
${OpenCV_INCLUDE_DIRS})

if(NOT USE_SYSTEM_LIBS)
include_directories(../3rdparty/libconfig)
endif(NOT USE_SYSTEM_LIBS)

#-------------------------------------------------------------------------------
# main
add_library(main
Expand All @@ -21,14 +24,14 @@ add_library(main
main/Main.h
main/Settings.h)

target_link_libraries(main libopentld cvblobs libconfig ${OpenCV_LIBS})
target_link_libraries(main libopentld cvblobs config++ ${OpenCV_LIBS})

#-------------------------------------------------------------------------------
# opentld
add_executable(opentld
OpenTLD.cpp)

target_link_libraries(opentld main libopentld cvblobs libconfig ${OpenCV_LIBS})
target_link_libraries(opentld main libopentld cvblobs config++ ${OpenCV_LIBS})

install(TARGETS opentld DESTINATION bin)

Expand All @@ -46,13 +49,13 @@ if(BUILD_QOPENTLD)
set(QOPENTLD_FORMS qopentld/ConfigDialog.ui)
set(QOPENTLD_RCS ../../res/rcs.qrc)

QT4_ADD_RESOURCES(QOPENTLD_RCS_HEADERS ${QOPENTLD_RCS})
QT4_ADD_RESOURCES(QOPENTLD_RCS_CPP ${QOPENTLD_RCS})
QT4_WRAP_CPP(QOPENTLD_HEADERS_MOC ${QOPENTLD_HEADERS})
QT4_WRAP_UI(QOPENTLD_FORMS_HEADERS ${QOPENTLD_FORMS})
set(QOPENTLD_SOURCES ${QOPENTLD_SOURCES} ${QOPENTLD_RCS_HEADERS} ${QOPENTLD_HEADERS_MOC} ${QOPENTLD_FORMS_HEADERS})
set(QOPENTLD_SOURCES ${QOPENTLD_SOURCES} ${QOPENTLD_RCS_CPP} ${QOPENTLD_HEADERS_MOC} ${QOPENTLD_FORMS_HEADERS})

add_executable(qopentld ${QOPENTLD_SOURCES})
target_link_libraries(qopentld main libopentld cvblobs libconfig ${OpenCV_LIBS} ${QT_LIBRARIES})
target_link_libraries(qopentld main libopentld cvblobs config++ ${OpenCV_LIBS} ${QT_LIBRARIES})

install(TARGETS qopentld DESTINATION bin)
endif(BUILD_QOPENTLD)
Expand Down

0 comments on commit e669174

Please sign in to comment.