Hi, On Tue, Jun 05, 2012 at 11:11:44AM -0400, [email protected] wrote: > Date: Mon, 4 Jun 2012 17:01:34 -0700 > From: Natalie Tasman <[email protected]> > 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 believe that this is covered by the (now very lengthy) description of find_package() in man cmakecommands (or, to mention the main one-stop docs solution, "cmake --help-command find_package"). You possibly need to set (well, probably _extend_) CMAKE_PREFIX_PATH or CMAKE_FRAMEWORK_PATH, probably in outer shell environment (or perhaps only on CMake script side, should work fine, too). [[background explanation: I believe the deeper intention behind these global-switch mechanisms is to let the user manually specify which specific architecture a build should be done for, i.e. you could have a full toolchain/library set for a specific embedded architecture (ARM, MIPS, ..., i.e. NOT compatible with the usually activated x86 libraries on your CMake setup), and by properly predefining these settings (which for special platforms should probably be cleanly carried out in user-custom CMake Platform setup files?), CMake knows which library paths to reference (i.e. below which PREFIX[es]).]] I've actually successfully done the same thing on my Mac setup (where things provided by e.g. macports/Fink/... need to be referenced additionally), and I've simply extended configuration in the script file that holds all my main config settings of the project (sorry, cannot provide code at the moment). (ok, well, in fact I think it's indeed preferable to extend these things on script side rather than shell side, since many users would fail to *manually* set up shell side config correctly, and after all the project config itself knows best what it needs on certain platforms). > Solutions tried I've so far: Based on other related posts, I've tried > things like declaring INCLUDE_DIRECTORIES(/opt/local/include) and BTW CMake >= 2.8.8 (AFAIR) now finally has a target-specific (i.e. non-directory scope) INCLUDE_DIRECTORIES property for specifying these things. HTH, Andreas Mohr -- 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
