CMake: add static targets

The pseudo-targets "semistatic" and "static" were added to build
everything in semistatic or static mode.
This commit is contained in:
Matteo Cypriani 2013-05-19 14:32:57 -04:00 committed by Matteo Cypriani
parent 93a184f083
commit 4264210dcc
8 changed files with 99 additions and 1 deletions

View File

@ -110,3 +110,12 @@ else() # we're not using GCC
endif()
add_subdirectory(owlps-udp-to-http)
### Meta-targets ###
# The OWLPS_SEMISTATIC_TARGET is defined in subdirectories
add_custom_target(semistatic DEPENDS ${OWLPS_SEMISTATIC_TARGETS})
# The OWLPS_STATIC_TARGET is defined in subdirectories
add_custom_target(static DEPENDS ${OWLPS_STATIC_TARGETS})

View File

@ -58,7 +58,6 @@ Work to do in OwlPS
- CMake:
- libraries: version numbers (sonames) and symbolic links
- installation targets
- static targets
- Support string-based positioning requests

View File

@ -14,3 +14,17 @@ add_executable(owlps-resultreader-udp.semistatic EXCLUDE_FROM_ALL
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)

View File

@ -10,3 +10,17 @@ add_executable(owlps-aggregatord.semistatic EXCLUDE_FROM_ALL
target_link_libraries(owlps-aggregatord.semistatic
libowlps.a
${EXTRA_LIBS})
# Add the semistatic target to the global list of semistatic targets
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-aggregatord.semistatic)
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
add_executable(owlps-aggregatord.static EXCLUDE_FROM_ALL
owlps-aggregatord.c)
set_target_properties(owlps-aggregatord.static
PROPERTIES LINK_FLAGS -static)
target_link_libraries(owlps-aggregatord.static
libowlps.a
${EXTRA_LIBS})
# Add the static target to the global list of static targets
list(APPEND OWLPS_STATIC_TARGETS owlps-aggregatord.static)
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)

View File

@ -29,3 +29,21 @@ if (OWLPS_CLIENT_RECEIVES_POSITION)
target_link_libraries(owlps-client.semistatic
libowlps-resultreader.a)
endif()
# Add the semistatic target to the global list of semistatic targets
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-client.semistatic)
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
add_executable(owlps-client.static EXCLUDE_FROM_ALL
owlps-client.c)
set_target_properties(owlps-client.static
PROPERTIES LINK_FLAGS -static)
target_link_libraries(owlps-client.static
libowlps.a
libowlps-client.a)
if (OWLPS_CLIENT_RECEIVES_POSITION)
target_link_libraries(owlps-client.static
libowlps-resultreader.a)
endif()
# Add the static target to the global list of static targets
list(APPEND OWLPS_STATIC_TARGETS owlps-client.static)
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)

View File

@ -44,3 +44,18 @@ target_link_libraries(owlps-listenerd.semistatic
libowlps.a
libowlps-client.a
${EXTRA_LIBS})
# Add the semistatic target to the global list of semistatic targets
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-listenerd.semistatic)
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
add_executable(owlps-listenerd.static EXCLUDE_FROM_ALL
owlps-listenerd.c)
set_target_properties(owlps-listenerd.static
PROPERTIES LINK_FLAGS -static)
target_link_libraries(owlps-listenerd.static
libowlps.a
libowlps-client.a
${EXTRA_LIBS})
# Add the static target to the global list of static targets
list(APPEND OWLPS_STATIC_TARGETS owlps-listenerd.static)
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)

View File

@ -73,6 +73,20 @@ add_executable(owlps-positionerd.semistatic EXCLUDE_FROM_ALL
target_link_libraries(owlps-positionerd.semistatic
libowlps.a
${EXTRA_LIBS})
# Add the semistatic target to the global list of semistatic targets
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-positionerd.semistatic)
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
add_executable(owlps-positionerd.static EXCLUDE_FROM_ALL
${OWLPS_POSITIONER_SRC_FILES})
set_target_properties(owlps-positionerd.static
PROPERTIES LINK_FLAGS -static)
target_link_libraries(owlps-positionerd.static
libowlps.a
${EXTRA_LIBS})
# Add the static target to the global list of static targets
list(APPEND OWLPS_STATIC_TARGETS owlps-positionerd.static)
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)
### Extra targets ###

View File

@ -12,3 +12,18 @@ target_link_libraries(owlps-udp-to-http.semistatic
libowlps.a
libowlps-resultreader.a
${EXTRA_LIBS})
# Add the semistatic target to the global list of semistatic targets
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-udp-to-http.semistatic)
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
add_executable(owlps-udp-to-http.static EXCLUDE_FROM_ALL
owlps-udp-to-http.c)
set_target_properties(owlps-udp-to-http.static
PROPERTIES LINK_FLAGS -static)
target_link_libraries(owlps-udp-to-http.static
libowlps.a
libowlps-resultreader.a
${EXTRA_LIBS})
# Add the static target to the global list of static targets
list(APPEND OWLPS_STATIC_TARGETS owlps-udp-to-http.static)
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)