CMakeLists.txt
changeset 1037 d452f4da0970
parent 1035 f6ca3f9af74c
child 1038 16b7dedb02a5
--- a/CMakeLists.txt	Mon Feb 01 23:04:25 2010 -0500
+++ b/CMakeLists.txt	Mon Feb 01 23:15:36 2010 -0500
@@ -452,15 +452,24 @@
     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)
 
-    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}")
+    # !!! FIXME: this test for Mac OS X is wrong.
+    IF(MACOSX)
+        GET_PERL_CONFIG("libperl" PERL_LIBPERL)
+        SET(TMPLIBPERL "${PERL_LIBPERL}")
+        STRING(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
+        STRING(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
+        STRING(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
+        STRING(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
+        IF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
+            MESSAGE(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
+            SET(PERL_LIBPERL "${TMPLIBPERL}")
+        ENDIF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
+        SET(PERL_LIBPERL "-l${PERL_LIBPERL}")
+    ENDIF(MACOSX)
 
-    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}")
+    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\" ${PERL_LIBPERL} ${PERL_LDFLAGS}")
     INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
 ENDIF(PHYSFS_BUILD_PERL)