diff options
author | Stephen Kelly <steveire@gmail.com> | 2017-01-11 21:03:22 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2017-01-11 21:07:58 +0000 |
commit | 8aa6843404f9c6faef66cb9c76358158eafc1af1 (patch) | |
tree | 578dcf79543fb45b0a176506c0a4f4afdd7cd73b | |
parent | 1915787b80ed8fada9ee78d0b150d7a71e6db7fc (diff) | |
download | extra-cmake-modules-8aa6843404f9c6faef66cb9c76358158eafc1af1.tar.gz extra-cmake-modules-8aa6843404f9c6faef66cb9c76358158eafc1af1.tar.bz2 |
Explicitly pass -std=gnu++14 to clang when generating bindings
The generator expression here looks like it should work, but it does not
set the appropriate flags for compilation. It seems that the
CXX_STANDARD property is not yet populated at the time the generator
expression is evaluated (to be investigated later).
This came to light because users of Qt 5.7+ attempted to generate the
bindings, but they encountered errors. The step of using libclang to
parse the provided headers was actually failing, but that was not
noticed, perhaps because the logging infrastructure in sip_generator
does not emit it (to investigate later).
BUG: 374801
-rw-r--r-- | find-modules/FindPythonModuleGeneration.cmake | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/find-modules/FindPythonModuleGeneration.cmake b/find-modules/FindPythonModuleGeneration.cmake index ed4f4a6e..2e6172aa 100644 --- a/find-modules/FindPythonModuleGeneration.cmake +++ b/find-modules/FindPythonModuleGeneration.cmake @@ -330,9 +330,11 @@ function(ecm_generate_python_binding endforeach() set(comp_defs "-D$<JOIN:$<TARGET_PROPERTY:${target_value},INTERFACE_COMPILE_DEFINITIONS>,;-D>") - foreach(stdVar 11 14) - set(stdFlag "$<$<STREQUAL:$<TARGET_PROPERTY:${target_value},CXX_STANDARD>,${stdVar}>:${CMAKE_CXX${stdVar}_EXTENSION_COMPILE_OPTION}>") - endforeach() + # We might like to use $<TARGET_PROPERTY:${target_value},CXX_STANDARD>, but + # unfortunately CMake does not populate that property as a side-effect of evaluating + # COMPILE_FEATURES (Qt specifies feature requirements in its INTERFACE_COMPILE_FEATURES, and + # those are consumed to set the CXX_STANDARD internally in CMake, but evidently too late) + set(stdFlag "-std=gnu++14") set(comp_flags "$<JOIN:$<TARGET_PROPERTY:${target_value},INTERFACE_COMPILE_OPTIONS>;${stdFlag},;>") |