From 132b07798335fb0e63392d9a5b10e0d15564b21a Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 21 Nov 2023 19:04:21 +0100 Subject: [PATCH] Qt: define Q_DISABLE_COPY_MOVE only if needed --- cMake/FreeCAD_Helpers/SetupQt.cmake | 4 ++++ src/FCGlobal.h | 3 ++- src/QtCore.h.cmake | 33 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/QtCore.h.cmake diff --git a/cMake/FreeCAD_Helpers/SetupQt.cmake b/cMake/FreeCAD_Helpers/SetupQt.cmake index 567b5cd9fa..709648e86a 100644 --- a/cMake/FreeCAD_Helpers/SetupQt.cmake +++ b/cMake/FreeCAD_Helpers/SetupQt.cmake @@ -69,6 +69,10 @@ if (Qt${FREECAD_QT_MAJOR_VERSION}Core_VERSION VERSION_LESS 5.15.0) qt5_add_translation("${_qm_files}" ${ARGN}) set("${_qm_files}" "${${_qm_files}}" PARENT_SCOPE) endfunction() +else() + # Since Qt 5.15 Q_DISABLE_COPY_MOVE is defined + set (HAVE_Q_DISABLE_COPY_MOVE 1) + configure_file(${CMAKE_SOURCE_DIR}/src/QtCore.h.cmake ${CMAKE_BINARY_DIR}/src/QtCore.h) endif() function(qt_find_and_add_translation _qm_files _tr_dir _qm_dir) diff --git a/src/FCGlobal.h b/src/FCGlobal.h index 9501af4a52..db3034e39b 100644 --- a/src/FCGlobal.h +++ b/src/FCGlobal.h @@ -85,7 +85,8 @@ FC_DEFAULT_COPY(Class) \ FC_DEFAULT_MOVE(Class) -#ifndef Q_DISABLE_COPY_MOVE +#include +#ifndef HAVE_Q_DISABLE_COPY_MOVE #define Q_DISABLE_COPY_MOVE FC_DEFAULT_COPY_MOVE #endif diff --git a/src/QtCore.h.cmake b/src/QtCore.h.cmake new file mode 100644 index 0000000000..a54db38330 --- /dev/null +++ b/src/QtCore.h.cmake @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +/*************************************************************************** + * Copyright (c) 2023 Werner Mayer * + * * + * This file is part of FreeCAD. * + * * + * FreeCAD is free software: you can redistribute it and/or modify it * + * under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 2.1 of the * + * License, or (at your option) any later version. * + * * + * FreeCAD is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with FreeCAD. If not, see * + * . * + * * + **************************************************************************/ + + +#ifndef FREECAD_QTCORE_H +#define FREECAD_QTCORE_H + +/* QtCore.h. Generated from QtCore.h.cmake by cmake. */ + +/* Define to 1 Qt provides the macro Q_DISABLE_COPY_MOVE. */ +#cmakedefine HAVE_Q_DISABLE_COPY_MOVE + +#endif // FREECAD_QTCORE_H