From b0409a8ec4a8c8a78cf4035b996c5e7e5e1983c3 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Tue, 29 Mar 2022 14:08:00 -0400 Subject: [PATCH] cmake(Windows): force structured and standard C++ exception model CMake doesn't add this flag and it must be done manually. This was not caught early as reconfiguring adds the flag for some reason. It's to be determined if this is expected behavior. I hope not, it's just confusing. + Add the `/EHsc` flag + remove CMAKE_BUILD_TYPE from configure step in helper script + remove useless Window definitions from qtwrapper that are defined in the parent CMakeLists.txt Gitlab: #504 Change-Id: I8b03d81cae7ebed6a31cb69642db2f9f09a0c91b --- CMakeLists.txt | 3 +-- make-lrc.py | 3 +-- src/qtwrapper/CMakeLists.txt | 8 +------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e57e9209..1d227598 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,8 +31,7 @@ if(CMAKE_GENERATOR_SHORT MATCHES "Visual Studio ") set(ENABLE_STATIC true) add_definitions(-DUNICODE -D_UNICODE) remove_definitions(-D_MBCS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /W0 /MP") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi /W0 /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /W0 /MP /EHsc") endif() if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")) diff --git a/make-lrc.py b/make-lrc.py index abfa28ca..9d16934f 100644 --- a/make-lrc.py +++ b/make-lrc.py @@ -104,10 +104,9 @@ def build(qtver): cmake_options = [ '-DCMAKE_PREFIX_PATH=' + qt_dir, - '-DCMAKE_BUILD_TYPE=' + config_str, '-Dring_BIN=' + daemon_bin, '-DRING_INCLUDE_DIR=' + daemon_dir + '\\src\\jami' - ] + ] if not os.path.exists(build_dir): os.makedirs(build_dir) diff --git a/src/qtwrapper/CMakeLists.txt b/src/qtwrapper/CMakeLists.txt index 4bbd7b70..ea92f0ad 100644 --- a/src/qtwrapper/CMakeLists.txt +++ b/src/qtwrapper/CMakeLists.txt @@ -62,10 +62,4 @@ IF(NOT ${ring_BIN} MATCHES "ring_BIN-NOTFOUND") Qt::Core ${ring_BIN} ) -ENDIF() - -if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - add_definitions(-DUNICODE -D_UNICODE) - remove_definitions(-D_MBCS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -endif() \ No newline at end of file +ENDIF() \ No newline at end of file -- GitLab