On Thu, Nov 19, 2015 at 11:04 PM, Tamás Kenéz <tamas.ke...@gmail.com> wrote:

> > set(foobarSRCS foo.c bar.c)
> > set(foobarLIBS ${externalLibFound})
> >
> > which is what the FAQ entry seems to suggest. However, this variable is
> not visible to goo.c. Okay, so as an alternative, I can do this:
> >
> > set(foobarSRCS foo.c bar.c PARENT_SCOPE), etc.
>
> In similar cases I create CACHE variables:
>
>     set(foobarSRCS foo.c bar.c CACHE INTERNAL "" FORCE)
>     set(foobarLIBS ${externalLibFound} CACHE INTERNAL "" FORCE)
>
> You can also write a set_cache() macro.
>
> Tamas
>

I'd prefer using the PARENT_SCOPE option here, which will make the
variables available in the parent CMakeLists.txt.
    set(foobarSRCS foo.c bar.c PARENT_SCOPE)
    set(foobarLIBS ${externalLibFound} PARENT_SCOPE)
-- 

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://public.kitware.com/mailman/listinfo/cmake

Reply via email to