CMakeLists.txt
changeset 1035 f6ca3f9af74c
parent 1034 a20aae42114b
child 1037 d452f4da0970
--- a/CMakeLists.txt	Mon Feb 01 21:33:20 2010 -0500
+++ b/CMakeLists.txt	Mon Feb 01 22:04:36 2010 -0500
@@ -379,7 +379,7 @@
         ENDIF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
     ENDIF(DEFINED CMAKE_BUILD_TYPE)
 
-    MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS)
+    MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
         STRING(TOUPPER "${_LANG}" _UPPERLANG)
         STRING(TOLOWER "${_LANG}" _LOWERLANG)
         SET(_TARGET "physfs-${_LOWERLANG}")
@@ -396,6 +396,7 @@
             TARGET_LINK_LIBRARIES(${_TARGET} ${PHYSFS_LIB_TARGET})
             SET_TARGET_PROPERTIES(${_TARGET} PROPERTIES
                 COMPILE_FLAGS "${_EXTRACFLAGS}"
+                LINK_FLAGS "${_EXTRALDFLAGS}"
                 OUTPUT_NAME "physfs"
             )
             INSTALL(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
@@ -450,9 +451,16 @@
     # !!! FIXME: installsitearch might be the wrong location.
     GET_PERL_CONFIG("archlibexp" PERL_INCLUDE_PATH)
     GET_PERL_CONFIG("ccflags" PERL_CCFLAGS)
+    GET_PERL_CONFIG("ldflags" PERL_LDFLAGS)
+    GET_PERL_CONFIG("libperl" PERL_LIBPERL)
     GET_PERL_CONFIG("installsitearch" PERL_INSTALL_PATH)
 
-    CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w")
+    STRING(REGEX REPLACE "^lib" "" PERL_LIBPERL "${PERL_LIBPERL}")
+    STRING(REGEX REPLACE "\.so$" "" PERL_LIBPERL "${PERL_LIBPERL}")
+    STRING(REGEX REPLACE "\.dylib$" "" PERL_LIBPERL "${PERL_LIBPERL}")
+    STRING(REGEX REPLACE "\.dll$" "" PERL_LIBPERL "${PERL_LIBPERL}")
+
+    CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w" "\"-L${PERL_INCLUDE_PATH}/CORE\" -l${PERL_LIBPERL} ${PERL_LDFLAGS}")
     INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
 ENDIF(PHYSFS_BUILD_PERL)
 
@@ -473,7 +481,7 @@
     #MESSAGE(STATUS "RUBY_INCLUDE_DIRS '${RUBY_INCLUDE_DIRS}'")
     #MESSAGE(STATUS "RUBY_LIBRARY '${RUBY_LIBRARY}'")
     #MESSAGE(STATUS "RUBY_VERSION '${RUBY_VERSION}'")
-    #CONFIGURE_SWIG_BINDING(Ruby "${PERL_INSTALL_PATH}" "" "")
+    #CONFIGURE_SWIG_BINDING(Ruby "${PERL_INSTALL_PATH}" "" "" "")
 ENDIF(PHYSFS_BUILD_RUBY)