Skip to content

Commit e669174

Browse files
committed
Option to use libconfig system libraries
1 parent c3095dd commit e669174

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ if(NOT CMAKE_BUILD_TYPE)
4848
endif(NOT CMAKE_BUILD_TYPE)
4949

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

5253
if(WIN32)
5354
add_definitions(-DLIBCONFIGXX_STATIC -DLIBCONFIG_STATIC) #Needed when linking libconfig statically
@@ -67,7 +68,11 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
6768
#-------------------------------------------------------------------------------
6869
#add subdirectories
6970
add_subdirectory(src/3rdparty/cvblobs)
70-
add_subdirectory(src/3rdparty/libconfig)
71+
72+
if(NOT USE_SYSTEM_LIBS)
73+
add_subdirectory(src/3rdparty/libconfig)
74+
endif(NOT USE_SYSTEM_LIBS)
75+
7176
add_subdirectory(src/libopentld)
7277
add_subdirectory(src/opentld)
7378

src/3rdparty/libconfig/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if(WIN32)
33
add_definitions(-DLIBCONFIGXX_STATIC -DLIBCONFIG_STATIC -DYY_NO_UNISTD_H -DYY_USE_CONST -D_CRT_SECURE_NO_DEPRECATE -D_STDLIB_H)
44
endif(WIN32)
55

6-
add_library(libconfig
6+
add_library(config++
77
grammar.c
88
libconfig.c
99
libconfigcpp.cc

src/opentld/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ include_directories(main
66
../libopentld/mftracker
77
../libopentld/tld
88
../3rdparty/cvblobs
9-
../3rdparty/libconfig
109
${OpenCV_INCLUDE_DIRS})
1110

11+
if(NOT USE_SYSTEM_LIBS)
12+
include_directories(../3rdparty/libconfig)
13+
endif(NOT USE_SYSTEM_LIBS)
14+
1215
#-------------------------------------------------------------------------------
1316
# main
1417
add_library(main
@@ -21,14 +24,14 @@ add_library(main
2124
main/Main.h
2225
main/Settings.h)
2326

24-
target_link_libraries(main libopentld cvblobs libconfig ${OpenCV_LIBS})
27+
target_link_libraries(main libopentld cvblobs config++ ${OpenCV_LIBS})
2528

2629
#-------------------------------------------------------------------------------
2730
# opentld
2831
add_executable(opentld
2932
OpenTLD.cpp)
3033

31-
target_link_libraries(opentld main libopentld cvblobs libconfig ${OpenCV_LIBS})
34+
target_link_libraries(opentld main libopentld cvblobs config++ ${OpenCV_LIBS})
3235

3336
install(TARGETS opentld DESTINATION bin)
3437

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

49-
QT4_ADD_RESOURCES(QOPENTLD_RCS_HEADERS ${QOPENTLD_RCS})
52+
QT4_ADD_RESOURCES(QOPENTLD_RCS_CPP ${QOPENTLD_RCS})
5053
QT4_WRAP_CPP(QOPENTLD_HEADERS_MOC ${QOPENTLD_HEADERS})
5154
QT4_WRAP_UI(QOPENTLD_FORMS_HEADERS ${QOPENTLD_FORMS})
52-
set(QOPENTLD_SOURCES ${QOPENTLD_SOURCES} ${QOPENTLD_RCS_HEADERS} ${QOPENTLD_HEADERS_MOC} ${QOPENTLD_FORMS_HEADERS})
55+
set(QOPENTLD_SOURCES ${QOPENTLD_SOURCES} ${QOPENTLD_RCS_CPP} ${QOPENTLD_HEADERS_MOC} ${QOPENTLD_FORMS_HEADERS})
5356

5457
add_executable(qopentld ${QOPENTLD_SOURCES})
55-
target_link_libraries(qopentld main libopentld cvblobs libconfig ${OpenCV_LIBS} ${QT_LIBRARIES})
58+
target_link_libraries(qopentld main libopentld cvblobs config++ ${OpenCV_LIBS} ${QT_LIBRARIES})
5659

5760
install(TARGETS qopentld DESTINATION bin)
5861
endif(BUILD_QOPENTLD)

0 commit comments

Comments
 (0)