aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/cmake')
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index 85ad6129e..b5bb725fe 100644
--- a/sources/pyside2/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside2/cmake/Macros/PySideModules.cmake
@@ -160,10 +160,17 @@ macro(check_qt_class module class optional_source_files dropped_entries)
"${NAMESPACE_USE}\n"
"int main() { sizeof(${class}); }\n"
)
+
+ # Force usage of the C++11 standard. CMAKE_CXX_STANDARD does not work with try_compile
+ # but the issue has a fix in CMake 3.9. Thus we use a terrible workaround, we pass the C++
+ # standard flag the way CheckCXXSourceCompiles.cmake does it.
+ set(CUSTOM_CPP_STANDARD ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION})
+
try_compile(Q_WORKS ${CMAKE_BINARY_DIR}
${SRC_FILE}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${QT_INCLUDE_DIR};${Qt5${_module_no_qt_prefix}_INCLUDE_DIRS}"
+ "-DCOMPILE_DEFINITIONS:STRING=${CUSTOM_CPP_STANDARD}"
OUTPUT_VARIABLE OUTPUT)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCheckQtClassTest.log ${OUTPUT})