ADD_LIBRARY(wtdbo
  ptr.C
  Call.C
  DbAction.C
  Exception.C
  FixedSqlConnectionPool.C
  Query.C
  QueryColumn.C
  SqlQueryParse.C
  Session.C
  SqlConnection.C
  SqlConnectionPool.C
  SqlStatement.C
  SqlTraits.C
  StdSqlTraits.C
  Transaction.C
  WtSqlTraits.C
)

IF(WIN32)
  #win32 links automatically against boost libs; specifying too much causes
  #trouble
  IF(MULTI_THREADED_BUILD)
    TARGET_LINK_LIBRARIES(wtdbo ${CMAKE_THREAD_LIBS_INIT})
  ENDIF(MULTI_THREADED_BUILD)
ELSE(WIN32)
  IF(MULTI_THREADED_BUILD)
    TARGET_LINK_LIBRARIES(wtdbo ${BOOST_THREAD_LIB} ${BOOST_SYSTEM_LIB} ${CMAKE_THREAD_LIBS_INIT} ${BOOST_DT_LIB})
  ELSE(MULTI_THREADED_BUILD)
    TARGET_LINK_LIBRARIES(wtdbo ${BOOST_DT_LIB})
  ENDIF(MULTI_THREADED_BUILD)
ENDIF(WIN32)

INSTALL(TARGETS wtdbo
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION ${LIB_INSTALL_DIR}
    ARCHIVE DESTINATION ${LIB_INSTALL_DIR})

SET_TARGET_PROPERTIES(
  wtdbo
PROPERTIES
  VERSION ${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}
  SOVERSION ${WTDBO_SOVERSION}
  DEBUG_POSTFIX ${DEBUG_LIB_POSTFIX}
)
IF(MSVC)
  SET_TARGET_PROPERTIES(
    wtdbo
  PROPERTIES
    COMPILE_FLAGS "${BUILD_PARALLEL} /wd4251 /wd4275 /wd4267"
  )
ENDIF(MSVC)

SUBDIRS(backend)

INSTALL_FILES(/include/Wt/Dbo "^[^.]+\\.h$")
INSTALL_FILES(/include/Wt/Dbo "^[^b][^.]+$")
INSTALL_FILES(/include/Wt/Dbo "^[^b.][^.]+$")
INSTALL_FILES(/include/Wt FILES ${WCONFIG_H_PATH})

IF (ASCIIDOC_FOUND)
  IF(NOT WIN32)
    ADD_CUSTOM_TARGET(doc)
  ENDIF(NOT WIN32)
  ASCIIDOC_FILE(dbo-tutorial
    ${CMAKE_SOURCE_DIR}/doc/tutorial/dbo.doc
    ${CMAKE_SOURCE_DIR}/doc/tutorial/dbo.html)
ENDIF (ASCIIDOC_FOUND)

