12 # include(LibFindMacros) TODO get this: http://zi.fi/cmake/Modules/LibFindMacros.cmake
14 if(OpenMM_INCLUDE_DIR AND OpenMM_LIBRARY_DIR AND OpenMM_PLUGIN_DIR)
15 set(OpenMM_FIND_QUIETLY)
18 if(IS_DIRECTORY "$ENV{OPENMM_ROOT_DIR}")
19 set(OpenMM_ROOT_DIR $ENV{OPENMM_ROOT_DIR} CACHE PATH "OpenMM installation directory" FORCE)
21 if(IS_DIRECTORY "/usr/local/openmm")
22 set(OpenMM_ROOT_DIR "/usr/local/openmm" CACHE PATH "OpenMM installation directory" FORCE)
26 find_library(OpenMM_LIBRARIES
28 PATHS "${OpenMM_ROOT_DIR}/lib")
30 get_filename_component(OpenMM_LIBRARY_DIR
33 CACHE STRING "OpenMM library path")
35 find_path(OpenMM_INCLUDE_DIR
37 PATHS "${OpenMM_ROOT_DIR}/include" "${OpenMM_LIBRARY_DIR}/../include"
38 CACHE STRING "OpenMM include directory")
40 # if we did not manage to set the root dir at the beginning but found the
41 # libs then set the ${OpenMM_LIBRARY_DIR}/.. as root
42 if(NOT IS_DIRECTORY ${OpenMM_ROOT_DIR})
43 if (IS_DIRECTORY "${OpenMM_LIBRARY_DIR}/..") # just double-checking
44 get_filename_component(OpenMM_ROOT_DIR
45 "${OpenMM_LIBRARY_DIR}/.."
47 CACHE PATH "OpenMM installation directory")
51 if(NOT IS_DIRECTORY ${OpenMM_ROOT_DIR})
52 message(FATAL_ERROR "Can't find OpenMM! Either set the OPENMM_ROOT_DIR environment "
53 "variable to the path where your OpenMM installation is located or install it to the default location (/usr/local/openmm)!")
56 if(NOT OpenMM_LIBRARY_DIR)
57 message(FATAL_ERROR "Can't find OpenMM libraries. Check your OpenMM installation!")
60 # now we can be sure that we have the library dir
61 if(IS_DIRECTORY "${OpenMM_LIBRARY_DIR}/plugins")
62 get_filename_component(OpenMM_PLUGIN_DIR
63 "${OpenMM_LIBRARY_DIR}/plugins"
65 CACHE PATH "OpenMM plugins directory")
67 message(WARNING "Could not detect the OpenMM plugin directory at the default location (${OpenMM_LIBRARY_DIR}/plugins)."
68 "Check you OpenMM installation or manually set the OPENMM_PLUGIN_DIR environment variable!")
71 if(NOT OpenMM_INCLUDE_DIR)
72 message(FATAL_ERROR "Can't find OpenMM includes. Check your OpenMM installation!")
75 include (FindPackageHandleStandardArgs)
76 find_package_handle_standard_args(OpenMM DEFAULT_MSG