Skip to content

Commit 1f0770b

Browse files
committed
Use PIC for (default) static lib
`caf` wrapper script defaults to static linkage against libcaf_mpi.a but if you're building a shared lib with the `caf` script this fails because objects in `libcaf_mpi.a` are not compiled with `-fPIC`. So creating shared libs fails. The wrapper script should probably default to building and linking against the shared lib
1 parent 926a2bb commit 1f0770b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/mpi/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ target_link_libraries(caf_mpi_static
3939
PUBLIC ${MPI_C_LINK_FLAGS}
4040
PUBLIC ${MPI_C_LIBRARIES}
4141
PRIVATE opencoarrays_mod)
42+
set_target_properties(caf_mpi_static
43+
PROPERTIES
44+
POSITION_INDEPENDENT_CODE TRUE)
4245
target_include_directories(caf_mpi
4346
PUBLIC $<$<COMPILE_LANGUAGE:C>:${MPI_C_INCLUDE_PATH}>)
4447
target_include_directories(caf_mpi_static

0 commit comments

Comments
 (0)