add_definitions(-D_BLD_cdt)

include_directories(.)

add_library(cdt SHARED
    # Header files
    cdt.h
    dthdr.h

    # Source files
    dtclose.c
    dtdisc.c
    dtextract.c
    dtflatten.c
    dthash.c
    dtlist.c
    dtmethod.c
    dtopen.c
    dtrenew.c
    dtrestore.c
    dtsize.c
    dtstat.c
    dtstrhash.c
    dttree.c
    dtview.c
    dtwalk.c

    # Link definition file for Windows
    cdt.def
)

# Installation location of library files
install(
    TARGETS cdt
    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
    LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
)

# Installation location of header files
install(
    FILES cdt.h
    DESTINATION ${HEADER_INSTALL_DIR}
)

# Installation location of man page
install(
    FILES cdt.3
    DESTINATION ${MAN_INSTALL_DIR}
)

add_definitions(-D_BLD_cdt)

include_directories(.)

add_library(cdt SHARED
    # Header files
    cdt.h
    dthdr.h

    # Source files
    dtclose.c
    dtdisc.c
    dtextract.c
    dtflatten.c
    dthash.c
    dtlist.c
    dtmethod.c
    dtopen.c
    dtrenew.c
    dtrestore.c
    dtsize.c
    dtstat.c
    dtstrhash.c
    dttree.c
    dtview.c
    dtwalk.c

    # Link definition file for Windows
    cdt.def
)

# Installation location of library files
install(
    TARGETS cdt
    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
    LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
)

# Specify headers to be installed
install(
    FILES cdt.h
    DESTINATION ${HEADER_INSTALL_DIR}
)

# Specify man pages to be installed
install(
    FILES cdt.3
    DESTINATION ${MAN_INSTALL_DIR}
)

# Specify library version and soversion
set_target_properties(cdt PROPERTIES
    VERSION 5.0.0
    SOVERSION 5
)

Add (so)version specification to cdt CMake build
Add (so)version specification to cdt CMake build

The `set_target_properties` function can be used to set the version and
soversion properties. The versions are set to the current Autotools
version numbers.
