FindEXPAT.cmake 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. set(_q "")
  2. if(EXPAT_FIND_QUIETLY)
  3. set(_q QUIET)
  4. endif()
  5. find_package(EXPAT ${EXPAT_FIND_VERSION} CONFIG ${_q})
  6. if(NOT EXPAT_FIND_QUIETLY)
  7. if (NOT EXPAT_FOUND)
  8. message(STATUS "Falling back to MODULE search for EXPAT...")
  9. else()
  10. message(STATUS "EXPAT found in ${EXPAT_DIR}")
  11. endif()
  12. endif()
  13. if (NOT EXPAT_FOUND)
  14. set(_modpath ${CMAKE_MODULE_PATH})
  15. set(CMAKE_MODULE_PATH "")
  16. include(FindEXPAT)
  17. set(CMAKE_MODULE_PATH ${_modpath})
  18. if (NOT TARGET EXPAT::EXPAT)
  19. add_library(EXPAT::EXPAT INTERFACE)
  20. target_link_libraries(EXPAT::EXPAT INTERFACE ${EXPAT_LIBRARIES})
  21. target_include_directories(EXPAT::EXPAT INTERFACE ${EXPAT_INCLUDE_DIRS})
  22. endif ()
  23. endif()
  24. if (EXPAT_FOUND AND NOT TARGET EXPAT::EXPAT AND TARGET expat::expat)
  25. add_library(libexpat_ps_namefix INTERFACE)
  26. add_library(EXPAT::EXPAT ALIAS libexpat_ps_namefix)
  27. target_link_libraries(libexpat_ps_namefix INTERFACE expat::expat)
  28. if (NOT EXPAT_LIBRARIES)
  29. set(EXPAT_LIBRARIES expat::expat CACHE STRING "")
  30. endif ()
  31. endif ()