# honor the language standard settings for try_compile()
cmake_policy(SET CMP0067 NEW)
+find_package(gmxapi 0.0.8 REQUIRED
+ HINTS "$ENV{GROMACS_DIR}"
+ )
+if(gmxapi_FOUND)
+ set(_suffix "")
+ # GROMACS master branch and development branches may have divergent
+ # pre-release APIs. This check allows us to distinguish them and behave
+ # differently if needed. github.com/kassonlab/gromacs-gmxapi devel branch
+ # sets gmxapi_EXPERIMENTAL=TRUE. Upstream GROMACS master branch does not.
+ # Ref: https://github.com/kassonlab/gmxapi/issues/166
+ if(gmxapi_EXPERIMENTAL)
+ set(_suffix " (unofficial)")
+ endif()
+ message(STATUS "Found gmxapi version ${gmxapi_VERSION}${_suffix}")
+endif()
+
# TODO: Account for externally-provided pybind headers where recommended by packaging system.
# Reference https://redmine.gromacs.org/issues/2896
add_subdirectory(external/pybind)
${CMAKE_CURRENT_BINARY_DIR}/gmxapi
)
+# RPATH management: make sure build artifacts can find GROMACS library.
+set_target_properties(_gmxapi PROPERTIES SKIP_BUILD_RPATH FALSE)
+set_target_properties(_gmxapi PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
+set_target_properties(_gmxapi PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+target_link_libraries(_gmxapi PRIVATE Gromacs::gmxapi)
+
install(TARGETS _gmxapi LIBRARY DESTINATION gmxapi)
if(NOT SKBUILD)