Qt: define Q_DISABLE_COPY_MOVE only if needed

This commit is contained in:
wmayer
2023-11-21 19:04:21 +01:00
committed by wwmayer
parent 7bf9acdc75
commit 132b077983
3 changed files with 39 additions and 1 deletions

View File

@@ -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)

View File

@@ -85,7 +85,8 @@
FC_DEFAULT_COPY(Class) \
FC_DEFAULT_MOVE(Class)
#ifndef Q_DISABLE_COPY_MOVE
#include <QtCore.h>
#ifndef HAVE_Q_DISABLE_COPY_MOVE
#define Q_DISABLE_COPY_MOVE FC_DEFAULT_COPY_MOVE
#endif

33
src/QtCore.h.cmake Normal file
View File

@@ -0,0 +1,33 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) 2023 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* 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 *
* <https://www.gnu.org/licenses/>. *
* *
**************************************************************************/
#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