[CMake] actually using cmake alternative to convenience libraries

Tamás Kenéz tamas.kenez at gmail.com
Fri Nov 20 11:14:47 EST 2015


> I'd prefer using the PARENT_SCOPE option here...

Jack's initial email continues with "but now the variable is not visible to
baz.c" so using PARENT_SCOPE does not meet his requirements.

> which will make the variables available in the parent CMakeLists.txt.

So does using cache variables.



On Fri, Nov 20, 2015 at 3:18 PM, Mark Stijnman <mark.stijnman at gmail.com>
wrote:

> On Thu, Nov 19, 2015 at 11:04 PM, Tamás Kenéz <tamas.kenez at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151120/1f5bdc90/attachment.html>


More information about the CMake mailing list