# src/CMakeLists.txt for libLASi

# Copyright (C) 2007-2019 Alan W. Irwin
# Copyright (C) 2007 Werner Smekal

# This file is part of libLASi.
#
# LibLASi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# LibLASi is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with LibLASi; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA

set(LASi_LIB_SRCS
drawGlyph.cpp
glyphMgr.cpp
psDoc.cpp
util.cpp
)

set(LASi_LIB_HDRS
contextMgr.h
drawGlyph.h
glyphMgr.h
manager.h
stringDimensions.h
util.h
)

include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}
${PANGOFT2_includedir}
)

add_library(LASi ${LASi_LIB_SRCS} ${LASi_LIB_HDRS})

set(libLASi_LINK_LIBRARIES ${PANGOFT2_libraries})

if(MATH_LIB)
  list(APPEND libLASi_LINK_LIBRARIES ${MATH_LIB})
endif(MATH_LIB)

target_link_libraries(LASi ${libLASi_LINK_LIBRARIES})

if(USE_RPATH)
  set(LIB_INSTALL_RPATH)
  list(APPEND LIB_INSTALL_RPATH ${libdir})
  list(APPEND LIB_INSTALL_RPATH ${PANGO_RPATH})
  set_target_properties(
  LASi
  PROPERTIES 
  SOVERSION ${LASi_SOVERSION}
  VERSION ${LASi_VERSION}
  INSTALL_RPATH "${LIB_INSTALL_RPATH}"
  INSTALL_NAME_DIR "${libdir}"
  POSITION_INDEPENDENT_CODE ON
  )
else(USE_RPATH)
  set_target_properties(
  LASi
  PROPERTIES 
  SOVERSION ${LASi_SOVERSION}
  VERSION ${LASi_VERSION}
  INSTALL_NAME_DIR "${libdir}"
  POSITION_INDEPENDENT_CODE ON
  )
endif(USE_RPATH)

install(
TARGETS LASi
ARCHIVE DESTINATION ${libdir}
LIBRARY DESTINATION ${libdir}
RUNTIME DESTINATION ${bindir}
)
