# This file is part of the Owl Positioning System (OwlPS) project.
# It is subject to the copyright notice and license terms in the
# COPYRIGHT.t2t file found in the top-level directory of this
# distribution and at
#   https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
# No part of the OwlPS Project, including this file, may be copied,
# modified, propagated, or distributed except according to the terms
# contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
# distributed along with this file, either separately or by replacing
# this notice by the COPYRIGHT.t2t file's contents.

# Explicitly link to libc
set(EXTRA_LIBS ${EXTRA_LIBS} c)

# Targets
add_library(libowlps-client.so SHARED libowlps-client.c)
add_library(libowlps-client.a STATIC libowlps-client.c)

# Fix targets' names
set_target_properties(
  libowlps-client.so libowlps-client.a
  PROPERTIES
  OUTPUT_NAME owlps-client
  SOVERSION 1
  VERSION 1.2
  )

# Add compile flags
set_target_properties(libowlps-client.so
  PROPERTIES COMPILE_FLAGS ${SHARED_FLAGS})
set_target_properties(libowlps-client.a
  PROPERTIES COMPILE_FLAGS ${EXE_FLAGS})

# Link libraries
target_link_libraries(libowlps-client.so libowlps.so ${EXTRA_LIBS})
target_link_libraries(libowlps-client.a libowlps.a ${EXTRA_LIBS})

# Install targets
install(
  TARGETS libowlps-client.so libowlps-client.a
  DESTINATION lib)
install(
  FILES owlps-client.h
  DESTINATION include)
