forked from romixlab/qmsgpack
Patches to get it working with Qt6
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
#set(Qt5Core_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
||||
#set(Qt5Test_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Test")
|
||||
#set(Qt5_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
||||
#set(QT_QMAKE_EXECUTABLE "/opt/Qt5.6.0/5.6/gcc_64/bin/qmake")
|
||||
#set(Qt6Core_DIR "/opt/Qt6.6.0/5.6/gcc_64/lib/cmake/Qt6Core")
|
||||
#set(Qt6Test_DIR "/opt/Qt6.6.0/5.6/gcc_64/lib/cmake/Qt6Test")
|
||||
#set(Qt6_DIR "/opt/Qt6.6.0/5.6/gcc_64/lib/cmake/Qt6Core")
|
||||
#set(QT_QMAKE_EXECUTABLE "/opt/Qt6.6.0/5.6/gcc_64/bin/qmake")
|
||||
|
||||
project(qmsgpack)
|
||||
|
||||
cmake_minimum_required(VERSION 3.1.0)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD 20)
|
||||
|
||||
set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
|
||||
|
||||
@ -22,20 +22,20 @@ endif (WIN32)
|
||||
|
||||
option (QT4_BUILD "BUild with Qt4")
|
||||
if (NOT QT4_BUILD)
|
||||
find_package(Qt5Core QUIET)
|
||||
find_package(Qt6Core QUIET)
|
||||
endif ()
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
message("Qt5 found")
|
||||
include_directories(${Qt5Core_INCLUDE_DIRS})
|
||||
add_definitions(${Qt5Core_DEFINITIONS})
|
||||
if (Qt6Core_FOUND)
|
||||
message("Qt6 found")
|
||||
include_directories(${Qt6Core_INCLUDE_DIRS})
|
||||
add_definitions(${Qt6Core_DEFINITIONS})
|
||||
# Find includes in corresponding build directories
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(PC_Requires "Qt5Core")
|
||||
set(PC_Requires "Qt6Core")
|
||||
else ()
|
||||
message("Qt5 not found, searching for Qt4")
|
||||
message("Qt6 not found, searching for Qt4")
|
||||
find_package(Qt4 REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
# Find includes in corresponding build directories
|
||||
@ -50,21 +50,21 @@ if (WITH_GUI_TYPES)
|
||||
if (QT4_BUILD)
|
||||
find_package(Qt4 QTGUI)
|
||||
else ()
|
||||
find_package(Qt5Gui QUIET)
|
||||
find_package(Qt6Gui QUIET)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
option (WITH_LOCATION_TYPES "Build with support for QtLocation types")
|
||||
if (WITH_LOCATION_TYPES)
|
||||
find_package(Qt5Location QUIET)
|
||||
find_package(Qt6Location QUIET)
|
||||
endif ()
|
||||
|
||||
if (Qt5Location_FOUND)
|
||||
message("Qt5Location found")
|
||||
include_directories(${Qt5Location_INCLUDE_DIRS})
|
||||
add_definitions(${Qt5Location_DEFINITIONS})
|
||||
if (Qt6Location_FOUND)
|
||||
message("Qt6Location found")
|
||||
include_directories(${Qt6Location_INCLUDE_DIRS})
|
||||
add_definitions(${Qt6Location_DEFINITIONS})
|
||||
else ()
|
||||
message("Qt5Location not found")
|
||||
message("Qt6Location not found")
|
||||
endif ()
|
||||
|
||||
if (NOT WIN32)
|
||||
|
@ -8,14 +8,14 @@ endif(NOT DEFINED COMPILE_TYPE)
|
||||
|
||||
add_library(qmsgpack ${COMPILE_TYPE} ${qmsgpack_srcs} ${qmsgpack_headers})
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
target_link_libraries(qmsgpack Qt5::Core)
|
||||
if (Qt6Core_FOUND)
|
||||
target_link_libraries(qmsgpack Qt6::Core)
|
||||
else ()
|
||||
target_link_libraries(qmsgpack ${QT_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (Qt5Gui_FOUND)
|
||||
target_link_libraries(qmsgpack Qt5::Gui)
|
||||
if (Qt6Gui_FOUND)
|
||||
target_link_libraries(qmsgpack Qt6::Gui)
|
||||
endif ()
|
||||
|
||||
configure_file(
|
||||
|
@ -1,34 +0,0 @@
|
||||
set(qmsgpack_srcs msgpack.cpp msgpack_common.cpp stream.cpp private/pack_p.cpp private/unpack_p.cpp private/qt_types_p.cpp)
|
||||
set(qmsgpack_headers msgpack.h stream.h msgpack_common.h msgpack_export.h endianhelper.h)
|
||||
|
||||
add_library(qmsgpack SHARED ${qmsgpack_srcs} ${qmsgpack_headers})
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
target_link_libraries(qmsgpack Qt5::Core)
|
||||
else ()
|
||||
target_link_libraries(qmsgpack ${QT_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (Qt5Gui_FOUND)
|
||||
target_link_libraries(qmsgpack Qt5::Gui)
|
||||
endif ()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/msgpack_common.h.in"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/msgpack_common.h"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
if (NOT android)
|
||||
set_target_properties(qmsgpack PROPERTIES
|
||||
VERSION ${QMSGPACK_MAJOR}.${QMSGPACK_MINOR}.${QMSGPACK_VERSION}
|
||||
SOVERSION ${QMSGPACK_MAJOR})
|
||||
endif ()
|
||||
set_target_properties(qmsgpack PROPERTIES
|
||||
DEFINE_SYMBOL MSGPACK_MAKE_LIB
|
||||
PUBLIC_HEADER "${qmsgpack_headers}")
|
||||
|
||||
install(TARGETS qmsgpack EXPORT qmsgpack-export
|
||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
|
||||
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
||||
PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/qmsgpack)
|
Reference in New Issue
Block a user