Build fails if xml/fftw include path contains older gmock
If the include path added for xml/fftw also contains gmock than the external gmock headers instead of the internal ones are used, because the include folder order is wrong.
Adjust include directory order for some corner cases
Always add headers found from the source/build tree to the beginning of
the list of include paths, such that they are preferred over those
potentially found in other non-system directories.
Use include_directories(SYSTEM ...) consistently
Apparently, at least some compilers treat -isystem differently from -I
in that no matter what the order on the command line is, -I always takes
precedence. This means that some of the
include_directories(BEFORE SYSTEM ...)
did not work correctly, and in particular GMX_EXTERNAL_BOOST=OFF was
broken. Likely also #1539 was (again) broken.
Make all includes that come from outside the source tree use SYSTEM, so
that the include directory for internal boost still takes precedence
#1 Updated by Teemu Murtola about 5 years ago
In general, this is an unsolvable problem if the system contains multiple copies of some headers at different versions in different paths. That said, it should be simple to put our internal include paths first. You probably get very interesting failures if you install an older Gromacs to the same prefix where, e.g., libxml2 is. ;-)