[CMake] setting/removing compiler flag (-g) for a single project directory

René J.V. Bertin rjvbertin at gmail.com
Sat Sep 16 04:07:42 EDT 2017


On Friday September 15 2017 16:51:24 Steven Velez wrote:

>Yeah... I didn't mean to respond personally... i didn't realize my client
>was doing that and not the list.

OK, replying back to the list then.

>What do you mean by "variables related to targets have global scope"?

I probably could have been a bit less vague. Defining a target in a subdirectory sets something that behaves like a global variable (pardon, constant :)), at least for libraries. That's the whole point of that common_dir subtree: it defines library targets which are then used for linking the plugin.

R.

>
>On Fri, Sep 15, 2017 at 3:44 PM, René J.V. Bertin <rjvbertin at gmail.com>
>wrote:
>
>> On Friday September 15 2017 15:34:34 Steven Velez wrote:
>>
>> Logically that's what I'd expect, but then the variables related to
>> targets have global scope, variables set in a module directories too etc. I
>> preferred to ask, so thanks :)
>>
>> R.
>>
>> >All directories in cmake have their own scopes which are initialized by
>> the
>> >scope of the parent directory.
>> >
>> >So, if you set the variables you wish to set in CMakeLists.txt of
>> >common_libs, they should not influence the builds in the plugin directory,
>> >but will influence the builds in that directory and subdirectories.
>> >
>> >https://cmake.org/cmake/help/v3.9/manual/cmake-language.7.
>> html#cmake-language-variables
>> >
>> >For more info.
>> >
>> >Steven



More information about the CMake mailing list