Skip to content

Commit

Permalink
Merge pull request #334 from MuellerSeb/PIC_fix
Browse files Browse the repository at this point in the history
set 'CMAKE_POSITION_INDEPENDENT_CODE ON' for shared lib
  • Loading branch information
WardF authored Mar 10, 2022
2 parents 43e3308 + e237ad1 commit bda0cec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ OPTION(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
SET(LIB_TYPE SHARED)
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
string(APPEND CMAKE_C_FLAGS " -fPIC")
ENDIF()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()

# Supress unused variable and parameter warnings, for the time being,
Expand Down
4 changes: 1 addition & 3 deletions fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ OPTION(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
SET(LIB_TYPE SHARED)
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()

# This is what we are building: a convenience library of Fortran 2003 functions.
Expand Down

0 comments on commit bda0cec

Please sign in to comment.