Skip to content

Commit

Permalink
swig: Fix linking targets to dependencies
Browse files Browse the repository at this point in the history
- perl5: add missing linking against `${PERL_LIBRARY}`

- ruby: fix linking, replace `${RUBY_LIBRARIES}` with `${RUBY_LIBRARY}`
  `${RUBY_LIBRARY}` and `${Ruby_LIBRARIES}` can be used - same meaning.

- use `target_link_libraries` instead of deprecated `swig_link_libraries`
  `swig_link_libraries` has been deprecated since cmake 3.13
  • Loading branch information
jrohel authored and Conan-Kudo committed Aug 31, 2023
1 parent 1c39410 commit da05ceb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bindings/go/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function(add_go_module LIBRARY_NAME MODULE_NAME)
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})

string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${C_LIBRARY_NAME})
endfunction()


Expand Down
3 changes: 2 additions & 1 deletion bindings/perl5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function(add_perl5_module LIBRARY_NAME MODULE_NAME)
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})

string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${C_LIBRARY_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${PERL_LIBRARY})

install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION "${PERL_INSTALL_PATH}/auto/${LIBRARY_NAME}/${MODULE_NAME}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.pm" DESTINATION "${PERL_INSTALL_PATH}/${LIBRARY_NAME}")
Expand Down
4 changes: 2 additions & 2 deletions bindings/python3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function(add_python3_module LIBRARY_NAME MODULE_NAME)
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})

string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${Python3_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${C_LIBRARY_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${Python3_LIBRARIES})

# generate a dist-info for the library (redundantly created for multi-module packages, oh well...)
set(DISTINFO_PATH "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}-${CMAKE_PROJECT_VERSION}.dist-info")
Expand Down
4 changes: 2 additions & 2 deletions bindings/ruby/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function(add_ruby_module LIBRARY_NAME MODULE_NAME)
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})

string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${RUBY_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${C_LIBRARY_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${RUBY_LIBRARY})

install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION "${RUBY_VENDORARCH_DIR}/${LIBRARY_NAME}")
endfunction()
Expand Down

0 comments on commit da05ceb

Please sign in to comment.