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

Commit

Permalink
Fixed problem that occurs if the LIBS environment variable has leadin…
Browse files Browse the repository at this point in the history
…g or trailing spaces
  • Loading branch information
daminton committed Aug 17, 2023
1 parent 4aa0e1a commit 8c99d27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmake/Modules/FindNETCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ ELSE ()
MESSAGE(FATAL_ERROR "Cannot find nc-config")
ENDIF ()
IF (DEFINED ENV{LIBS})
SEPARATE_ARGUMENTS(LIBS NATIVE_COMMAND "$ENV{LIBS}")
STRING(STRIP "$ENV{LIBS}" LIBS)
SEPARATE_ARGUMENTS(LIBS NATIVE_COMMAND "$LIBS")
LIST(APPEND EXTRA_FLAGS ${LIBS})
ENDIF()

Expand Down
7 changes: 6 additions & 1 deletion swiftest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ IF(USE_OPENMP OR USE_SIMD)
SET_PROPERTY(TARGET ${SWIFTEST_BINDINGS} APPEND_STRING PROPERTY COMPILE_FLAGS "${OpenMP_Fortran_FLAGS} ")
ENDIF()

TARGET_LINK_LIBRARIES(${SWIFTEST_BINDINGS} swiftest ${NETCDF_LIBRARIES} $ENV{LIBS})
IF (DEFINED ENV{LIBS})
STRING(STRIP "$ENV{LIBS}" LIBS)
SEPARATE_ARGUMENTS(LIBS NATIVE_COMMAND "$LIBS")
ENDIF()

TARGET_LINK_LIBRARIES(${SWIFTEST_BINDINGS} swiftest ${NETCDF_LIBRARIES} $LIBS)
PYTHON_EXTENSION_MODULE(${SWIFTEST_BINDINGS})
TARGET_INCLUDE_DIRECTORIES(${SWIFTEST_BINDINGS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${MOD} ${NETCDF_INCLUDE_DIR})
INSTALL(TARGETS ${SWIFTEST_BINDINGS} LIBRARY DESTINATION swiftest)

0 comments on commit 8c99d27

Please sign in to comment.