# KBibTeXIO library

set(
    kbibtexio_LIB_SRCS
    xsltransform.cpp
    comment.cpp
    element.cpp
    encoder.cpp
    encoderlatex.cpp
    encoderxml.cpp
    encoderutf8.cpp
    entry.cpp
    file.cpp
    fileinfo.cpp
    fileexporter.cpp
    fileexporterbibtex.cpp
    fileexporterblg.cpp
    fileexporterpdf.cpp
    fileexporterps.cpp
    fileexporterris.cpp
    fileexporterrtf.cpp
    fileexportertoolchain.cpp
    fileexporterbibtex2html.cpp
    fileexporterxml.cpp
    fileexporterxslt.cpp
    fileimporter.cpp
    fileimporterbibtex.cpp
    fileimporterris.cpp
    fileimporterpdf.cpp
    macro.cpp
    preamble.cpp
    iconvlatex.cpp
    value.cpp
    config/bibtexfields.cpp
    config/bibtexentries.cpp
)

set(
    kbibtexio_HDRS
    comment.h
    element.h
    encoder.h
    encoderlatex.h
    encoderxml.h
    encoderutf8.h
    entry.h
    fileexporterbibtex2html.h
    fileexporterbibtex.h
    fileexporterblg.h
    fileexporter.h
    fileexporterpdf.h
    fileexporterps.h
    fileexporterris.h
    fileexporterrtf.h
    fileexportertoolchain.h
    fileexporterxml.h
    fileexporterxslt.h
    file.h
    fileimporterbibtex.h
    fileimporter.h
    fileimporterpdf.h
    fileimporterris.h
    fileinfo.h
    iconvlatex.h
    kbibtexio_export.h
    macro.h
    preamble.h
    value.h
    xsltransform.h
    config/bibtexfields.h
    config/bibtexentries.h
)

add_definitions(
    -DMAKE_KBIBTEXIO_LIB
)

# debug area for KBibTeX's IO library
add_definitions(
    -DKDE_DEFAULT_DEBUG_AREA=101011
)

include_directories(
    ${LIBXML2_INCLUDE_DIR}
    ${LIBXSLT_INCLUDE_DIR}
    ${POPPLER_QT4_INCLUDE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/config/
)

kde4_add_library(
    kbibtexio
    SHARED
    ${kbibtexio_LIB_SRCS}
)

if(
    WIN32
)
    target_link_libraries(
        kbibtexio
        ${QT_QTCORE_LIBRARY}
        ${KDE4_KDECORE_LIBS}
        ${KDE4_KIO_LIBS}
        ${LIBXML2_LIBRARIES}
        ${LIBXSLT_LIBRARIES}
        ${POPPLER_QT4_LIBRARIES}
        iconv
    )
else(
    WIN32
)
    target_link_libraries(
        kbibtexio
        ${QT_QTCORE_LIBRARY}
        ${KDE4_KDECORE_LIBS}
        ${KDE4_KIO_LIBS}
        ${LIBXML2_LIBRARIES}
        ${LIBXSLT_LIBRARIES}
        ${POPPLER_QT4_LIBRARIES}
    )
endif(
    WIN32
)

set_target_properties(
    kbibtexio
    PROPERTIES
    VERSION
    ${LIB_VERSION}
    SOVERSION
    ${LIB_SOVERSION}
)

install(
    TARGETS
    kbibtexio
    RUNTIME
    DESTINATION
    bin
    LIBRARY
    DESTINATION
    ${LIB_INSTALL_DIR}
)

install(
    FILES
    ${kbibtexio_HDRS}
    DESTINATION
    ${INCLUDE_INSTALL_DIR}/kbibtex
    COMPONENT
    Devel
)
