# Shared library
#

add_library(
  sgtelib
  SHARED ${SGTELIB_SOURCES}
)

target_include_directories(
  sgtelib 
  PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/sgtelib>
)

set_target_properties(
  sgtelib
  PROPERTIES 
    VERSION "${SGTELIB_VERSION}"
    SOVERSION "${SGTELIB_VERSION_MAJOR}.${SGTELIB_VERSION_MINOR}"
    NO_SONAME ${NO_SONAME}
)

# export symbols on Windows
if (WIN32)
    target_compile_definitions(
      sgtelib
      PRIVATE -DDLL_EXPORTS
)
endif()

# installing library
install(
  TARGETS sgtelib 
  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sgtelib
)
