config.cmake.in 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #include(CMakeFindDependencyMacro)
  2. #find_dependency(<there are none>)
  3. set(_supported_components static shared)
  4. # if the targets files exist it is save to include them, even if they are not
  5. # demanded
  6. include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-sharedTargets.cmake" OPTIONAL)
  7. include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-staticTargets.cmake" OPTIONAL)
  8. # if a specific component is explicitly demanded...
  9. foreach(_comp ${@PROJECT_NAME@_FIND_COMPONENTS})
  10. # ...check if it is supported and...
  11. if(NOT
  12. ";${_supported_components};"
  13. MATCHES
  14. ${_comp})
  15. set(@PROJECT_NAME@_FOUND False)
  16. set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
  17. continue()
  18. endif()
  19. # ...check if it is installed...
  20. include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-${_comp}Targets.cmake"
  21. OPTIONAL RESULT_VARIABLE included)
  22. if(NOT included)
  23. # ...and fail verbosely
  24. set(@PROJECT_NAME@_FOUND False)
  25. set(@PROJECT_NAME@_NOT_FOUND_MESSAGE
  26. "Requested component not installed: ${_comp}")
  27. endif()
  28. endforeach()