diff --git a/CMakeLists.txt b/CMakeLists.txt index 056acea84c..7f760aa907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,9 @@ endif () # Get the name of the build host cmake_host_system_information (RESULT FQDN_SITENAME QUERY FQDN) +# Build position independent code (PIC) for shared library builds +set(CMAKE_POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}) + # Backwards Compatibility - allow users to define [NETCDF|PNETCDF]_DIR instead # of [NetCDF|PnetCDF]_PATH # Old NETCDF_DIR variable --> NetCDF_PATH