Thanks Robert indeed, according to
https://cmake.org/cmake/help/v3.5/command/find_library.html#command:find_library this should have worked, but it doesn't. We use the following in our ExternalProject_Add CMAKE_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/INSTALL -DCMAKE_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/INSTALL/lib -DCMAKE_INCLUDE_PATH=${CMAKE_CURRENT_BINARY_DIR}/INSTALL -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/INSTALL specifying where we install things and where it should find stuff. Nevertheless, our external project still finds a system boost or a gtest in /usr/local/lib. Are we doing anything wrong? Kris PS: apologies for the long delay in answering. On 5 May 2017 at 13:37, Robert Maynard <robert.mayn...@kitware.com> wrote: > Have you tried using CMAKE_PREFIX_PATH instead of CMAKE_INSTALL_PREFIX? > > On Thu, May 4, 2017 at 5:13 PM, Kris Thielemans < > kris.f.thielem...@gmail.com> wrote:bert > > Hi >> >> >> >> Short question: if we have a library/include files installed both in the >> usual system locations and outside, how do we force CMake to find the >> latter? (without modifying the CMake files of the project). >> >> >> >> Motivation: >> >> We’re trying to make a SuperBuild that builds/downloads a specific >> version of various packages (such as Boost and GTest). Our motivation is to >> have complete control of the version. We don’t want to install this in >> standard locations to avoid clashes, root permissions etc. So let’s say we >> install our versions in ~/our_stuff/lib, ~/our_stuff/include etc >> >> >> >> It seems very hard (and sometimes impossible) however to let future >> find_packages find our own versions as opposed to the system ones. From >> https://cmake.org/cmake/help/latest/command/find_library.html I thought >> that doing something like this would work >> >> >> >> cmake ../ -DCMAKE_INSTALL_PREFIX=~/our_stuff >> >> >> >> but the system version of boost etc are still found first (it does work >> if there is no system version of the library). In the case of Boost, even >> >> >> >> cmake ../ -DCMAKE_INSTALL_PREFIX=~/our_stuff -DBOOST_ROOT=~/our_stuff >> >> >> >> doesn’t help (tested on Linux). I have to set BOOST_INCLUDEDIR for >> instance. As every Find*.cmake has its own conventions of specifying >> cmake/environment variables, and some don’t at all, this just gets >> unfeasible. >> >> >> >> I know about NO_DEFAULT_PATH, NO_CMAKE_SYSTEM_PATH etc options for >> find_package, but this would need modification of CMake files in the >> dependent packages which is quite undesirable for us. >> >> >> >> Any suggestions? >> >> >> >> Thanks >> >> Kris >> >> >> >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake >> > >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake