56 lines
1.6 KiB
CMake
56 lines
1.6 KiB
CMake
# 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
|
|
# http://code.lm7.fr/p/owlps/source/tree/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.
|
|
|
|
# Generate configuration header
|
|
configure_file(owlps-config.h.in
|
|
"${GENERATED_INCLUDE}/owlps-config.h")
|
|
|
|
# On Linux and other GNU systems (e.g. GNU/kFreeBSD), we need -lrt for
|
|
# clock_gettime()
|
|
string(REGEX MATCH "^GNU" GNU_SYSTEM ${CMAKE_SYSTEM_NAME})
|
|
if ("${GNU_SYSTEM}" OR ${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} rt)
|
|
endif()
|
|
|
|
# Explicitly link to libc
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} c)
|
|
|
|
# Targets
|
|
add_library(libowlps.so SHARED libowlps.c)
|
|
add_library(libowlps.a STATIC libowlps.c)
|
|
|
|
# Fix targets' names
|
|
set_target_properties(
|
|
libowlps.a libowlps.so
|
|
PROPERTIES
|
|
OUTPUT_NAME owlps
|
|
SOVERSION 3
|
|
VERSION 3.3
|
|
)
|
|
|
|
# Add compile flags
|
|
set_target_properties(libowlps.so
|
|
PROPERTIES COMPILE_FLAGS ${SHARED_FLAGS})
|
|
set_target_properties(libowlps.a
|
|
PROPERTIES COMPILE_FLAGS ${EXE_FLAGS})
|
|
|
|
# Link libraries
|
|
target_link_libraries(libowlps.so ${EXTRA_LIBS})
|
|
target_link_libraries(libowlps.a ${EXTRA_LIBS})
|
|
|
|
# Install targets
|
|
install(
|
|
TARGETS libowlps.so libowlps.a
|
|
DESTINATION lib)
|
|
install(
|
|
FILES owlps.h
|
|
DESTINATION include)
|