add_compile_options [was Re: Review Request 114885: Remove custom build types]

Stephen Kelly steveire at gmail.com
Wed Jan 8 11:21:28 UTC 2014


Alex Merry wrote:

> On 07/01/14 15:36, Stephen Kelly wrote:
>> This is an automatically generated e-mail. To reply, visit:
>> https://git.reviewboard.kde.org/r/114885/
>> 
>> 
>> I didn't follow this discussion closely enough. I'll see if I can catch
>> up with it later.
>> 
>> 
>> kde-modules/KDECompilerSettings.cmake
>> 
<https://git.reviewboard.kde.org/r/114885/diff/1/?file=233187#file233187line25>
>> (Diff revision 1)
>> 
>> 
>> 9
>> 
>> #                           set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
>> #                           ${KDE_ENABLE_EXCEPTIONS}")
>> 
>> Setting CMAKE_CXX_FLAGS is not 'modern cmake'. Prefer to use
>> add_compile_options instead.
>> 
>>  http://www.cmake.org/cmake/help/git-next/command/add_compile_options.html
> 
> Question: how do you get add_compile_options to only add options for a
> particular language?  The generator expressions allow selection based on
> which C++ or C compiler is in use, but I can't see a way of controlling
> flags based on whether the current target is C++, C or other.

Indeed, that's not currently possible. Seems like an oversight. It can 
possibly be fixed in a future version of CMake.

Thanks,

Steve





More information about the Kde-buildsystem mailing list