]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: set POSITION_INDEPENDENT_CODE compiler variable
authorMatthias Maier <tamiko@43-1.org>
Wed, 29 Mar 2023 18:01:27 +0000 (13:01 -0500)
committerMatthias Maier <tamiko@43-1.org>
Wed, 29 Mar 2023 18:05:49 +0000 (13:05 -0500)
cmake/macros/macro_populate_target_properties.cmake

index 7e3572b649d0d0cc384033c997b06b5e8439ccd1..255398e8d06a93d9041d3897d79f40c5509f17ec 100644 (file)
@@ -87,6 +87,18 @@ function(populate_target_properties _target _build)
     ${DEAL_II_DEFINITIONS} ${DEAL_II_DEFINITIONS_${_build}}
     )
 
+  #
+  # Add target properties:
+  #
+  #  - set POSITION_INDEPENDENT_CODE to true to compile everything with
+  #    the -fpic/-fPIC compiler flag. This ensures that we can link all
+  #    object targets into a relocatable library at the end.
+  #
+
+  set_target_properties(${_target} PROPERTIES
+    POSITION_INDEPENDENT_CODE TRUE
+    )
+
   #
   # Add compile and link options with private scope, and add the link
   # interface:

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.