Skip to content

Commit

Permalink
Add MAKE_POSITION_INDEPENDENT_CODE to geo lib
Browse files Browse the repository at this point in the history
This basically means that on linux (maybe other compiler configs), cmake
will add the -fPIC flag. This amounts to letting you link a static
library into a shared library, which is the case when we link geolib.a
into the openstudio utilities shared library.

This issue only seems to show up on some linux compiler configurations.
(not mine) and not windows or mac as far as I have found. In any case we
are trusting the cmake abstraction MAKE_POSITION_INDEPENDENT_CODE to do
the right thing.
  • Loading branch information
kbenne committed Jan 28, 2016
1 parent a46526f commit 25786f8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ ExternalProject_Add(GeographicLib
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
-DGEOGRAPHICLIB_LIB_TYPE:STRING=STATIC
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
)

# Don't confuse "GEOGRAPHICLIB"_Dir as something that refers to the
Expand Down

2 comments on commit 25786f8

@macumber
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geez, this got hairy

@kbenne
Copy link
Contributor Author

@kbenne kbenne commented on 25786f8 Jan 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was pretty happy when I found out cmake had a solution. Otherwise it does get hairy. When do you need to apply fPIC? What platforms? What compilers? With this cmake takes care of it.

Please sign in to comment.