misc/libphysfs/CMakeLists.txt
changeset 9192 a8a717cf4a66
parent 9188 ba9cca49a5e2
child 9194 1cc97a207598
equal deleted inserted replaced
9190:4fc0e95e7b64 9192:a8a717cf4a66
   169 endif(UNIX)
   169 endif(UNIX)
   170 
   170 
   171 if(WINDOWS)
   171 if(WINDOWS)
   172     set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   172     set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   173     set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
   173     set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
       
   174     list(APPEND OTHER_LDFLAGS ${SDL_LIBRARY})
   174 endif(WINDOWS)
   175 endif(WINDOWS)
   175 
   176 
   176 if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
   177 if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
   177     add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
   178     add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
   178     message(WARNING " ***")
   179     message(WARNING " ***")
   240 #if(PHYSFS_ARCHIVE_ISO9660)
   241 #if(PHYSFS_ARCHIVE_ISO9660)
   241 #    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
   242 #    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
   242 #    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} CD-ROM")
   243 #    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} CD-ROM")
   243 #endif(PHYSFS_ARCHIVE_ISO9660)
   244 #endif(PHYSFS_ARCHIVE_ISO9660)
   244 
   245 
   245 
   246 ##Hedgewars modifications
   246 ##as needed by Hedgewars configuration
   247 add_library(physfs ${PHYSFS_SRCS})
   247 if(WINDOWS)
   248 set_target_properties(physfs PROPERTIES
   248     option(PHYSFS_BUILD_STATIC "Build static library" FALSE)
   249                           VERSION ${PHYSFS_VERSION}
   249     option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
   250                           SOVERSION ${PHYSFS_SOVERSION}
   250     list(APPEND OTHER_LDFLAGS ${SDL_LIBRARY})
   251                           OUTPUT_NAME ${physfs_output_name})
   251 else(WINDOWS)
   252 target_link_libraries(physfs ${optional_library_libs} ${OTHER_LDFLAGS})
   252     option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
   253 install(TARGETS physfs RUNTIME DESTINATION ${target_binary_install_dir}
   253     option(PHYSFS_BUILD_SHARED "Build shared library" FALSE)
   254                        LIBRARY DESTINATION ${target_library_install_dir}
   254 endif(WINDOWS)
   255                        ARCHIVE DESTINATION ${target_library_install_dir})
   255 
   256 get_target_property(physfs_fullpath physfs LOCATION)
   256 if(PHYSFS_BUILD_STATIC)
       
   257     add_library(physfs STATIC ${PHYSFS_SRCS})
       
   258     set_target_properties(physfs PROPERTIES OUTPUT_NAME ${physfs_output_name}) ##
       
   259     set(lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX}) ##
       
   260     set(lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX}) ##
       
   261 endif(PHYSFS_BUILD_STATIC)
       
   262 
       
   263 if(PHYSFS_BUILD_SHARED)
       
   264     add_library(physfs SHARED ${PHYSFS_SRCS})
       
   265     set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
       
   266     set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
       
   267     set_target_properties(physfs PROPERTIES OUTPUT_NAME ${physfs_output_name}) ##
       
   268     target_link_libraries(physfs ${optional_library_libs} ${OTHER_LDFLAGS})
       
   269     install(TARGETS physfs RUNTIME DESTINATION ${target_library_install_dir}) ##
       
   270     set(lib_prefix ${CMAKE_SHARED_LIBRARY_PREFIX}) ##
       
   271     set(lib_suffix ${CMAKE_SHARED_LIBRARY_SUFFIX}) ##
       
   272 endif(PHYSFS_BUILD_SHARED)
       
   273 
       
   274 if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
       
   275     message(FATAL "Both shared and static libraries are disabled!")
       
   276 endif(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
       
   277 
       
   278 # CMake FAQ says I need this...
       
   279 if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
       
   280     set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
       
   281 endif(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
       
   282 
   257 
   283 ## added standard variables emulating the FindPhysFS.cmake ones (FORCE or cmake won't pick 'em)
   258 ## added standard variables emulating the FindPhysFS.cmake ones (FORCE or cmake won't pick 'em)
   284 set(PHYSFS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/misc/libphysfs/ CACHE STRING "" FORCE)
   259 set(PHYSFS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/misc/libphysfs/ CACHE STRING "Physfs include dir" FORCE)
   285 set(PHYSFS_LIBRARY ${LIBRARY_OUTPUT_PATH}/${lib_prefix}${physfs_output_name}${lib_suffix} CACHE STRING "" FORCE)
   260 set(PHYSFS_LIBRARY ${physfs_fullpath} CACHE STRING "Physfs library path" FORCE)
   286 
   261 
   287 
   262 
   288 ## removed install, language bindings and test program
   263 ## removed language bindings and test program
   289 ## simplified configuration output
   264 ## simplified configuration output
       
   265 ## merged shared and static library building
   290 
   266 
   291 #message(STATUS "PhysFS will be built with ${PHYSFS_FEATURES} support")
   267 #message(STATUS "PhysFS will be built with ${PHYSFS_FEATURES} support")
   292 
   268