project(cxxtools-pkg-config-tests)

cmake_minimum_required(VERSION 2.6)

include(FindPkgConfig)

pkg_check_modules(CXXTOOLS cxxtools>=2.0 REQUIRED)
pkg_check_modules(CXXTOOLS_JSON cxxtools-json>=2.0 REQUIRED)
pkg_check_modules(CXXTOOLS_BIN cxxtools-bin>=2.0 REQUIRED)
pkg_check_modules(CXXTOOLS_XMLRPC cxxtools-xmlrpc>=2.0 REQUIRED)
pkg_check_modules(CXXTOOLS_HTTP cxxtools-http>=2.0 REQUIRED)
pkg_check_modules(CXXTOOLS_UNIT cxxtools-unit>=2.0 REQUIRED)

include_directories(
  ${CXXTOOLS_INCLUDE_DIRS}
  ${CXXTOOLS_JSON_INCLUDE_DIRS}
  ${CXXTOOLS_BIN_INCLUDE_DIRS}
  ${CXXTOOLS_XMLRPC_INCLUDE_DIRS}
  ${CXXTOOLS_HTTP_INCLUDE_DIRS}
  ${CXXTOOLS_UNIT_INCLUDE_DIRS}
)

link_directories(
  ${CXXTOOLS_LIBRARY_DIRS}
  ${CXXTOOLS_JSON_LIBRARY_DIRS}
  ${CXXTOOLS_BIN_LIBRARY_DIRS}
  ${CXXTOOLS_XMLRPC_LIBRARY_DIRS}
  ${CXXTOOLS_HTTP_LIBRARY_DIRS}
  ${CXXTOOLS_UNIT_LIBRARY_DIRS}
)

add_executable(httpserver httpserver.cpp)
target_link_libraries(httpserver ${CXXTOOLS_HTTP_LIBRARIES})

add_executable(xmlrpcserver xmlrpcserver.cpp)
target_link_libraries(xmlrpcserver ${CXXTOOLS_XMLRPC_LIBRARIES})

add_executable(regex regex.cpp)
target_link_libraries(regex ${CXXTOOLS_LIBRARIES})

add_executable(jsonrpcserver jsonrpcserver.cpp)
target_link_libraries(jsonrpcserver ${CXXTOOLS_JSON_LIBRARIES})

add_executable(binrpcserver binrpcserver.cpp)
target_link_libraries(binrpcserver ${CXXTOOLS_BIN_LIBRARIES})

add_executable(unit-test unit-test.cpp uri-test.cpp)
target_link_libraries(unit-test ${CXXTOOLS_UNIT_LIBRARIES})
