Don't search system directories when path given
If the user has given a path to the module, then the system paths should not be searched, as these may contain an old and outdated version. We don't necessarily want that just because there was a problem with our own installation!
This commit is contained in:
@@ -97,6 +97,29 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
|
||||
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
||||
endforeach (_item)
|
||||
set (_no_system "")
|
||||
else (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||
# start looking at the paths in this order
|
||||
set (_guess_bin
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
)
|
||||
# when we look for the source, it may be that we have been specified
|
||||
# a build directory which is a sub-dir of the source, so we look in
|
||||
# the parent also
|
||||
set (_guess
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
${${module}_DIR}/..
|
||||
${${module}_ROOT}/..
|
||||
${${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!
|
||||
set (_no_system "NO_DEFAULT_PATH")
|
||||
endif (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||
|
||||
# search for this include and library file to get the installation
|
||||
@@ -105,8 +128,9 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
find_path (${module}_INCLUDE_DIR
|
||||
NAMES "${header}"
|
||||
PATHS ${_guess}
|
||||
HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_INCLUDE_DIRS}
|
||||
HINTS ${PkgConf_${module}_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES "include"
|
||||
${_no_system}
|
||||
)
|
||||
|
||||
# some modules are all in headers
|
||||
@@ -117,8 +141,9 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
find_library (${module}_LIBRARY
|
||||
NAMES "${lib}"
|
||||
PATHS ${_guess_bin}
|
||||
HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS}
|
||||
HINTS ${PkgConf_${module}_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
|
||||
${_no_system}
|
||||
)
|
||||
else (NOT "${lib}" STREQUAL "")
|
||||
set (${module}_LIBRARY "")
|
||||
|
||||
Reference in New Issue
Block a user