LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   cmake: Using find_package(Boost) when FindBoost.cmake is not in the default location (https://www.linuxquestions.org/questions/programming-9/cmake-using-find_package-boost-when-findboost-cmake-is-not-in-the-default-location-790938/)

damien_d 02-23-2010 01:04 AM

cmake: Using find_package(Boost) when FindBoost.cmake is not in the default location
 
Hello all,

I am attempting to compile some code on a cluster where I do not have root access (and is missing many of the libraries I want), and hence have had to create local builds of the boost and opencv libraries (i.e. in /home/username/usr/local).

In particular, my cmake depends on:

Code:

find_package(boost)
which my normal development machine finds in:
Code:

/usr/share/cmake-2.6/Modules/FindBoost.cmake
On the cluster I have a version of FindBoost.cmake at:
Code:

/home/username/cmake_modules
How can I tell CMake to look for FindBoost.cmake in that directory, since neither the cmake file, nor the boost install is in the standard location?

I've modified the FindBoost.cmake file to make it search in the locally installed boost libraries.

-- Damien

EDIT: Now I'm really scratching my head. According to http://www.itk.org/Wiki/CMake:How_To_Find_Libraries if I place the following line in my CMakeLists.txt file, it should find any modules in that path:

Code:

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
Which I have adjusted to:
Code:

set(CMAKE_MODULE_PATH "/home/username/find_cmake")
which is the local directory where I have placed the FindBoost.cmake files.

The cmake version is 2.8.0

knudfl 02-23-2010 12:01 PM

'cmake' is looking for <Search-PATH>/lib/libboost****.so
There are 42 different libs ...

You will have to compile e.g. boost_1.38
to your "local location", and export the PATH,
so the cmake "configuring opencv" can find libraries
in <prefix>/lib and headers in <prefix>/include/boost/

The text file FindBoost.cmake is just one of the 130
files used by cmake to find libraries :
(( /usr/share/cmake/Modules/CMakeFind****.cmake .))
.....

And I guess that a cmake installed to /home/<user>/
also will be able to find its own files in e.g.
/home/<user>/share/cmake/Modules/ if it is a real install
and not just a copy of the files. ?

Or did you find the solution ?
.....

damien_d 02-23-2010 06:24 PM

Quote:

Originally Posted by knudfl (Post 3874030)
'cmake' is looking for <Search-PATH>/lib/libboost****.so
There are 42 different libs ...

You will have to compile e.g. boost_1.38
to your "local location", and export the PATH,
so the cmake "configuring opencv" can find libraries
in <prefix>/lib and headers in <prefix>/include/boost/

The text file FindBoost.cmake is just one of the 130
files used by cmake to find libraries :
(( /usr/share/cmake/Modules/CMakeFind****.cmake .))
.....

And I guess that a cmake installed to /home/<user>/
also will be able to find its own files in e.g.
/home/<user>/share/cmake/Modules/ if it is a real install
and not just a copy of the files. ?

Or did you find the solution ?
.....

I don't think it's finding the FindBoost.cmake file at all.

When I perform the following, I get:
Code:

username@lyra:~/code> cmake .
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost

When set as above.

I solved it by directly specifying the include and lib directories, rather than the FindBoost.cmake in CMakeLists.txt, Dirty, yes, but it works for this run.

-- Damien

StevePny 10-27-2010 03:40 PM

I have a similar situation. How did you directly specify the include and lib directories, rather than using find_package in CMakeLists.txt?


All times are GMT -5. The time now is 10:42 PM.