PhysFSConfig.cmake.in 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. include(FeatureSummary)
  2. set_package_properties(PhysicsFS PROPERTIES
  3. URL "https://icculus.org/physfs/"
  4. DESCRIPTION "Library to provide abstract access to various archives"
  5. )
  6. @PACKAGE_INIT@
  7. set(PHYSFS_PLATFORM_SDL3 @PHYSFS_PLATFORM_SDL3@)
  8. set(PhysFS_PhysFS_FOUND)
  9. set(PhysFS_PhysFS-shared_FOUND)
  10. if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/PhysFS-shared-targets.cmake")
  11. include("${CMAKE_CURRENT_LIST_DIR}/PhysFS-shared-targets.cmake")
  12. set(PhysFS_PhysFS-shared_FOUND TRUE)
  13. set(PhysFS_PhysFS_FOUND TRUE)
  14. endif()
  15. set(PhysFS_PhysFS-static_FOUND)
  16. if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/PhysFS-static-targets.cmake")
  17. if(PHYSFS_PLATFORM_SDL3)
  18. include(CMakeFindDependencyMacro)
  19. find_dependency(SDL3)
  20. endif()
  21. include("${CMAKE_CURRENT_LIST_DIR}/PhysFS-static-targets.cmake")
  22. set(PhysFS_PhysFS-static_FOUND TRUE)
  23. set(PhysFS_PhysFS_FOUND TRUE)
  24. endif()
  25. function(_physfsl_create_target_alias_compat NEW_TARGET TARGET)
  26. if(CMAKE_VERSION VERSION_LESS "3.18")
  27. # Aliasing local targets is not supported on CMake < 3.18, so make it global.
  28. add_library(${NEW_TARGET} INTERFACE IMPORTED)
  29. set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
  30. else()
  31. add_library(${NEW_TARGET} ALIAS ${TARGET})
  32. endif()
  33. endfunction()
  34. # Make sure PhysFS::PhysFS always exists
  35. if(NOT TARGET PhysFS::PhysFS)
  36. if(TARGET PhysFS::PhysFS-shared)
  37. _physfsl_create_target_alias_compat(PhysFS::PhysFS PhysFS::PhysFS-shared)
  38. elseif(TARGET PhysFS::PhysFS-static)
  39. _physfsl_create_target_alias_compat(PhysFS::PhysFS PhysFS::PhysFS-static)
  40. endif()
  41. endif()
  42. check_required_components(PhysFS)