[CMake] Enabling compiler flags for one file ONLY.

Michael Wild themiwi at gmail.com
Wed Jun 2 01:52:01 EDT 2010


On 2. Jun, 2010, at 5:44 , Michael Hertling wrote:

> On 06/02/2010 04:24 AM, Clark Gaebel wrote:
>> I have a massive .cpp file that has been autogenerated ahead of time.
>> However, whenever I build it, according to gcc timing information, it
>> spends all its time in "variable tracking". Therefore, I would like to
>> enable the flag -fno-var-tracking for that file only (having variable
>> debug information is useful!).
> 
> SET_SOURCE_FILES_PROPERTIES(<massive>.cpp
> PROPERTIES COMPILE_FLAGS "-fno-var-tracking")
> 
> Regards,
> 
> Michael

And please put that whole thing in IF(CMAKE_COMPILER_IS_GNUCXX) because other compilers will choke on this flag. If you want to, you can also use the CheckCXXCompilerFlag.cmake module to check whether your C++ compiler supports this flag.

Michael



More information about the CMake mailing list