I'm writing a CMakeLists.txt file, and I'm having problems getting
find_package to choose libraries under /opt/local rather than
/usr/local.  Specifically, I've installed libarchive using macports
and CMake cannot find it.  When CMake configuration finds the the
library in /usr/lib (/usr/lib/libarchive.dylib) but no corresponding
header, it fails, and I would like to find a way to tell CMake to fall
back to /opt/local, where a version of the library as well as the
archive.h header is installed.

I'm new to CMake, and I've spent some time researching this question
on google, stackoverflow, and recent archives for this list.  It seems
like a situation that would come up often but I haven't found a
solution that works for me yet.  I have the most recent versions of
CMake (binary install) and macports on my system.  macports packages
are found under /opt/local.  I am glad to try to solve the problem and
contribute changes to CMake, but I'm guessing there is some easier
way.

Solutions tried I've so far: Based on other related posts, I've tried
things like declaring INCLUDE_DIRECTORIES(/opt/local/include) and
LINK_DIRECTORIES(/opt/local/lib), with BEFORE, SYSTEM, and BEFORE
SYSTEM, but /opt/local doesn't seem to be searched.  Also I've tried
set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) and
set(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH}), also
without results.  The find_package file for libarchive
(cmake-2.8/Modules/FindLibarchive.cmake) does not seem to make use of
HINT, nor hardcode /opt/local (as seen in the corresponding boost
file, for example.)



Thanks in advance,

Natalie
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to