Allow disabling adding the install prefix to the prefix search path.

In certain scenarios, it is preferable to keep a 'dirty' install prefix
than to clear it, and to expect that content will not be found there.
Add a CMAKE_FIND_NO_INSTALL_PREFIX variable that can be set to disable
searching the install prefix.
This commit is contained in:
Stephen Kelly
2013-10-29 10:40:09 +01:00
parent 047c1ec457
commit fe057ab3cd
14 changed files with 78 additions and 9 deletions
+6 -3
View File
@@ -37,10 +37,13 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# CMake install location
"${_CMAKE_INSTALL_DIR}"
# Project install destination.
"${CMAKE_INSTALL_PREFIX}"
)
if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# Project install destination.
"${CMAKE_INSTALL_PREFIX}"
)
endif()
# List common include file locations not under the common prefixes.
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+12 -6
View File
@@ -73,11 +73,13 @@ get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}")
# Add other locations.
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# Project install destination.
"${CMAKE_INSTALL_PREFIX}"
)
if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
# Add other locations.
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# Project install destination.
"${CMAKE_INSTALL_PREFIX}"
)
endif()
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
# MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
@@ -88,8 +90,12 @@ list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
)
# mingw can also link against dlls which can also be in /bin, so list this too
if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
"${CMAKE_INSTALL_PREFIX}/bin"
)
endif()
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
"${CMAKE_INSTALL_PREFIX}/bin"
"${_CMAKE_INSTALL_DIR}/bin"
/bin
)