[cmake-developers] I fear $<COMPILE_FEATURES:*> is not really useful...
Rolf Eike Beer
eike at sf-mail.de
Sun Aug 23 06:32:26 EDT 2015
Yes, sadly. I have this code:
if (NOT CMAKE_VERSION VERSION_LESS 3.1)
set_property(TARGET osmium_convert PROPERTY CXX_STANDARD 11)
target_compile_definitions(osmium_convert PRIVATE
$<$<COMPILE_FEATURES:cxx_decltype_incomplete_return_types>:BOOST_RESULT_OF_USE_DECLTYPE>)
endif()
So, in theory, this will set the definition if the compiler supports decltype,
and just don't set it if not. And it works fine for g++. The problem is when it
comes to MSVC:
There is no MSVC version that supports this feature properly, so there is no
variable for this compiler defined. Or just think of $FooBarC++, where noone
cared to report the supported features. No variable either. For these
compilers the above expression fails, because this is no recorded feature of
the compiler. I would have expected it to just not set the definition, but not
error out.
So for now my code is:
if (NOT CMAKE_VERSION VERSION_LESS 3.1 AND CMAKE_CXX_COMPILER_ID STREQUAL
"GNU")
...
Greetings,
Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150823/27a3a978/attachment.sig>
More information about the cmake-developers
mailing list