More hacking to get the template to detect and build
[alexxy/gromacs.git] / share / template / cmake / FindGROMACS.cmakein
index 53fec7136143b54288fa73d3d2cd57cdeef55972..f50d356a35c6c8155e89e4b97125828c630ddf7b 100644 (file)
@@ -155,8 +155,14 @@ endif(PC_GROMACS_INCLUDE_DIRS)
 
 if(NOT ${GROMACS_MAJOR_VERSION} LESS 5)
     include(CheckIncludeFile)
-    # Let find_package find the subset of Boost installed with GROMACS
-    set(BOOST_INCLUDEDIR ${GROMACS_INCLUDE_DIRS}/gromacs/external/boost)
+    # Let find_package find the subset of Boost installed with
+    # GROMACS, by appending the relevant subdirectory, unless
+    # pkg-config already took care of it.
+    if(PC_GROMACS_INCLUDE_DIRS)
+      set(BOOST_INCLUDEDIR ${GROMACS_INCLUDE_DIRS})
+    else()
+      set(BOOST_INCLUDEDIR ${GROMACS_INCLUDE_DIRS}/gromacs/external/boost)
+    endif()
     find_package(Boost 1.44.0 REQUIRED)
     if(Boost_FOUND)
         list(APPEND GROMACS_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})