# Git_VERSION - git version
# Git_FOUND - tru if git was found, false otherwise
#
-# Szilard Pall (pszilard@cbr.su.se)
+# Author: Szilard Pall (pszilard@cbr.su.se)
if(Git_EXECUTABLE AND Git_VERSION)
set(Git_FIND_QUIETLY TRUE)
# search for git binary
find_program(Git_EXECUTABLE git
- DOC "Git version control tool")
+ PATHS ENV PATH
+ CACHE DOC "Git version control tool")
if(NOT Git_EXECUTABLE)
set(_err_msg "Git executable not found")
-# Find OpenMM library
+# Find OpenMM library.
#
-# Defines:
+# Looks for the OpenMM libraries at the default (/usr/local) location
+# or custom location found in the OPENMM_ROOT_DIR environment variable.
+#
+# The script defines defines:
# OpenMM_FOUND
# OpenMM_ROOT_DIR
# OpenMM_INCLUDE_DIR
# OpenMM_LIBRARY_DIR
-# OpenMM_LIBRARIES
+# OpenMM_LIBRARIES
+# OpenMM_LIBRARIES_D - debug version of libraries
# OpenMM_PLUGIN_DIR
#
-# include(LibFindMacros) TODO get this: http://zi.fi/cmake/Modules/LibFindMacros.cmake
+# Author: Szilard Pall (pszilard@cbr.su.se)
if(OpenMM_INCLUDE_DIR AND OpenMM_LIBRARY_DIR AND OpenMM_PLUGIN_DIR)
set(OpenMM_FIND_QUIETLY)
endif()
-if(IS_DIRECTORY "$ENV{OPENMM_ROOT_DIR}")
- set(OpenMM_ROOT_DIR $ENV{OPENMM_ROOT_DIR} CACHE PATH "OpenMM installation directory" FORCE)
+file(TO_CMAKE_PATH "$ENV{OPENMM_ROOT_DIR}" _env_OPENMM_ROOT_DIR)
+
+if(IS_DIRECTORY ${_env_OPENMM_ROOT_DIR})
+ set(OpenMM_ROOT_DIR "${_env_OPENMM_ROOT_DIR}" CACHE PATH "OpenMM installation directory" FORCE)
else()
if(IS_DIRECTORY "/usr/local/openmm")
set(OpenMM_ROOT_DIR "/usr/local/openmm" CACHE PATH "OpenMM installation directory" FORCE)
find_library(OpenMM_LIBRARIES
NAMES OpenMM
- PATHS "${OpenMM_ROOT_DIR}/lib")
+ PATHS "${OpenMM_ROOT_DIR}/lib"
+ CACHE STRING "OpenMM libraries")
+
+find_library(OpenMM_LIBRARIES_D
+ NAMES OpenMM_d
+ PATHS "${OpenMM_ROOT_DIR}/lib"
+ CACHE STRING "OpenMM debug libraries")
+
+if(OpenMM_LIBRARIES_D AND NOT OpenMM_LIBRARIES)
+ set(OpenMM_LIBRARIES ${OpenMM_LIBRARIES_D}
+ CACHE STRING "OpenMM libraries" FORCE)
+ message(WARNING " Only found debug versions of the OpenMM libraries!")
+endif()
get_filename_component(OpenMM_LIBRARY_DIR
${OpenMM_LIBRARIES}
if (IS_DIRECTORY "${OpenMM_LIBRARY_DIR}/..") # just double-checking
get_filename_component(OpenMM_ROOT_DIR
"${OpenMM_LIBRARY_DIR}/.."
- ABSOLUTE
- CACHE PATH "OpenMM installation directory")
- endif()
+ ABSOLUTE)
+ endif()
endif()
if(NOT IS_DIRECTORY ${OpenMM_ROOT_DIR})
"variable to the path where your OpenMM installation is located or install it to the default location (/usr/local/openmm)!")
endif()
-if(NOT OpenMM_LIBRARY_DIR)
+if(NOT IS_DIRECTORY ${OpenMM_LIBRARY_DIR})
message(FATAL_ERROR "Can't find OpenMM libraries. Check your OpenMM installation!")
endif()
if(IS_DIRECTORY "${OpenMM_LIBRARY_DIR}/plugins")
get_filename_component(OpenMM_PLUGIN_DIR
"${OpenMM_LIBRARY_DIR}/plugins"
- ABSOLUTE
- CACHE PATH "OpenMM plugins directory")
+ ABSOLUTE)
+ set(OpenMM_PLUGIN_DIR ${OpenMM_PLUGIN_DIR} CACHE PATH "OpenMM plugins directory")
else()
message(WARNING "Could not detect the OpenMM plugin directory at the default location (${OpenMM_LIBRARY_DIR}/plugins)."
"Check you OpenMM installation or manually set the OPENMM_PLUGIN_DIR environment variable!")
message(FATAL_ERROR "Can't find OpenMM includes. Check your OpenMM installation!")
endif()
-include (FindPackageHandleStandardArgs)
+set(OpenMM_ROOT_DIR ${OpenMM_ROOT_DIR} CACHE PATH "OpenMM installation directory")
+
+include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenMM DEFAULT_MSG
OpenMM_ROOT_DIR
OpenMM_LIBRARIES
OpenMM_LIBRARY_DIR
- OpenMM_INCLUDE_DIR
- OpenMM_PLUGIN_DIR)
+ OpenMM_INCLUDE_DIR)
+
+mark_as_advanced(OpenMM_INCLUDE_DIR
+ OpenMM_LIBRARIES
+ OpenMM_LIBRARIES_D
+ OpenMM_LIBRARY_DIR)