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.

54 lines
2.2 KiB

  1. # - Try to find libginac
  2. # Once done this will define
  3. # GINAC_FOUND - System has ginac
  4. # GINAC_INCLUDE_DIR - The ginac include directory
  5. # GINAC_LIBRARIES - The libraries needed to use ginac
  6. # GINAC_VERSION_STRING - The version of ginac ("major.minor.micro")
  7. # use pkg-config to get the directories and then use these values
  8. # in the find_path() and find_library() calls
  9. find_package(PkgConfig QUIET)
  10. PKG_CHECK_MODULES(PC_GINAC QUIET ginac)
  11. find_path(GINAC_INCLUDE_DIR NAMES ginac.h
  12. HINTS
  13. ${PC_GINAC_INCLUDEDIR}
  14. ${PC_GINAC_INCLUDE_DIRS}
  15. PATH_SUFFIXES ginac
  16. )
  17. find_library(GINAC_LIBRARIES NAMES ginac
  18. HINTS
  19. ${PC_GINAC_LIBDIR}
  20. ${PC_GINAC_LIBRARY_DIRS}
  21. )
  22. if(PC_GINAC_VERSION)
  23. set(GINAC_VERSION_STRING ${PC_GINAC_VERSION})
  24. elseif(GINAC_INCLUDE_DIR AND EXISTS "${GINAC_INCLUDE_DIR}/ginac.h")
  25. file(STRINGS "${GINAC_INCLUDE_DIR}/ginac.h" ginac_major_version
  26. REGEX "^#define[\t ]+GINACLIB_MAJOR_VERSION[\t ]+.+")
  27. file(STRINGS "${GINAC_INCLUDE_DIR}/ginac.h" ginac_minor_version
  28. REGEX "^#define[\t ]+GINACLIB_MINOR_VERSION[\t ]+.+")
  29. file(STRINGS "${GINAC_INCLUDE_DIR}/ginac.h" ginac_micro_version
  30. REGEX "^#define[\t ]+GINACLIB_MICRO_VERSION[\t ]+.+")
  31. string(REGEX REPLACE "^#define[\t ]+GINACLIB_MAJOR_VERSION[\t ]+(.+)" "\\1"
  32. ginac_major_version "${ginac_major_version}")
  33. string(REGEX REPLACE "^#define[\t ]+GINACLIB_MINOR_VERSION[\t ]+(.+)" "\\1"
  34. ginac_minor_version "${ginac_minor_version}")
  35. string(REGEX REPLACE "^#define[\t ]+GINACLIB_MICRO_VERSION[\t ]+(.+)" "\\1"
  36. ginac_micro_version "${ginac_micro_version}")
  37. set(GINAC_VERSION_STRING "${ginac_major_version}.${ginac_minor_version}.${ginac_micro_version}")
  38. unset(ginac_major_version)
  39. unset(ginac_minor_version)
  40. unset(ginac_micro_version)
  41. endif()
  42. # handle the QUIETLY and REQUIRED arguments and set GINAC_FOUND to TRUE if
  43. # all listed variables are TRUE
  44. include(FindPackageHandleStandardArgs)
  45. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GINAC
  46. REQUIRED_VARS GINAC_LIBRARIES GINAC_INCLUDE_DIR
  47. VERSION_VAR GINAC_VERSION_STRING)
  48. mark_as_advanced(GINAC_INCLUDE_DIR GINAC_LIBRARIES)