diff --git a/CMAKE_INSTRUCTIONS.md b/CMAKE_INSTRUCTIONS.md index aab471b5db..ff845be9dd 100644 --- a/CMAKE_INSTRUCTIONS.md +++ b/CMAKE_INSTRUCTIONS.md @@ -43,9 +43,10 @@ By default, FMS is built without `OpenMP` and in `single precision (r4)` The following build options are available: ``` --DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF --D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON --D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF +-DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF +-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON +-D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF +-DFPIC "Build with position independent code" DEFAULT: OFF -DINTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" DEFAULT: ON -DENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" DEFAULT: ON diff --git a/CMakeLists.txt b/CMakeLists.txt index 524307c7dc..b1d38ada35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,9 +52,10 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Build options -option(OPENMP "Build FMS with OpenMP support" OFF) -option(32BIT "Build 32-bit (r4) FMS library" ON) -option(64BIT "Build 64-bit (r8) FMS library" OFF) +option(OPENMP "Build FMS with OpenMP support" OFF) +option(32BIT "Build 32-bit (r4) FMS library" ON) +option(64BIT "Build 64-bit (r8) FMS library" OFF) +option(FPIC "Build with position independent code" OFF) # Options for compiler definitions option(INTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" ON) @@ -89,6 +90,11 @@ if (WITH_YAML) include_directories(${LIBYAML_INCLUDE_DIR}) endif () +# Enables position independent code (i.e., -fPIC) +if (FPIC) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif () + # Collect FMS Fortran source files list(APPEND fms_fortran_src_files affinity/fms_affinity.F90