diff --git a/CMakeLists.txt b/CMakeLists.txt index a900354..981c05e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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,49 +22,49 @@ 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}) - # 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") +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 "Qt6Core") else () - message("Qt5 not found, searching for Qt4") - find_package(Qt4 REQUIRED) - include(${QT_USE_FILE}) - # 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 "QtCore") + message("Qt6 not found, searching for Qt4") + find_package(Qt4 REQUIRED) + include(${QT_USE_FILE}) + # 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 "QtCore") endif () option (WITH_GUI_TYPES "Build with support for QtGui types") if (WITH_GUI_TYPES) - if (QT4_BUILD) - find_package(Qt4 QTGUI) - else () - find_package(Qt5Gui QUIET) - endif () + if (QT4_BUILD) + find_package(Qt4 QTGUI) + else () + 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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41fbcc8..ed429dd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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( @@ -39,4 +39,4 @@ install(TARGETS qmsgpack EXPORT qmsgpack-export PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/qmsgpack) -install(FILES ${qmsgpack_stream_headers} DESTINATION ${INCLUDE_INSTALL_DIR}/qmsgpack/stream) \ No newline at end of file +install(FILES ${qmsgpack_stream_headers} DESTINATION ${INCLUDE_INSTALL_DIR}/qmsgpack/stream) diff --git a/src/CMakeLists.txt~ b/src/CMakeLists.txt~ deleted file mode 100644 index 3d656d3..0000000 --- a/src/CMakeLists.txt~ +++ /dev/null @@ -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) \ No newline at end of file