[CMake] CMAKE_MFC_FLAG not working in functions

David Cole david.cole at kitware.com
Thu Oct 20 11:43:53 EDT 2011


Are you using VS10?

Is it this already known problem?

http://public.kitware.com/Bug/view.php?id=11224


On Thu, Oct 20, 2011 at 11:41 AM, Robert Dailey <rcdailey at gmail.com> wrote:
> On Thu, Oct 20, 2011 at 2:36 AM, Rolf Eike Beer <eike at sf-mail.de> wrote:
>>
>> > I have a function defined very high up in the directory tree at the root
>> > CMakeLists file. Several levels below it, I have another CMakeLists file
>> > that I call that function from.
>> >
>> > The function sets CMAKE_MFC_FLAG to 2. I notice that this flag gets
>> > ignored
>> > when it is set inside of the function in question. If I set the flag
>> > outside
>> > of the function, in the lowest level CMakeLists file, it works. This
>> > property seems somehow tied to the directory itself, but I can't figure
>> > out
>> > if this is a feature or a bug.
>> >
>> > This behavior isn't very flexible as I'd like to make the details of
>> > configuring an MFC compatible project transparent to the lower level
>> > CMakeLists scripts. Hiding away the flag and how it needs to be set is a
>> > big
>> > part of this, but I can't do it.
>> >
>> > Anyone know how I can make this work?
>>
>> A function creates a new variable scope, i.e. everything you set in there
>> will be reset once you leave the function. Have a look at SET(...
>> PARENT_SCOPE) for this.
>
> Not even that worked, unfortunately.
> Basically from my function I do:
> set( CMAKE_MFC_FLAG 2 )
> add_executable( ... )
> Since I'm setting it right before the add_executable() call, I would think
> that scope has nothing to do with it.
> --
>
> 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
>


More information about the CMake mailing list