Re: [CMake] on find_package and building dependencies
Thanks guys, I discovered this experimentally myself. -rhl On Tue, Jan 3, 2012 at 1:29 PM, Eric Noulard wrote: > 2012/1/3 Alexander Neundorf : >>> you basically want: >>> set(CMAKE_FIND_ROOT_PATH "/you/local/install/dir") >>> before calling find_package(...) >> >> No, please don't. >> CMAKE_FIND_ROOT_PATH is intended for cross-compiling, to tell cmake where the >> root of the target file system is located. > > Ok my bad. > > Sorry Alex (twice in fact) for giving wrong advice concerning this. > > I wasn't aware of the fact that CMAKE_FIND_ROOT_PATH was **reserved** > for cross-compiling. > >> Use CMAKE_PREFIX_PATH instead. It can contain a list of directories, and >> find_program(), find_file(), find_path(), find_package() and find_library() >> append bin/, include/ and lib/ respectively to each of the directories listed >> there. >> The directories resulting from CMAKE_PREFIX_PATH are checked before all PATHS >> and HINTS directories. >> >> E.g. if you have stuff inside /your/local/install/dir and /some/other/dir, do >> $ export CMAKE_PREFIX_PATH=/your/local/install/dir:/some/other/dir >> $ cmake ...args >> >> or set it directly as a cmake variable within your CMakeLists.txt. >> >> Alex > > > > -- > Erk > Membre de l'April - « promouvoir et défendre le logiciel libre » - > http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] on find_package and building dependencies
2012/1/3 Alexander Neundorf : >> you basically want: >> set(CMAKE_FIND_ROOT_PATH "/you/local/install/dir") >> before calling find_package(...) > > No, please don't. > CMAKE_FIND_ROOT_PATH is intended for cross-compiling, to tell cmake where the > root of the target file system is located. Ok my bad. Sorry Alex (twice in fact) for giving wrong advice concerning this. I wasn't aware of the fact that CMAKE_FIND_ROOT_PATH was **reserved** for cross-compiling. > Use CMAKE_PREFIX_PATH instead. It can contain a list of directories, and > find_program(), find_file(), find_path(), find_package() and find_library() > append bin/, include/ and lib/ respectively to each of the directories listed > there. > The directories resulting from CMAKE_PREFIX_PATH are checked before all PATHS > and HINTS directories. > > E.g. if you have stuff inside /your/local/install/dir and /some/other/dir, do > $ export CMAKE_PREFIX_PATH=/your/local/install/dir:/some/other/dir > $ cmake ...args > > or set it directly as a cmake variable within your CMakeLists.txt. > > Alex -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] on find_package and building dependencies
On Thursday 29 December 2011, Eric Noulard wrote: > 2011/12/29 Ryan Lewis : > > Hi, > > > > I really like CMake's find_package() utility for finding dependencies, > > but for some projects I have a > > separate local copy of the installed libraries, and I want to point > > find_package at a particular directory to find the installed > > libraries. > > How can I do this? > > Have a look at find_package documentation, > in particular the usage of > CMAKE_FIND_ROOT_PATH > and other > *CMAKE_FIND_ROOT_PATH_* > variables > > you basically want: > set(CMAKE_FIND_ROOT_PATH "/you/local/install/dir") > before calling find_package(...) No, please don't. CMAKE_FIND_ROOT_PATH is intended for cross-compiling, to tell cmake where the root of the target file system is located. Use CMAKE_PREFIX_PATH instead. It can contain a list of directories, and find_program(), find_file(), find_path(), find_package() and find_library() append bin/, include/ and lib/ respectively to each of the directories listed there. The directories resulting from CMAKE_PREFIX_PATH are checked before all PATHS and HINTS directories. E.g. if you have stuff inside /your/local/install/dir and /some/other/dir, do $ export CMAKE_PREFIX_PATH=/your/local/install/dir:/some/other/dir $ cmake ...args or set it directly as a cmake variable within your CMakeLists.txt. Alex -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] on find_package and building dependencies
2011/12/30 Ryan Lewis : > Hi, yes, this is all that I can't figure out if I type the define > without a type, it fails, but I can't figure out this variables type. > I tried STRING and FILEPATH and even BOOL. This is a PATH, so; cmake -DCMAKE_FIND_ROOT_PATH:PATH="/path/to/custom/install" but I think this is not the problem, since it works for me here (even if I do not provide the PATH type) so to answer your previous question: > Is there a way to hand this to cmake on the command line (i.e. an > ExternalProject_Add), when I test on the command line with: cmake > -DCMAKE_FIND_ROOT_PATH=... it gives me the warning that it is ignoring > my define. CMake warns you because some values in cache (the one found in CMakeCache.txt) make cmake not using the value provided on the command line. Most probably because ZLIB_INCLUDE_DIR and ZLIB_LIBRARY have been cached so that CMAKE_FIND_ROOT_PATH is not used because there is no need to. Basically this also means your build tree wasn't clean when you did run CMake. Please: 1) clean-up your source tree from any CMake generated file leftover 2) use out-of-source build http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees Then try again. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] on find_package and building dependencies
Hi, yes, this is all that I can't figure out if I type the define without a type, it fails, but I can't figure out this variables type. I tried STRING and FILEPATH and even BOOL. please advice. -rhl On Thu, Dec 29, 2011 at 5:03 PM, Ryan Lewis wrote: > Thanks a bunch, > > Is there a way to hand this to cmake on the command line (i.e. an > ExternalProject_Add), when I test on the command line with: cmake > -DCMAKE_FIND_ROOT_PATH=... it gives me the warning that it is ignoring > my define. > > -rhl > > > > On Thu, Dec 29, 2011 at 1:29 PM, Eric Noulard wrote: >> 2011/12/29 Ryan Lewis : >>> Hi, >>> >>> your suggestion on setting that variable before a find_package() just >>> simply _is not_ doing what I expect. I specify my own location of libz >>> and it _always_ finds the system wide version. >> >> Then there must be something weird, >> did you clean-up your build tree before testing? >> >> You may try in a fresh new pristine build tree. >> >> Would you be able to try the attached project and replace the >> >> set(CMAKE_FIND_ROOT_PATH "/home/erk/TestZlib/installed") >> with an appropriate value for your config. >> >> You must start from a fresh new build tree. >> >>> Also I cannot get the ExternalProject_Add() module to work properly. >> >> I'll try to answer that separately. >> Beware not to drop the CMake ML address. >> >> -- >> Erk >> Membre de l'April - « promouvoir et défendre le logiciel libre » - >> http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] on find_package and building dependencies
Thanks a bunch, Is there a way to hand this to cmake on the command line (i.e. an ExternalProject_Add), when I test on the command line with: cmake -DCMAKE_FIND_ROOT_PATH=... it gives me the warning that it is ignoring my define. -rhl On Thu, Dec 29, 2011 at 1:29 PM, Eric Noulard wrote: > 2011/12/29 Ryan Lewis : >> Hi, >> >> your suggestion on setting that variable before a find_package() just >> simply _is not_ doing what I expect. I specify my own location of libz >> and it _always_ finds the system wide version. > > Then there must be something weird, > did you clean-up your build tree before testing? > > You may try in a fresh new pristine build tree. > > Would you be able to try the attached project and replace the > > set(CMAKE_FIND_ROOT_PATH "/home/erk/TestZlib/installed") > with an appropriate value for your config. > > You must start from a fresh new build tree. > >> Also I cannot get the ExternalProject_Add() module to work properly. > > I'll try to answer that separately. > Beware not to drop the CMake ML address. > > -- > Erk > Membre de l'April - « promouvoir et défendre le logiciel libre » - > http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] on find_package and building dependencies
2011/12/29 Ryan Lewis : > Hi, > > your suggestion on setting that variable before a find_package() just > simply _is not_ doing what I expect. I specify my own location of libz > and it _always_ finds the system wide version. Then there must be something weird, did you clean-up your build tree before testing? You may try in a fresh new pristine build tree. Would you be able to try the attached project and replace the set(CMAKE_FIND_ROOT_PATH "/home/erk/TestZlib/installed") with an appropriate value for your config. You must start from a fresh new build tree. > Also I cannot get the ExternalProject_Add() module to work properly. I'll try to answer that separately. Beware not to drop the CMake ML address. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org usezlib.tgz Description: GNU Zip compressed data -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] on find_package and building dependencies
2011/12/29 Ryan Lewis : > Hi, > > I really like CMake's find_package() utility for finding dependencies, > but for some projects I have a > separate local copy of the installed libraries, and I want to point > find_package at a particular directory to find the installed > libraries. > How can I do this? Have a look at find_package documentation, in particular the usage of CMAKE_FIND_ROOT_PATH and other *CMAKE_FIND_ROOT_PATH_* variables you basically want: set(CMAKE_FIND_ROOT_PATH "/you/local/install/dir") before calling find_package(...) > On that note, I also have some dependencies which themselves are build > using CMake, it is possible to tell my CMake Project to > build another CMake project? Yes, cmake --help-module ExternalProject and the macro therein ExternalProject_Add note that you may simply want to "export" the target of the first project and then "import" the targets into the referring project, on that case have a look at: http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] on find_package and building dependencies
Hi, I really like CMake's find_package() utility for finding dependencies, but for some projects I have a separate local copy of the installed libraries, and I want to point find_package at a particular directory to find the installed libraries. How can I do this? On that note, I also have some dependencies which themselves are build using CMake, it is possible to tell my CMake Project to build another CMake project? Thanks, -rhl -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake