Opened 7 years ago

Closed 7 years ago

#816 closed enhancement (worksforme)

CMake: Replace GEOS_BUILD_STATIC|SHARED with BUILD_SHARED_LIBS

Reported by: mloskot Owned by: mloskot
Priority: major Milestone:
Component: Build/Install (cmake) Version: main
Severity: Significant Keywords:
Cc:

Description (last modified by mloskot)

The task is to ditch the custom CMake options and replace it with BUILD_SHARED_LIBS which is standard CMake option (a global flag).

Passing -DBUILD_SHARED_LIBS=ON to cmake causes add_library to create shared libraries, automatically, setting position independent code flags, if necessary.

TODO:

  • Replace GEOS_BUILD_STATIC and GEOS_BUILD_SHARED with BUILD_SHARED_LIBS.
  • Update docs/wiki.
  • Add/Update static/shared target build to CI builds.

Motivation: two custom options less; get closer to CMake recommended/best practices.


A good example of CMake configuration using the BUILD_SHARED_LIBS is FreeType2 project: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/CMakeLists.txt

It shows how to use the option for OSX, distinguish APPLE vs FRAMEWORK modes.

I don't have access to Mac OS X myself though, so this part is missing from this PR.

Patches for Mac OS X will be welcome.

Change History (2)

comment:1 by mloskot, 7 years ago

Description: modified (diff)

comment:2 by mloskot, 7 years ago

Resolution: worksforme
Status: assignedclosed
Note: See TracTickets for help on using tickets.