Merge release-4-6 into master
[alexxy/gromacs.git] / src / programs / mdrun / CMakeLists.txt
index 93d385cf715e346a64ddd7f4b147a10b3c556a7b..e3cb576f79b124b13ff7df284ceca5a8007b70e9 100644 (file)
@@ -10,7 +10,10 @@ if(GMX_OPENMM)
     # Even though the OpenMM build has "moved to contrib", many things
     # have be be done from within the scope of the CMakeLists.txt that
     # builds its mdrun, and that is here
-    include(../contrib/BuildMdrunOpenMM)
+    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/contrib)
+    find_package(OpenMM)
+    include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+    include(${CMAKE_SOURCE_DIR}/src/contrib/BuildMdrunOpenMM.cmake)
 endif(GMX_OPENMM)
 
 if(GMX_FAHCORE)
@@ -22,6 +25,9 @@ else(GMX_FAHCORE)
         ${GMX_EXE_LINKER_FLAGS})
     set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}"
         COMPILE_FLAGS "${OpenMP_C_FLAGS}")
+    if(GMX_OPENMM)
+        target_link_libraries(mdrun openmm_api_wrapper)
+    endif()
     install(TARGETS mdrun DESTINATION ${BIN_INSTALL_DIR} COMPONENT mdrun)
 
     # Create the custom install-mdrun target