84 lines
2.8 KiB
CMake
84 lines
2.8 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.
|
|
|
|
# Explicitly link to libc
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} c)
|
|
|
|
# Targets
|
|
add_library(libowlps-resultreader.a STATIC libowlps-resultreader.c)
|
|
add_library(libowlps-resultreader.so SHARED libowlps-resultreader.c)
|
|
|
|
# Fix targets' names
|
|
set_target_properties(
|
|
libowlps-resultreader.a libowlps-resultreader.so
|
|
PROPERTIES
|
|
OUTPUT_NAME owlps-resultreader
|
|
SOVERSION 1
|
|
VERSION 1.0
|
|
)
|
|
|
|
# Add compile flags
|
|
set_target_properties(libowlps-resultreader.so
|
|
PROPERTIES COMPILE_FLAGS ${SHARED_FLAGS})
|
|
set_target_properties(libowlps-resultreader.a
|
|
PROPERTIES COMPILE_FLAGS ${EXE_FLAGS})
|
|
|
|
# Link libraries
|
|
target_link_libraries(libowlps-resultreader.so libowlps.so ${EXTRA_LIBS})
|
|
target_link_libraries(libowlps-resultreader.a libowlps.a ${EXTRA_LIBS})
|
|
|
|
# Install targets
|
|
install(
|
|
TARGETS libowlps-resultreader.so libowlps-resultreader.a
|
|
DESTINATION lib)
|
|
install(
|
|
FILES owlps-resultreader.h
|
|
DESTINATION include)
|
|
|
|
|
|
|
|
### Demo program ###
|
|
|
|
add_executable(owlps-resultreader-udp owlps-resultreader-udp.c)
|
|
target_link_libraries(owlps-resultreader-udp
|
|
libowlps.so
|
|
libowlps-resultreader.so)
|
|
install(
|
|
TARGETS owlps-resultreader-udp
|
|
DESTINATION bin)
|
|
|
|
add_executable(owlps-resultreader-udp.semistatic EXCLUDE_FROM_ALL
|
|
owlps-resultreader-udp.c)
|
|
target_link_libraries(owlps-resultreader-udp.semistatic
|
|
libowlps.a
|
|
libowlps-resultreader.a)
|
|
# Add the semistatic target to the global list of semistatic targets
|
|
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-resultreader-udp.semistatic)
|
|
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
|
|
|
|
add_executable(owlps-resultreader-udp.static EXCLUDE_FROM_ALL
|
|
owlps-resultreader-udp.c)
|
|
set_target_properties(owlps-resultreader-udp.static
|
|
PROPERTIES LINK_FLAGS -static)
|
|
target_link_libraries(owlps-resultreader-udp.static
|
|
libowlps.a
|
|
libowlps-resultreader.a)
|
|
# Add the static target to the global list of static targets
|
|
list(APPEND OWLPS_STATIC_TARGETS owlps-resultreader-udp.static)
|
|
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)
|
|
|
|
# Add compile flags for the above targets
|
|
set_target_properties(
|
|
owlps-resultreader-udp
|
|
owlps-resultreader-udp.semistatic
|
|
owlps-resultreader-udp.static
|
|
PROPERTIES COMPILE_FLAGS ${EXE_FLAGS})
|