Skip to content
Snippets Groups Projects
Commit b2d54827 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Merge branch 'feature/allow-shared-libs-with-object-libaries' into 'master'

Allow using object libraries in conjunction with shared libs.

CMake's object libraries cannot judge whether they will be used
in shared libraries. To allow ease of in core and downstream modules
we resort to compiling position independent code whenever shared DUNE
libraries are requested. This is done by setting CMAKE_POSITION_INDEPENDENT_CODE
to ON. Please not that the can be overriding manually by setting the target
property POSITION_INDEPENDENT_CODE to something else where needed.

Closes staging/dune-uggrid#16

See merge request !160
parents 16aa6f29 55fc9c48
No related branches found
No related tags found
No related merge requests found
......@@ -659,6 +659,14 @@ macro(dune_project)
option(DUNE_BUILD_BOTH_LIBS "If set to ON, shared and static libs will be built"
${_default_enable_static})
# As default request position independent code if shared libraries are built
# This should allow DUNE modules to use CMake's object libraries.
# This can be overwritten for targets by setting the target property
# POSITION_INDEPENDENT_CODE to false/OFF
if(BUILD_SHARED_LIBS)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
if(DUNE_USE_ONLY_STATIC_LIBS)
# Use only static libraries.
# We do this by overriding the library suffixes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment