You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
836 B

2 months ago
  1. # Include dir
  2. find_path(COCOA_INCLUDE_DIR
  3. NAMES CoCoA/library.H
  4. PATHS
  5. /usr/include/
  6. /usr/local/include/
  7. DOC "Include directory for CoCoA"
  8. )
  9. find_library(COCOA_LIBRARY
  10. NAMES cocoa
  11. PATHS
  12. /usr/lib
  13. /usr/local/lib
  14. )
  15. if(COCOA_INCLUDE_DIR AND COCOA_LIBRARY)
  16. set(COCOA_FOUND TRUE)
  17. # Version
  18. function(GetVersion OUTPUT FILENAME)
  19. file(STRINGS ${FILENAME} RES REGEX "CoCoALib version .*")
  20. string(REGEX MATCH "[0-9]+\.[0-9]+" RES "${RES}")
  21. set(${OUTPUT} "${RES}" PARENT_SCOPE)
  22. endfunction()
  23. GetVersion(COCOA_VERSION "${COCOA_INCLUDE_DIR}/CoCoA/library.H")
  24. if(COCOA_FIND_VERSION VERSION_GREATER COCOA_VERSION)
  25. message(WARNING "Required CoCoA ${COCOA_FIND_VERSION} but found only CoCoA ${COCOA_VERSION}.")
  26. return()
  27. endif()
  28. endif()
  29. mark_as_advanced(
  30. COCOA_FOUND
  31. COCOA_INCLUDE_DIR
  32. COCOA_LIBRARY
  33. COCOA_VERSION
  34. )