Only add parent directories for actual variants

Otherwise we'll inadvertedly add the root directory and will probably
find the system implementation underneath there.
This commit is contained in:
Roland Kaufmann 2013-11-18 13:19:58 +01:00 committed by Bård Skaflestad
parent 47eb8a0549
commit 847d8fe924

View File

@ -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!