From 1656463d04947262bbac7b76326d0afbc3b3bf12 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 28 Feb 2020 22:00:36 +0100 Subject: [PATCH] Fix runtime errors if compiling in Debug mode on MacOS Before this fix, the execution crashed at the first PVT fix computation when compiling with the Debug mode --- CMakeLists.txt | 12 ++++++++++++ docs/changelog.md | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8beff391e..dc2302335 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,6 +233,18 @@ if((${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") AND (CMAKE_CXX_COMPILER_I set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG") endif() endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Fix for Debug mode in macOS + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-fstandalone-debug HAVE_STANDALONE_DEBUG) + check_cxx_compiler_flag(-Og HAVE_OG_FLAG) + if(HAVE_STANDALONE_DEBUG AND HAVE_OG_FLAG) + set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -fstandalone-debug") + set(CMAKE_C_FLAGS_DEBUG "-Og -g -fstandalone-debug") + endif() + endif() +endif() # allow 'large' files in 32 bit builds if(UNIX) diff --git a/docs/changelog.md b/docs/changelog.md index ab65266ff..2e7d77789 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -100,6 +100,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades = @@ -190,7 +191,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades