[CMake] Any portable way in CMake build tree to find Source tree path?

Kent Williams nkwmailinglists at gmail.com
Mon Jan 28 09:57:06 EST 2013


Thanks for all your help. It does seem like you can spend a long time
working with CMake (nearly 10 years for me) and still learn new things!


On Sat, Jan 26, 2013 at 8:48 AM, Cory Quammen <cquammen at cs.unc.edu> wrote:

> Oops, I didn't know about that command. I tried it out, and it works
> like a charm.
>
> Thanks for pointing it out, Alex!
>
> Cory
>
> On Sat, Jan 26, 2013 at 3:25 AM, Alexander Neundorf
> <a.neundorf-work at gmx.net> wrote:
> > On Saturday 26 January 2013, Cory Quammen wrote:
> >> Kent,
> >>
> >> I have a CMake function that may be of interest to you (see attached
> file).
> >>
> >> For your purposes, use it as follows:
> >>
> >> GetCMakeCacheValue( "${ABC_BUILD_DIR}" ABC_SOURCE_DIR )
> >>
> >> where the project against which you want to build is named "ABC".
> >>
> >> The first argument must always be the build directory of a project
> >> configured with CMake. The second (and an arbitrary number of
> >> subsequent arguments) are variables whose values you want to retrieve
> >> from the CMakeCache.txt file.
> >>
> >> Assuming everything goes well, two new variables will be defined in
> >> the scope in which you called GetCMakeCacheValue:
> >>
> >> ABC_SOURCE_DIR
> >> ABC_SOURCE_DIR_TYPE
> >>
> >> If there is no entry for ABC_SOURCE_DIR, then the above variables will
> >> take on the values
> >>
> >> ABC_SOURCE_DIR-NOT_FOUND
> >> ABC_SOURCE_DIR_TYPE-NOT_FOUND
> >>
> >> I hope this is useful to you and others. It would be great if CMake
> >> had similar functionality built in.
> >
> > Have you tried the load_cache() command ?
> > According to the documentation it does that, but I haven't used it
> myself yet.
> >
> > Alex
>
>
>
> --
> Cory Quammen
> Research Associate
> Department of Computer Science
> The University of North Carolina at Chapel Hill
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130128/d2aa1aeb/attachment-0001.htm>


More information about the CMake mailing list