diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-11-16 15:21:03 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-11-16 15:47:51 +0000 |
commit | f97d4732d4d455de4964858a52765ab695ba6159 (patch) | |
tree | 2eb0bbe2f5a0421f1d2f53cd8eb0126e283f66e3 | |
parent | e13173c112b729da8f53dd2e81e8116a1ed857cf (diff) |
CMake: Enable exceptions by default
Without breaking currently generated CMakeLists
Fixes: QTBUG-88549
Change-Id: Ibda643e1374d9024bf693c12de8ec0ac46e09b7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | cmake/QtTestHelpers.cmake | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 0dca2ab6ab..8a11705d8e 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -142,8 +142,9 @@ endfunction() # This function creates a CMake test target with the specified name for use with CTest. function(qt_internal_add_test name) + # EXCEPTIONS is a noop as they are enabled by default. qt_parse_all_arguments(arg "qt_add_test" - "RUN_SERIAL;EXCEPTIONS;GUI;QMLTEST;CATCH;LOWDPI" + "RUN_SERIAL;EXCEPTIONS;NO_EXCEPTIONS;GUI;QMLTEST;CATCH;LOWDPI" "OUTPUT_DIRECTORY;WORKING_DIRECTORY;TIMEOUT;VERSION" "QML_IMPORTPATH;TESTDATA;QT_TEST_SERVER_LIST;${__default_private_args};${__default_public_args}" ${ARGN} ) @@ -152,8 +153,11 @@ function(qt_internal_add_test name) set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endif() - if (${arg_EXCEPTIONS}) - set(exceptions_text "EXCEPTIONS") + # Qt modules get compiled without exceptions enabled by default. + # However, testcases should be still built with exceptions. + set(exceptions_text "EXCEPTIONS") + if (${arg_NO_EXCEPTIONS}) + set(exceptions_text "") endif() if (${arg_GUI}) |