[CMake] novice question: modification of FLAGS rule variable?
Glenn Coombs
glenn.coombs at gmail.com
Wed Sep 7 07:18:38 EDT 2011
What you can do however is set the variable which uses the <FLAGS>
definition, i.e. CMAKE_C_COMPILE_OBJECT in your example. I have a
CMakeLists.txt file where I override the default assembler flags:
set(CMAKE_ASM-ATT_COMPILE_OBJECT "<CMAKE_ASM-ATT_COMPILER> ${ASM_SYS_FLAGS}
-o <OBJECT> <SOURCE>")
to use what is set in my ASM_SYS_FLAGS variable instead of the default
<FLAGS> one. I'm not sure but I think you are supposed to set these sort of
variables early on in a CMakeList.txt before the project() or
enable_language() commands. Also, I think that later changes to the
ASM_SYS_FLAGS variable are ignored.
--
Glenn
On 5 September 2011 19:53, David Cole <david.cole at kitware.com> wrote:
> On Mon, Sep 5, 2011 at 1:31 PM, David Dunkle <ddunkle at arxan.com> wrote:
> > Is it possible to read and to set a property/rule variable like <FLAGS>?
> > What syntax would I use to do that? I mean <FLAGS> as it, for example,
> > appears here:
> >
> >
> >
> > set(CMAKE_C_COMPILE_OBJECT "${target_compiler} -c <FLAGS> -o <OBJECT>")
> >
> >
> >
> > For example can I do something like this (this is pseudo code)?
> >
> >
> >
> > #read
> >
> > set(MY_FLAGS, ${<FLAGS>} );
> >
> >
> >
> > …
> >
> >
> >
> > #set
> >
> > set(<FLAGS>, ${MY_FLAGS});
> >
> >
> >
> > In the documentation, here:
> >
> >
> >
> > http://cmake.org/Wiki/CMake_Useful_Variables#Expansion_Rules
> >
> >
> >
> > it hints at this being possible but doesn’t explain, at least not so that
> I
> > understand.
> >
> >
> >
> > Thanks,
> >
> > -David
> >
> >
> >
> >
> >
> > _______________________________________________
> > 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
> >
>
> The wiki page is simply misleading. You cannot set those from the
> CMake language. CMake decides on their values in internal code, and
> then substitutes appropriately when generating make files or
> solution/project files for the build system.
>
> You can set things the "CMAKE_CXX_FLAGS" which eventually get
> translated into the substitution that CMake performs, but you cannot
> alter "<FLAGS>" in the rules variables.
>
>
> HTH,
> David
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110907/8cd79348/attachment-0001.htm>
More information about the CMake
mailing list