есть один проект, который решил перевести с qt4 на qt5. Сборка кроссплатформенная собираю через cmake. Сделал файл для qt5 CMakeLists.txt, все замечательно собралось с виду. Но плагины перестали работать (Plugin verification data mismatch). НО! Если собираешь по qmake и подсовываешь плагин, все хорошо.
может кто свежим глазом увидти, а неделю бьюсь. Глупость какая то, скорей всегшо где то, только я ее не вижу
Сам pro который собирает в обоих случаях хорошо
#-------------------------------------------------
#
# Project created by QtCreator 2012-01-23T15:44:54
#
#-------------------------------------------------
QT += gui sql
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets multimedia
DEFINES += HAVE_QT5
}
TARGET = remind
TEMPLATE = lib
CONFIG += plugin
INCLUDEPATH += "../remember" "../../common" "../../CheckBoxDelegate" ".."
INSTALLS += target
SOURCES += remind.cpp\
remember.cpp \
misc.cpp \
sound.cpp \
chkdate.cpp \
plugins.cpp
HEADERS += remember.h \
config.h \
sound.h \
plugins.h \
plugininterface.h \
plugin.h
RESOURCES = remind.qrc
win32 {
INCLUDEPATH += "d:/library/include"
DEFINES += _WIN32 _MINGW32 _DLL
LIBS += -L"d:/library/lib" \
-ladvini \
-lmaint
greaterThan(QT_MAJOR_VERSION, 4): {
LIBS += -lmaintqt5
} else: {
LIBS += -lmaintqt
}
target.path = D:/SRC/infoman/distr/infoman/plugins
}
unix {
contains(QMAKE_HOST.arch, x86_64) {
message("x86_64 build")
target.path = /usr/local/lib64/infoman
} else {
message("x86 build")
target.path = /usr/local/lib/infoman
}
INCLUDEPATH += "/usr/local/include"
DEFINES += _UNIX \
_LINUX _DLL
LIBS += -ladvini \
-lmaint
greaterThan(QT_MAJOR_VERSION, 4): {
LIBS += -lmaintqt5
} else: {
LIBS += -lmaintqt
}
}
А это CMakeLists.txt для Qt5, который не собирает
project( remind )
set(MAJOR_VERSION 2.0.1)
set(MINOR_VERSION 2.0)
cmake_minimum_required( VERSION 2.6 )
# Instruct CMake to run moc automatically when needed.
#set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_BUILD_TYPE Release )
add_definitions ( -Wall )
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Sql REQUIRED)
find_package(Qt5Multimedia REQUIRED)
include_directories (
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${Qt5Widgets_INCLUDE_DIRS}, ${Qt5Widgets_LIBRARIES}}
/usr/local/include)
# We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
add_definitions(${Qt5Widgets_DEFINITIONS})
# Executables fail to build with Qt 5 in the default configuration
# without -fPIE. We add that here.
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set ( remind_HDRS
remember.h
sound.h
plugins.h
plugininterface.h
plugin.h
)
set ( remind_SRCS
remind.cpp
remember.cpp
misc.cpp
sound.cpp
chkdate.cpp
plugins.cpp
)
set ( remind_RSCS
remind.qrc
)
QT5_ADD_RESOURCES(RSCS ${remind_RSCS})
set ( remind_MOCS
plugin.h
)
QT5_WRAP_CPP(MOCS ${remind_MOCS})
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "64 bits compiler detected" )
SET( EX_PLATFORM 64 )
SET( EX_PLATFORM_NAME "x64" )
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "32 bits compiler detected" )
SET( EX_PLATFORM 32 )
SET( EX_PLATFORM_NAME "x86" )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
if(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
set(CMAKE_INSTALL_PREFIX d:/library)
if( EX_PLATFORM EQUAL 64)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib64/)
else( EX_PLATFORM EQUAL 32)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/)
endif( EX_PLATFORM EQUAL 64)
set(LIB_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include/)
ADD_DEFINITIONS( -D_WIN32 -D_MINGW32 -DHAVE_QT5)
include_directories ("d:/library/include")
link_directories( "d:/library/lib")
set( REQUIRED_LIBRARIES advini maint)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
set(CMAKE_INSTALL_PREFIX /usr/local)
if( EX_PLATFORM EQUAL 64)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib64/)
else( EX_PLATFORM EQUAL 32)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/)
endif( EX_PLATFORM EQUAL 64)
set(LIB_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include/)
ADD_DEFINITIONS( -D_UNIX=1 -D_LINUX -DHAVE_QT5)
endif()
add_library ( remind SHARED ${remind_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS} )
target_link_libraries (remind ${Qt5Core_LIBRARIES}
${Qt5Core_QTMAIN_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${Qt5Sql_LIBRARIES}
${Qt5Multimedia_LIBRARIES}
maint advini maintqt5)
set_target_properties( remind PROPERTIES VERSION ${MAJOR_VERSION} SOVERSION ${MINOR_VERSION} )
install(TARGETS remind DESTINATION ${LIB_INSTALL_PATH}/infoman)
На всякий А это CMakeLists.txt для Qt4, который нормально собирает
project( remind )
set(MAJOR_VERSION 2.0.1)
set(MINOR_VERSION 2.0)
cmake_minimum_required( VERSION 2.6 )
set ( CMAKE_BUILD_TYPE Release )
add_definitions ( -Wall )
find_package ( Qt4 REQUIRED )
include ( ${QT_USE_FILE} )
include_directories (
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTSQL_INCLUDE_DIR} ${QT_QTWIDGETS_INCLUDE_DIR} ${QT_QTMULTIMEDIA_INCLUDE_DIR}
/usr/local/include)
set ( remind_HDRS
remember.h
sound.h
plugins.h
plugininterface.h
plugin.h
)
set ( remind_SRCS
remind.cpp
remember.cpp
misc.cpp
sound.cpp
chkdate.cpp
plugins.cpp
)
set ( remind_RSCS
remind.qrc
)
QT4_ADD_RESOURCES(RSCS ${remind_RSCS})
set ( remind_MOCS
plugin.h
)
QT4_WRAP_CPP(MOCS ${remind_MOCS})
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "64 bits compiler detected" )
SET( EX_PLATFORM 64 )
SET( EX_PLATFORM_NAME "x64" )
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "32 bits compiler detected" )
SET( EX_PLATFORM 32 )
SET( EX_PLATFORM_NAME "x86" )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
if(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
set(CMAKE_INSTALL_PREFIX d:/library)
if( EX_PLATFORM EQUAL 64)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib64/)
else( EX_PLATFORM EQUAL 32)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/)
endif( EX_PLATFORM EQUAL 64)
set(LIB_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include/)
ADD_DEFINITIONS( -D_WIN32 -D_MINGW32)
include_directories ("d:/library/include")
link_directories( "d:/library/lib")
set( REQUIRED_LIBRARIES advini maint)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
set(CMAKE_INSTALL_PREFIX /usr/local)
if( EX_PLATFORM EQUAL 64)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib64/)
else( EX_PLATFORM EQUAL 32)
set(LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/)
endif( EX_PLATFORM EQUAL 64)
set(LIB_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include/)
ADD_DEFINITIONS( -D_UNIX=1 -D_LINUX )
endif()
add_library ( remind SHARED ${remind_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS} )
target_link_libraries ( remind ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTWIDGETS_LIBRARY} ${QT_QTMULTIMEDIA_LIBRARY} )
set_target_properties( remind PROPERTIES VERSION ${MAJOR_VERSION} SOVERSION ${MINOR_VERSION} )
install(TARGETS remind DESTINATION ${LIB_INSTALL_PATH}/infoman)