Asem
Asem

Reputation: 31

cmake: default include path on unix

I'm using cmake and make to compile a project using an external library (speex). This library is found by the find_library command in my CMakeLists.txt. The only problem is: the default include path of cmake does not include /usr/local/include/, that is the location of speex's headers.

I do not want to add /usr/local/include/ to the search path in the CMakeLists.txt because it would (I suppose) generate an error on windows where such path doesn't exist. Moreover, that would be a dirty trick, I'm not quite fond of this solution.

Do you know a solution to this problem which would be portable and clean ?

Thank you for your time.

Upvotes: 3

Views: 3551

Answers (3)

RobertJMaynard
RobertJMaynard

Reputation: 2257

Use the PATH argument of find_library to specify other places to search. If the path doesn't exist it shouldn't produce an error.

Upvotes: 0

Rylie Pavlik
Rylie Pavlik

Reputation: 1803

Try using a full-blown speex find module, either created from scratch, or based on something found with http://www.google.com/search?q=findspeex.cmake

Upvotes: 1

Steve-o
Steve-o

Reputation: 12866

Punt the configuration to the user via the command line, e.g.

cmake -DSPEEX_PATH=/usr/local/include

Upvotes: 0

Related Questions