[CMake] Searching once

Williams, Norman K norman-k-williams at uiowa.edu
Wed Jan 15 11:11:15 EST 2014


You want the load_cache command:

* load_cache: Load in the values from another project's CMake cache.
  load_cache(pathToCacheFile READ_WITH_PREFIX
             prefix entry1...)
Read the cache and store the requested entries in variables with their
name prefixed with the given prefix. This only reads the values, and does
not create entries in the local project's cache.

  load_cache(pathToCacheFile [EXCLUDE entry1...]
             [INCLUDE_INTERNALS entry1...])
Load in the values from another cache and store them in the local
project's cache as internal entries. This is useful for a project that
depends on another project built in a different tree. EXCLUDE option can
be used to provide a list of entries to be excluded. INCLUDE_INTERNALS can
be used to provide a list of internal entries to be included. Normally, no
internal entries are brought in. Use of this form of the command is
strongly discouraged, but it is provided for backward compatibility.

To use this, the other project must at least already have been configured
-- otherwise it has no CMakeCache.txt for it to read.


So you'd do something like:

load_cache(${OTHER_PROJECT_CMAKECACHE_PATH} READ_WITH_PREFIX
OTHER_PROJECT DEPENDENCY_DIR)
set(SOMETHING_DIR ${OTHER_PROJECT_DEPENDENCY_DIR}


On 1/14/14 5:47 PM, "Al Niessner" <Albert.F.Niessner at jpl.nasa.gov> wrote:

>
>I am fairly new to cmake but have been through the documentation a dozen
>or more times and found answers to all of my previous questions. I have
>googled for another small batch of questions. Now I am stuck, mostly
>because I am not sure what keywords to use in my search, and would like
>a little help.
>
>Is it possible to have a dependent project use configuration information
>from a previously installed project?
>
>I have the parent project A that searches my compute node and finds all
>kinds of fun packages like HDF, boost, xerces, etc. It then compiles
>into a shared library and deployed to /my/product/{lib,doc,include,...}.
>
>Now, I have project B that depends on what was generated in project A.
>So, it now searches my compute node and finds an older version of HDF,
>boost, and/or xerces. Old enough that there is an API change. Well, that
>does not work so well and can even be pathological enough to go
>unnoticed for a long time.
>
>So, what I want is project B to look into /my/product/cmake and get all
>of the search paths from there instead of project B searching my compute
>node like project A did.
>
>In other words, when I do a 'make install' for project A, I want a
>subdirectory or file that has information in it that CMake can
>automatically ingest rather than search using Find*.cmake. Thus, my
>dependencies remain consistent.
>
>Is it possible to have a dependent project use configuration from a
>previously installed project?
>
>--
>Al Niessner
>818.354.0859
>
>--------
>|  dS  | >= 0
>--------
>
>--
>
>Powered by www.kitware.com
>
>Please keep messages on-topic and check the CMake FAQ at:
>http://www.cmake.org/Wiki/CMake_FAQ
>
>Kitware offers various services to support the CMake community. For more
>information on each offering, please visit:
>
>CMake Support: http://cmake.org/cmake/help/support.html
>CMake Consulting: http://cmake.org/cmake/help/consulting.html
>CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>Follow this link to subscribe/unsubscribe:
>http://www.cmake.org/mailman/listinfo/cmake



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the CMake mailing list