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.

42 lines
1.0 KiB

3 months ago
  1. # Include dir
  2. find_path(GINAC_INCLUDE_DIR
  3. NAMES ginac.h
  4. PATHS
  5. /usr/include/ginac
  6. /usr/local/include/ginac
  7. DOC "Include directory for GiNaC"
  8. )
  9. find_library(GINAC_LIBRARY
  10. NAMES ginac
  11. PATHS
  12. /usr/lib
  13. /usr/local/lib
  14. )
  15. if(GINAC_INCLUDE_DIR AND GINAC_LIBRARY)
  16. set(GINAC_FOUND TRUE)
  17. # Version
  18. function(GetVersionPart OUTPUT FILENAME DESC)
  19. file(STRINGS ${FILENAME} RES REGEX "^#define GINACLIB_${DESC}_VERSION[ \\t]+.*")
  20. string(REGEX MATCH "[0-9]+" RES "${RES}")
  21. set(${OUTPUT} "${RES}" PARENT_SCOPE)
  22. endfunction()
  23. GetVersionPart(MAJOR "${GINAC_INCLUDE_DIR}/version.h" "MAJOR")
  24. GetVersionPart(MINOR "${GINAC_INCLUDE_DIR}/version.h" "MINOR")
  25. GetVersionPart(MICRO "${GINAC_INCLUDE_DIR}/version.h" "MICRO")
  26. set(GINAC_VERSION "${MAJOR}.${MINOR}.${MICRO}")
  27. if(GINAC_FIND_VERSION VERSION_GREATER GINAC_VERSION)
  28. message(WARNING "Required GiNaC ${GINAC_FIND_VERSION} but found only GiNaC ${GINAC_VERSION}.")
  29. return()
  30. endif()
  31. endif()
  32. mark_as_advanced(
  33. GINAC_FOUND
  34. GINAC_INCLUDE_DIR
  35. GINAC_LIBRARY
  36. GINAC_VERSION
  37. )