[cmake-developers] Should compile/link options be user-ordered?
Stephen Kelly
steveire at gmail.com
Mon Feb 3 14:37:51 EST 2014
Brad King wrote:
> On 02/02/2014 04:12 PM, Stephen Kelly wrote:
>> I was investigating the fact that target_compile_options accepts a BEFORE
>> keyword. The keyword is ignored, by the command implementation, but could
>> be used by cmTarget. Should it be? Is the bug in target_compile_options
>> accepting the option, or in ignoring it?
>>
>> The same question applies to the upcoming target_link_options.
>
> Weren't you the author of the command?
Yep. If it's a bug I introduced it.
> It looks like that may have been copied from the include_directories
> command. Does the implementation actually honor "BEFORE" anywhere?
The method
cmTargetCompileOptionsCommand::HandleDirectContent
ignores it, so no, it is not honored. It is also not an error.
> This should just be the order within the COMPILE_OPTIONS property
> which shouldn't be too hard to implement.
Right, it's just a case of passing it from HandleDirectContent to
InsertCompileOption.
That's if it makes sense to handle it. I suppose there may be some flag for
which
target_compile_options(tgt -flag)
# ... elsewhere:
target_compile_options(tgt BEFORE -otherflag)
makes sense? I don't think it makes sense with -O2, -O3 for example.
Thanks,
Steve.
More information about the cmake-developers
mailing list