LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-23-2010, 01:04 AM   #1
damien_d
LQ Newbie
 
Registered: Dec 2008
Posts: 17

Rep: Reputation: 0
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

Last edited by damien_d; 02-23-2010 at 02:03 AM. Reason: Added extra info
 
Old 02-23-2010, 12:01 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,516

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
'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 ?
.....

Last edited by knudfl; 02-23-2010 at 12:34 PM.
 
Old 02-23-2010, 06:24 PM   #3
damien_d
LQ Newbie
 
Registered: Dec 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by knudfl View Post
'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
 
Old 10-27-2010, 03:40 PM   #4
StevePny
LQ Newbie
 
Registered: Oct 2010
Posts: 1

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cmake error ~sHyLoCk~ Slackware 10 12-07-2009 01:00 PM
ICEauthority and qt session manager problems after cmake install - related? DrMuir Linux - Newbie 8 09-29-2009 05:32 PM
CMake is new territory for me - Trying to install kdebluetooth4 BobNutfield Slackware 12 06-16-2009 06:20 PM
cmake question yfaye Programming 3 04-09-2009 09:24 PM
Is it ok to build latest cmake dir in personal directory? agentchange Linux - Software 8 09-06-2008 06:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration