Skip to content

Commit

Permalink
Link against static lib if shared lib is disabled
Browse files Browse the repository at this point in the history
Create "interface" targets for "geos" and "geos_c" that redirect to
"geos-static" target if shared libs are not being built.
  • Loading branch information
Kirill888 committed Mar 26, 2019
1 parent f2600b7 commit 857372e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions capi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK AND GEOS_BUILD_SHARED)

add_dependencies(geos_c geos_revision)

else()
add_library(geos_c INTERFACE)
target_link_libraries(geos_c INTERFACE geos-static)
endif()


Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ else()

endif()

if(NOT GEOS_BUILD_SHARED)
add_library(geos INTERFACE)
target_link_libraries(geos INTERFACE geos-static)
endif()

endif() # (GEOS_ENABLE_MACOSX_FRAMEWORK)

# if(APPLE)
Expand Down

0 comments on commit 857372e

Please sign in to comment.