mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-25 10:20:18 -06:00
Cutecash: Add version check for guile and define HAVE_GUILE18 if appropriate.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18846 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
18f663de25
commit
650b6ffa10
@ -54,10 +54,15 @@ FIND_PACKAGE (SWIG REQUIRED)
|
||||
INCLUDE (${SWIG_USE_FILE})
|
||||
|
||||
# guile
|
||||
FIND_PATH (LIBGUILE_INCLUDE_PATH NAMES libguile.h
|
||||
PATHS /usr/include)
|
||||
FIND_LIBRARY (LIBGUILE_LIBRARIES NAMES guile)
|
||||
FIND_PROGRAM (GUILE_EXECUTABLE guile)
|
||||
FIND_PACKAGE (Guile REQUIRED)
|
||||
|
||||
# Check for guile version > 1.7, i.e. guile-1.8.x?
|
||||
IF (Guile_FIND_VERSION_MAJOR AND ${GUILE_VERSION_MAJOR} EQUAL 1
|
||||
AND Guile_FIND_VERSION_MINOR AND ${GUILE_VERSION_MINOR} GREATER 7)
|
||||
# Yes, define this macro
|
||||
ADD_DEFINITIONS (-DHAVE_GUILE18)
|
||||
ENDIF (Guile_FIND_VERSION_MAJOR AND ${GUILE_VERSION_MAJOR} EQUAL 1
|
||||
AND Guile_FIND_VERSION_MINOR AND ${GUILE_VERSION_MINOR} GREATER 7)
|
||||
|
||||
# ############################################################
|
||||
|
||||
|
78
src/cmake_modules/FindGuile.cmake
Normal file
78
src/cmake_modules/FindGuile.cmake
Normal file
@ -0,0 +1,78 @@
|
||||
# Copyright (c) 2008, OpenCog.org (http://opencog.org)
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
# - Try to find Guile; Once done this will define
|
||||
#
|
||||
# GUILE_FOUND - system has the GUILE library
|
||||
# GUILE_INCLUDE_DIRS - the GUILE include directory
|
||||
# GUILE_LIBRARIES - The libraries needed to use GUILE
|
||||
|
||||
|
||||
|
||||
# Look for the header file
|
||||
FIND_PATH(GUILE_INCLUDE_DIR libguile.h /usr/include /usr/local/include /usr/include/libguile /usr/local/include/libguile)
|
||||
|
||||
# Look for the library
|
||||
FIND_LIBRARY(GUILE_LIBRARY NAMES guile PATH /usr/lib /usr/local/lib)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
IF(GUILE_INCLUDE_DIR AND GUILE_LIBRARY)
|
||||
SET(GUILE_FOUND 1)
|
||||
SET(GUILE_LIBRARIES ${GUILE_LIBRARY})
|
||||
SET(GUILE_INCLUDE_DIRS ${GUILE_INCLUDE_DIR})
|
||||
ELSE(GUILE_INCLUDE_DIR AND GUILE_LIBRARY)
|
||||
SET(GUILE_FOUND 0)
|
||||
SET(GUILE_LIBRARIES)
|
||||
SET(GUILE_INCLUDE_DIRS)
|
||||
ENDIF(GUILE_INCLUDE_DIR AND GUILE_LIBRARY)
|
||||
|
||||
|
||||
# check guile's version if we're using cmake >= 2.6
|
||||
IF(GUILE_INCLUDE_DIR AND NOT CMAKE_MAJOR_VERSION LESS 2 AND NOT CMAKE_MINOR_VERSION LESS 6)
|
||||
SET(GUILE_VERSION_MAJOR 0)
|
||||
SET(GUILE_VERSION_MINOR 0)
|
||||
SET(GUILE_VERSION_PATCH 0)
|
||||
|
||||
# Extract the libguile version from the 'version.h' file
|
||||
SET(GUILE_MAJOR_VERSION 0)
|
||||
FILE(READ "${GUILE_INCLUDE_DIR}/libguile/version.h" _GUILE_VERSION_H_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "#define SCM_MAJOR_VERSION[ ]+([0-9])" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
|
||||
SET(GUILE_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
STRING(REGEX MATCH "#define SCM_MINOR_VERSION[ ]+([0-9])" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
|
||||
SET(GUILE_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
STRING(REGEX MATCH "#define SCM_MICRO_VERSION[ ]+([0-9])" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
|
||||
SET(GUILE_VERSION_PATCH ${CMAKE_MATCH_1})
|
||||
|
||||
# check found version against required one
|
||||
IF (Guile_FIND_VERSION_MAJOR AND ${GUILE_VERSION_MAJOR} LESS Guile_FIND_VERSION_MAJOR)
|
||||
SET(GUILE_FOUND FALSE)
|
||||
ELSE (Guile_FIND_VERSION_MAJOR AND ${GUILE_VERSION_MAJOR} LESS Guile_FIND_VERSION_MAJOR)
|
||||
IF (Guile_FIND_VERSION_MINOR AND ${GUILE_VERSION_MINOR} LESS Guile_FIND_VERSION_MINOR)
|
||||
SET(GUILE_FOUND FALSE )
|
||||
ELSE (Guile_FIND_VERSION_MINOR AND ${GUILE_VERSION_MINOR} LESS Guile_FIND_VERSION_MINOR)
|
||||
IF (Guile_FIND_VERSION_PATCH AND ${GUILE_VERSION_PATCH} LESS Guile_FIND_VERSION_PATCH)
|
||||
SET(GUILE_FOUND FALSE )
|
||||
ENDIF (Guile_FIND_VERSION_PATCH AND ${GUILE_VERSION_PATCH} LESS Guile_FIND_VERSION_PATCH)
|
||||
ENDIF (Guile_FIND_VERSION_MINOR AND ${GUILE_VERSION_MINOR} LESS Guile_FIND_VERSION_MINOR)
|
||||
ENDIF (Guile_FIND_VERSION_MAJOR AND ${GUILE_VERSION_MAJOR} LESS Guile_FIND_VERSION_MAJOR)
|
||||
ENDIF(GUILE_INCLUDE_DIR AND NOT CMAKE_MAJOR_VERSION LESS 2 AND NOT CMAKE_MINOR_VERSION LESS 6)
|
||||
|
||||
# Report the results.
|
||||
IF(NOT GUILE_FOUND)
|
||||
IF (Guile_FIND_VERSION_MAJOR)
|
||||
SET(_GUILE_VERSION_MESSAGE_STRING " (>=${Guile_FIND_VERSION_MAJOR}.${Guile_FIND_VERSION_MINOR}.${Guile_FIND_VERSION_PATCH})")
|
||||
ENDIF (Guile_FIND_VERSION_MAJOR)
|
||||
SET(GUILE_DIR_MESSAGE "Guile${_GUILE_VERSION_MESSAGE_STRING} was not found. Make sure GUILE_LIBRARY and GUILE_INCLUDE_DIR are set.")
|
||||
IF(NOT GUILE_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "${GUILE_DIR_MESSAGE}")
|
||||
ELSE(NOT GUILE_FIND_QUIETLY)
|
||||
IF(GUILE_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "${GUILE_DIR_MESSAGE}")
|
||||
ENDIF(GUILE_FIND_REQUIRED)
|
||||
ENDIF(NOT GUILE_FIND_QUIETLY)
|
||||
ENDIF(NOT GUILE_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(GUILE_INCLUDE_DIR GUILE_LIBRARY)
|
Loading…
Reference in New Issue
Block a user