[CMake] Can't Remove CXX_FLAGS entry

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Wed Oct 30 05:45:45 EDT 2013


Hi,

Have a look at the very silly hello world example attached. As I think
you mentioned, the cmake way to do this is to have targets with specific
flags in separate folders. In the example I add the 'fopenmp' as an
example flag (doesn't do anything useful, it is just to exemplify), and
remove it in target two using string replacement.

Hope this helps.

Cheers,
Yngve

Den 29. okt. 2013 21:51, skrev Stewart, Robert:
> I wrote:
>> When I generate NMake files for a project, to build on
>> Windows, CMAKE_CXX_FLAGS_DEBUG includes /RTC1.  That's fine
>> for most of the libraries in the build tree, but one uses
>> /CLR and that conflicts with /RTC1.  Is there a way to update
>> the compiler flags for a particular target?
>>
>> A search reveals that the out-of-tree build directory,
>> corresponding to the target's list file directory (foo.dir),
>> contains a flags.make with a CXX_FLAGS variable that contains
>> /RTC1 and /CLR.  I'd like to remove /RTC1 from that so the
>> build will work.
>>
>> Obviously, I could change the cached CMAKE_CXX_FLAGS_DEBUG
>> contents using SET() with FORCE, but that affects the other
>> targets, so I'd have to add /RTC1 back for each of them.  It
>> would be much more appropriate to just subtract the flag
>> where not wanted.
>>
>> I tried STRING(REPLACE) for CMAKE_CXX_FLAGS_DEBUG and
>> CXX_FLAGS, but they don't work.  I tried using
>> GET_PROPERTY()/SET_PROPERTY() to extract, update, and write
>> COMPILE_FLAGS for both DIRECTORY and TARGET, thinking that
>> COMPILE_FLAGS might be the property equivalent of CXX_FLAGS.
>> Nothing I've tried works.
>>
>> Any ideas?
> Anyone?
>
> _____
> Rob Stewart
> Software Engineer
> Dev Tools & Components
> Susquehanna International Group, LLP
>
> ________________________________
>
> IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.zip
Type: application/zip
Size: 1328 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131030/63461786/attachment.zip>


More information about the CMake mailing list