diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index c0814077b..8089badb5 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -1,3 +1,8 @@ +# also add the install directory of the running cmake to the search directories +# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up +GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) +GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) + SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} # Standard /include /usr/include /usr/local/include @@ -11,6 +16,7 @@ SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} # Other /opt/local/include /usr/pkg/include /opt/csw/include /opt/include + "${_CMAKE_INSTALL_DIR}/include" ) SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} @@ -26,10 +32,12 @@ SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} # Other /opt/local/lib /usr/pkg/lib /opt/csw/lib /opt/lib + "${_CMAKE_INSTALL_DIR}/lib" ) SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} /bin /usr/bin /usr/local/bin /usr/pkg/bin /sbin + "${_CMAKE_INSTALL_DIR}/bin" ) SET(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES