ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/cmake/modules/FindOpenBabel2.cmake
(Generate patch)

Comparing branches/development/cmake/modules/FindOpenBabel2.cmake (file contents):
Revision 1497 by chuckv, Fri Jul 9 23:13:29 2010 UTC vs.
Revision 1498 by chuckv, Thu Sep 9 14:34:20 2010 UTC

# Line 4 | Line 4
4   #  OPENBABEL2_FOUND - system has OpenBabel2
5   #  OPENBABEL2_INCLUDE_DIR - the OpenBabel2 include directory
6   #  OPENBABEL2_LIBRARIES - Link these to use OpenBabel2
7 + # Copyright (C) 2006, 2009 Pino Toscano, <pino@kde.org>
8   # Copyright (c) 2006, 2007 Carsten Niehaus, <cniehaus@gmx.de>
9   # Copyright (C) 2008 Marcus D. Hanwell <marcus@cryos.org>
10   # Redistribution and use is allowed according to the terms of the BSD license.
11   # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12  
12 include (MacroEnsureVersion)
13
13   if (OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
14    # in cache already
15    set(OPENBABEL2_FOUND TRUE)
16  
17   else (OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
19  if(EMBED_OPENBABEL)
20    # Building a super-package, rely on the embedded paths
21    set(OPENBABEL2_VERSION_MET TRUE)
22    set(OPENBABEL2_INCLUDE_DIR ${super_SOURCE_DIR}/openbabel/include ${super_BINARY_DIR}/openbabel/include)
23    # This is a kludge -- need to ask Marcus how to handle it better
24    find_library(OPENBABEL2_LIBRARIES NAMES openbabel openbabel-2
25      PATHS
26      ${_obLinkDir}
27      ${GNUWIN32_DIR}/lib
28      $ENV{OPENBABEL2_LIBRARIES}
29    )
30  else(EMBED_OPENBABEL)
31  # Typical case -- find an installed OpenBabel
18    if(NOT WIN32)
19  
20      # Use the newer PkgConfig stuff
21      find_package(PkgConfig REQUIRED)
22 <    pkg_check_modules(OPENBABEL2 openbabel-2.0>=2.2.2)
22 >    pkg_check_modules(PC_OPENBABEL2 openbabel-2.0>=2.2.0)
23  
24 <    # Maintain backwards compatibility with previous version of module
39 <    if(OPENBABEL2_FOUND STREQUAL "1")
24 >    if(PC_OPENBABEL2_FOUND)
25        set(OPENBABEL2_VERSION_MET TRUE)
26 <      set(OPENBABEL2_INCLUDE_DIR ${OPENBABEL2_INCLUDE_DIRS})
42 <    endif(OPENBABEL2_FOUND STREQUAL "1")
26 >    endif(PC_OPENBABEL2_FOUND)
27  
28    else(NOT WIN32)
29      set(OPENBABEL2_VERSION_MET TRUE)
# Line 47 | Line 31 | else (OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES
31  
32    if(OPENBABEL2_VERSION_MET)
33  
34 <    if(WIN32)
35 <      if(NOT OPENBABEL2_INCLUDE_DIR)
36 <        find_path(OPENBABEL2_INCLUDE_DIR openbabel-2.0/openbabel/obconversion.h
37 <          PATHS
38 <          ${_obIncDir}
39 <          ${GNUWIN32_DIR}/include
40 <          $ENV{OPENBABEL2_INCLUDE_DIR}
41 <        )
58 <        if(OPENBABEL2_INCLUDE_DIR)
59 <          set(OPENBABEL2_INCLUDE_DIR ${OPENBABEL2_INCLUDE_DIR}/openbabel-2.0)
60 <        endif(OPENBABEL2_INCLUDE_DIR)
61 <      endif(NOT OPENBABEL2_INCLUDE_DIR)
62 <    endif(WIN32)
34 >    find_path(OPENBABEL2_INCLUDE_DIR openbabel/obconversion.h
35 >      PATHS
36 >      ${PC_OPENBABEL2_INCLUDEDIR}
37 >      ${PC_OPENBABEL2_INCLUDE_DIRS}
38 >      ${GNUWIN32_DIR}/include
39 >      $ENV{OPENBABEL2_INCLUDE_DIR}
40 >      PATH_SUFFIXES openbabel-2.0
41 >    )
42  
43      find_library(OPENBABEL2_LIBRARIES NAMES openbabel openbabel-2
44        PATHS
45 <      ${_obLinkDir}
45 >      ${PC_OPENBABEL2_LIBDIR}
46 >      ${PC_OPENBABEL2_LIBRARY_DIRS}
47        ${GNUWIN32_DIR}/lib
48        $ENV{OPENBABEL2_LIBRARIES}
49      )
50    endif(OPENBABEL2_VERSION_MET)
71  endif(EMBED_OPENBABEL)
51  
52    if(OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
53      set(OPENBABEL2_FOUND TRUE)
# Line 97 | Line 76 | else(OPENBABEL2_EXECUTABLE)
76   else(OPENBABEL2_EXECUTABLE)
77    find_program(OPENBABEL2_EXECUTABLE NAMES babel
78      PATHS
79 <    [HKEY_CURRENT_USER\\SOFTWARE\\OpenBabel\ 2.2.2]
79 >    [HKEY_CURRENT_USER\\SOFTWARE\\OpenBabel\ 2.2.0]
80      $ENV{OPENBABEL2_EXECUTABLE}
81    )
82  
# Line 111 | Line 90 | endif(OPENBABEL2_EXECUTABLE)
90  
91   endif(OPENBABEL2_EXECUTABLE)
92  
114 # Test if we are using trunk
115 if(NOT OPENBABEL_IS_NEWER_THAN_2_2_99)
116  macro_ensure_version("2.2.99" "${OPENBABEL2_VERSION}" OPENBABEL_IS_NEWER_THAN_2_2_99)
117 endif(NOT OPENBABEL_IS_NEWER_THAN_2_2_99)
118 if (OPENBABEL_IS_NEWER_THAN_2_2_99)
119   add_definitions(-DOPENBABEL_IS_NEWER_THAN_2_2_99)
120 endif(OPENBABEL_IS_NEWER_THAN_2_2_99)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines