开发者

cmake: default include path on unix

开发者 https://www.devze.com 2023-01-27 11:43 出处:网络
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.

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 pat开发者_运维技巧h 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.


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


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

cmake -DSPEEX_PATH=/usr/local/include


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消