add_definitions( -DHAVE_CONFIG_H )

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
    add_definitions(-Wno-strict-aliasing)
endif ()


# In principle, the wv2_GENERATED files are generated by uncommenting the
# following line.
#
#ADD_SUBDIRECTORY( generator )
#
# However, in practice, these have now diverged sufficiently from the
# generated files for this to be impractical. At this point, the generated
# files have value only for comparison purposes.
set( wv2_GENERATED
    word95_generated.h
    word95_generated.cpp
    word97_generated.h
    word97_generated.cpp
    convert.h
    convert.cpp
    )

set( wv2_SOURCES
    annotations.cpp
    olestorage.cpp
    olestream.cpp
    word97_helper.cpp
    word95_helper.cpp
    word_helper.cpp
    global.cpp
    parser.cpp
    parser9x.cpp
    parser95.cpp
    parser97.cpp
    parserfactory.cpp
    ustring.cpp
    textconverter.cpp
    styles.cpp
    handlers.cpp
    properties97.cpp
    fonts.cpp
    lists.cpp
    paragraphproperties.cpp
    headers.cpp
    headers95.cpp
    headers97.cpp
    footnotes97.cpp
    bookmark.cpp
    functor.cpp
    functordata.cpp
    associatedstrings.cpp
    fields.cpp
    utilities.cpp
    crc32.c
    graphics.cpp
    wvlog.cpp
    )

set( wv2_HEADERS
    annotations.h
    olestorage.h
    olestream.h
    word_helper.h
    parser.h
    parserfactory.h
    ustring.h
    textconverter.h
    styles.h
    sharedptr.h
    global.h
    handlers.h
    fonts.h
    lists.h
    utilities.h
    paragraphproperties.h
    functor.h
    functordata.h
    associatedstrings.h
    fields.h
    wvlog.h
    )

add_definitions("-DMAKE_WV2_LIB")
add_library( kowv2 SHARED ${wv2_SOURCES} ${wv2_HEADERS} ${wv2_GENERATED} )
generate_export_header(kowv2 BASE_NAME wv2)
include_directories(  ../../../../libmso)
target_link_libraries( kowv2 mso ZLIB::ZLIB Iconv::Iconv)
set_target_properties( kowv2 PROPERTIES
                  SOVERSION ${LT_VERSION_CURRENT}
                  VERSION ${LT_VERSION_CURRENT}.${LT_VERSION_AGE}.${LT_VERSION_REVISION}
                  LT_VERSION_CURRENT ${LT_VERSION_CURRENT}
                  LT_VERSION_AGE ${LT_VERSION_AGE}
                  LT_VERSION_REVISION ${LT_VERSION_REVISION}
)

install(TARGETS kowv2 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

