@@ -110,13 +110,12 @@ endif()
110
110
list (REMOVE_DUPLICATES SOURCES )
111
111
112
112
add_library (${BLASLIB} _obj OBJECT ${SOURCES} )
113
- target_compile_options (${BLASLIB} _obj PRIVATE -fPIC )
113
+ set_target_properties (${BLASLIB} _obj PROPERTIES POSITION_INDEPENDENT_CODE ON )
114
114
115
115
if (BUILD_INDEX64_EXT_API )
116
116
#Add _64 suffix to all Fortran functions via macros
117
- set (COPT_64_F )
118
- list (APPEND COPT_64_F -cpp )
119
117
foreach (F IN LISTS SOURCES )
118
+ set (COPT_64_F -cpp )
120
119
file (STRINGS ${F} ${F} .lst )
121
120
list (FILTER ${F} .lst INCLUDE REGEX "subroutine|SUBROUTINE|external|EXTERNAL|function|FUNCTION" )
122
121
list (FILTER ${F} .lst EXCLUDE REGEX "^!.*" )
@@ -128,10 +127,11 @@ if(BUILD_INDEX64_EXT_API)
128
127
string (STRIP ${FUNC} FUNC )
129
128
list (APPEND COPT_64_F "-D${FUNC} =${FUNC} _64" )
130
129
endforeach ()
130
+ list (REMOVE_DUPLICATES COPT_64_F )
131
+ set_source_files_properties (${F} PROPERTIES COMPILE_OPTIONS "${COPT_64_F} " )
131
132
endforeach ()
132
- list (REMOVE_DUPLICATES COPT_64_F )
133
133
add_library (${BLASLIB} _64_obj OBJECT ${SOURCES} )
134
- target_compile_options (${BLASLIB} _64_obj PRIVATE -fPIC ${FOPT_ILP64} ${COPT_64_F } )
134
+ target_compile_options (${BLASLIB} _64_obj PRIVATE ${FOPT_ILP64} )
135
135
endif ()
136
136
137
137
add_library (${BLASLIB}
@@ -142,6 +142,7 @@ set_target_properties(
142
142
${BLASLIB} PROPERTIES
143
143
VERSION ${LAPACK_VERSION}
144
144
SOVERSION ${LAPACK_MAJOR_VERSION}
145
+ POSITION_INDEPENDENT_CODE ON
145
146
)
146
147
lapack_install_library (${BLASLIB} )
147
148
0 commit comments