[CMake] Querying CMake variables of external CMake projects

Saad Khattak saadrustam at gmail.com
Sat Jan 13 17:34:18 EST 2018


Thank you Konstantin. get_target_properties(...) works very well.

On Sat, Jan 13, 2018 at 12:06 PM Konstantin Tokarev <annulen at yandex.ru>
wrote:

>
>
> 13.01.2018, 06:26, "Saad Khattak" <saadrustam at gmail.com>:
> > Hi,
> >
> > Say I find LibA using find_package(LibA) and I now have access to
> LibA_DIR, which is the build folder of LibA. Is there a way I can query
> additional variables, such as LibA's source directory, install directory
> etc. i.e. variables that are defined by CMake when LibA was being
> generated/built by CMake?
>
> If  find_package(LibA) provides you target "LibA" (i.e., cmake code under
> "if (TARGET LibA)"
> condition is being executed), you can query various properties from it and
> expect them to
> have sane values. See documentation on cmake properties.
>
> If there is no LibA target, it probably means that find_package(LibA) is
> implemented via
> FindLibA.cmake module, and you can only use variables that it sets
> (usually documented in
> the beginning of module)
>
> >
> > Thanks,
> > Saad
> > ,--
> >
> > 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:
> > https://cmake.org/mailman/listinfo/cmake
>
>
> --
> Regards,
> Konstantin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180113/e657c77a/attachment.html>


More information about the CMake mailing list