Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Made PIC a propery of the library and driver targets even when shared…
Browse files Browse the repository at this point in the history
… libraries are built
  • Loading branch information
daminton committed Feb 15, 2024
1 parent c7ebbb6 commit 1c92aef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ ADD_EXECUTABLE(${SWIFTEST_DRIVER} ${DRIVER_src})
#####################################################
# Create a library from the source files, except the driver
ADD_LIBRARY(${SWIFTEST_LIBRARY} ${SWIFTEST_src})
IF (NOT BUILD_SHARED_LIBS)
SET_PROPERTY(TARGET ${SWIFTEST_LIBRARY} PROPERTY POSITION_INDEPENDENT_CODE)
ENDIF ()
SET_PROPERTY(TARGET ${SWIFTEST_LIBRARY} ${SWIFTEST_DRIVER} PROPERTY POSITION_INDEPENDENT_CODE)

TARGET_LINK_LIBRARIES(${SWIFTEST_LIBRARY} PUBLIC netCDF::netcdff HDF5::HDF5)
TARGET_LINK_LIBRARIES(${SWIFTEST_DRIVER} PUBLIC ${SWIFTEST_LIBRARY} netCDF::netcdff HDF5::HDF5)
TARGET_LINK_LIBRARIES(${SWIFTEST_DRIVER} PUBLIC netCDF::netcdff HDF5::HDF5)

IF(USE_OPENMP OR USE_SIMD)
TARGET_LINK_LIBRARIES(${SWIFTEST_LIBRARY} PUBLIC SHTOOLS::parallel)
Expand All @@ -147,6 +145,8 @@ ELSE ()
TARGET_LINK_LIBRARIES(${SWIFTEST_DRIVER} PUBLIC SHTOOLS::serial)
ENDIF()

TARGET_LINK_LIBRARIES(${SWIFTEST_DRIVER} PUBLIC ${SWIFTEST_LIBRARY})

IF (CMAKE_SYSTEM_NAME STREQUAL "Windows")
SET_PROPERTY(TARGET ${SWIFTEST_LIBRARY} ${SWIFTEST_DRIVER} APPEND_STRING PROPERTY LINK_FLAGS "/NODEFAULTLIB")
ENDIF()
Expand Down

0 comments on commit 1c92aef

Please sign in to comment.