From 847d8fe92480b2ee5504f9a7fb5545c39b16a710 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Mon, 18 Nov 2013 13:19:58 +0100 Subject: [PATCH] Only add parent directories for actual variants Otherwise we'll inadvertedly add the root directory and will probably find the system implementation underneath there. --- cmake/Modules/OpmPackage.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake index 1b1a5bec0..538fc4f32 100644 --- a/cmake/Modules/OpmPackage.cmake +++ b/cmake/Modules/OpmPackage.cmake @@ -149,10 +149,18 @@ macro (find_opm_package module deps header lib defs prog conf) ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} - ${${module}_DIR}/.. - ${${module}_ROOT}/.. - ${${MODULE}_ROOT}/.. ) + # only add parent directories for those variants that are actually set + # (otherwise, we'll inadvertedly add the root directory (=all)) + if (${module}_DIR) + list (APPEND _guess ${${module}_DIR}/..) + endif (${module}_DIR) + if (${module}_ROOT) + list (APPEND _guess ${${module}_ROOT}/..) + endif (${module}_ROOT) + if (${MODULE}_ROOT) + list (APPEND _guess ${${MODULE}_ROOT}/..) + endif (${MODULE}_ROOT) # don't search the system paths! that would be dangerous; if there # is a problem in our own specified directory, we don't necessarily # want an old version that is left in one of the system paths!