[CMake] Replacing Compile Options for a Target

Jayesh Badwaik public at jayeshbadwaik.in
Wed Dec 7 05:38:18 EST 2016


On Wednesday, 7 December 2016 05:31:02 CET you wrote:
> There's no problem as the compiler will just use the last flag value.
> See an example at http://coliru.stacked-crooked.com/a/738fff0fcc2eb3c4.

Still, seems very ugly solution. Also doesn't work with multiple different 
flags. Better solution I have found is to create a static library from the 
header in a subdirectory and set CMAKE_CXX_FLAGS for that subdirectory only. 
This seems to be working and looks robust for all test cases I have 
encountered. 

-- 
Cheers
Jayesh Badwaik
https://www.jayeshbadwaik.in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161207/267511c8/attachment.sig>


More information about the CMake mailing list