Issue
Is there a way to pass C_INCLUDE_DIRS and LD_LIBRARY_PATH from cmake command line or is there a way to set env so that CMAKE can find and use them?
Solution
It is not fully clear what you intend to do with these variables. Here are some possibilities:
Inside a CMake script you can read environment variables using the syntax
$ENV{<VARIABLE_NAME>}
. So in yourCMakeLists.txt
you can have something likemessage( "Found environment variable LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}" )
If you want to add the location contained in this variable to be available to your CMake target executables and libraries then you can use the link_directories() command as
link_directories( $ENV{LD_LIBRARY_PATH} )
Or if you have someone else's project and you want to instruct CMake to look for libraries in some additional directories you can use CMAKE_PREFIX_PATH or CMAKE_LIBRARY_PATH. For example to pass these variables in a command line you could do
cmake -D CMAKE_PREFIX_PATH=/path/to/custom/location
Answered By - user6764549 Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.