Browse Source
Make the Ginac find package more standard compliant
Make the Ginac find package more standard compliant
Former-commit-id: b6176f1d2d
tempestpy_adaptions
hbruintjes
9 years ago
2 changed files with 50 additions and 20 deletions
@ -1,24 +1,54 @@ |
|||||
set( GINAC_FOUND FALSE ) |
|
||||
|
# - Try to find libginac |
||||
|
# Once done this will define |
||||
|
# GINAC_FOUND - System has ginac |
||||
|
# GINAC_INCLUDE_DIR - The ginac include directory |
||||
|
# GINAC_LIBRARIES - The libraries needed to use ginac |
||||
|
# GINAC_VERSION_STRING - The version of ginac ("major.minor.micro") |
||||
|
|
||||
find_path( GINAC_INCLUDE_DIR ginac.h |
|
||||
/usr/include/ginac |
|
||||
/usr/local/include/ginac |
|
||||
/opt/local/include/ginac |
|
||||
$ENV{UNITTESTXX_PATH}/src |
|
||||
$ENV{UNITTESTXX_INCLUDE_PATH} ) |
|
||||
|
# use pkg-config to get the directories and then use these values |
||||
|
# in the find_path() and find_library() calls |
||||
|
find_package(PkgConfig QUIET) |
||||
|
PKG_CHECK_MODULES(PC_GINAC QUIET ginac) |
||||
|
|
||||
find_library( GINAC_LIBRARIES NAMES ginac PATHS |
|
||||
/usr/lib |
|
||||
/usr/local/lib |
|
||||
/opt/local/lib |
|
||||
$ENV{UNITTESTXX_PATH} |
|
||||
ENV{UNITTESTXX_LIBRARY_PATH} ) |
|
||||
|
find_path(GINAC_INCLUDE_DIR NAMES ginac.h |
||||
|
HINTS |
||||
|
${PC_GINAC_INCLUDEDIR} |
||||
|
${PC_GINAC_INCLUDE_DIRS} |
||||
|
PATH_SUFFIXES ginac |
||||
|
) |
||||
|
|
||||
|
find_library(GINAC_LIBRARIES NAMES ginac |
||||
|
HINTS |
||||
|
${PC_GINAC_LIBDIR} |
||||
|
${PC_GINAC_LIBRARY_DIRS} |
||||
|
) |
||||
|
|
||||
if( GINAC_INCLUDE_DIR AND GINAC_LIBRARIES ) |
|
||||
SET( GINAC_FOUND TRUE ) |
|
||||
ENDIF (GINAC_INCLUDE_DIR AND GINAC_LIBRARIES) |
|
||||
|
if(PC_GINAC_VERSION) |
||||
|
set(GINAC_VERSION_STRING ${PC_GINAC_VERSION}) |
||||
|
elseif(GINAC_INCLUDE_DIR AND EXISTS "${GINAC_INCLUDE_DIR}/ginac.h") |
||||
|
file(STRINGS "${GINAC_INCLUDE_DIR}/ginac.h" ginac_major_version |
||||
|
REGEX "^#define[\t ]+GINACLIB_MAJOR_VERSION[\t ]+.+") |
||||
|
file(STRINGS "${GINAC_INCLUDE_DIR}/ginac.h" ginac_minor_version |
||||
|
REGEX "^#define[\t ]+GINACLIB_MINOR_VERSION[\t ]+.+") |
||||
|
file(STRINGS "${GINAC_INCLUDE_DIR}/ginac.h" ginac_micro_version |
||||
|
REGEX "^#define[\t ]+GINACLIB_MICRO_VERSION[\t ]+.+") |
||||
|
string(REGEX REPLACE "^#define[\t ]+GINACLIB_MAJOR_VERSION[\t ]+(.+)" "\\1" |
||||
|
ginac_major_version "${ginac_major_version}") |
||||
|
string(REGEX REPLACE "^#define[\t ]+GINACLIB_MINOR_VERSION[\t ]+(.+)" "\\1" |
||||
|
ginac_minor_version "${ginac_minor_version}") |
||||
|
string(REGEX REPLACE "^#define[\t ]+GINACLIB_MICRO_VERSION[\t ]+(.+)" "\\1" |
||||
|
ginac_micro_version "${ginac_micro_version}") |
||||
|
set(GINAC_VERSION_STRING "${ginac_major_version}.${ginac_minor_version}.${ginac_micro_version}") |
||||
|
unset(ginac_major_version) |
||||
|
unset(ginac_minor_version) |
||||
|
unset(ginac_micro_version) |
||||
|
endif() |
||||
|
|
||||
|
# handle the QUIETLY and REQUIRED arguments and set GINAC_FOUND to TRUE if |
||||
|
# all listed variables are TRUE |
||||
|
include(FindPackageHandleStandardArgs) |
||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GINAC |
||||
|
REQUIRED_VARS GINAC_LIBRARIES GINAC_INCLUDE_DIR |
||||
|
VERSION_VAR GINAC_VERSION_STRING) |
||||
|
|
||||
MARK_AS_ADVANCED ( GINAC_INCLUDE_DIR |
|
||||
GINAC_LIBRARIES |
|
||||
) |
|
||||
|
mark_as_advanced(GINAC_INCLUDE_DIR GINAC_LIBRARIES) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue