this should hijack the linker name and always pick the bundled physfs when another version is already prsent
--- a/CMakeLists.txt Sat Feb 23 18:49:45 2013 +0100
+++ b/CMakeLists.txt Sun Feb 24 19:11:58 2013 +0100
@@ -273,7 +273,9 @@
endif()
if(NOT PHYSFS_FOUND)
message(STATUS "PhysFS will be provided by the bundled sources")
+ set(physfs_output_name "hw_physfs")
add_subdirectory(misc/libphysfs)
+ list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}")
endif()
add_subdirectory(misc/libphyslayer)
--- a/hedgewars/uPhysFSLayer.pas Sat Feb 23 18:49:45 2013 +0100
+++ b/hedgewars/uPhysFSLayer.pas Sun Feb 24 19:11:58 2013 +0100
@@ -3,19 +3,15 @@
interface
uses SDLh, LuaPas;
-const
-{$IFDEF WIN32}
- PhysfsLibName = 'libphysfs';
- PhyslayerLibName = 'libphyslayer';
-{$ELSE}
- {$LINKLIB physfs}
- {$LINKLIB physlayer}
- PhysfsLibName = 'physfs';
- PhyslayerLibName = 'physlayer';
-{$ENDIF}
+const PhysfsLibName = 'libphysfs';
+const PhyslayerLibName = 'libphyslayer';
-{$IFDEF DARWIN}
- {$LINKFRAMEWORK IOKit}
+{$IFNDEF WIN32}
+ {$linklib physfs}
+ {$linklib physlayer}
+ {$IFDEF DARWIN}
+ {$linkframework IOKit}
+ {$ENDIF}
{$ENDIF}
procedure initModule;
--- a/misc/libphysfs/CMakeLists.txt Sat Feb 23 18:49:45 2013 +0100
+++ b/misc/libphysfs/CMakeLists.txt Sun Feb 24 19:11:58 2013 +0100
@@ -253,7 +253,7 @@
if(PHYSFS_BUILD_STATIC)
add_library(physfs STATIC ${PHYSFS_SRCS})
- set_target_properties(physfs PROPERTIES OUTPUT_NAME "physfs")
+ set_target_properties(physfs PROPERTIES OUTPUT_NAME ${physfs_output_name}) ##
set(lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX}) ##
set(lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX}) ##
endif(PHYSFS_BUILD_STATIC)
@@ -262,6 +262,7 @@
add_library(physfs SHARED ${PHYSFS_SRCS})
set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
+ set_target_properties(physfs PROPERTIES OUTPUT_NAME ${physfs_output_name}) ##
target_link_libraries(physfs ${optional_library_libs} ${OTHER_LDFLAGS})
install(TARGETS physfs RUNTIME DESTINATION ${target_library_install_dir}) ##
set(lib_prefix ${CMAKE_SHARED_LIBRARY_PREFIX}) ##
@@ -279,7 +280,7 @@
## added standard variables emulating the FindPhysFS.cmake ones (FORCE or cmake won't pick 'em)
set(PHYSFS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/misc/libphysfs/ CACHE STRING "" FORCE)
-set(PHYSFS_LIBRARY ${LIBRARY_OUTPUT_PATH}/${lib_prefix}physfs${lib_suffix} CACHE STRING "" FORCE)
+set(PHYSFS_LIBRARY ${LIBRARY_OUTPUT_PATH}/${lib_prefix}${physfs_output_name}${lib_suffix} CACHE STRING "" FORCE)
## this is to avoid find_package() find the just built library and shadowing it at next cmake run
set(PHYSFS_BUNDLE TRUE CACHE STRING "" FORCE)