MantisBT - CMake
View Issue Details
0014292CMakeCMakepublic2013-07-15 11:262013-12-02 08:51
Nikita Krupenko 
Stephen Kelly 
normalmajoralways
closedfixed 
x86Windows7
CMake 2.8.11.2 
CMake 2.8.12 
0014292: CMake does not add QT_NO_DEBUG definition for non-debug builds
I created Qt5 CMake project and use the code like the following:

cmake_minimum_required(VERSION 2.8.11)
find_package(Qt5Core REQUIRED)
target_link_libraries(${PROJECT_NAME} Qt5::Core)

The problem is that CMake does not defines QT_NO_DEBUG for release build, like qmake does. If I build qml-plugin, I can't use release build of it, because Qt takes it for debug build and I get the following error:

"The plugin uses incompatible Qt library. (Cannot mix debug and release libraries.)"

The workaround is simple:

if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
    add_definitions(-DQT_NO_DEBUG)
endif()

It works, but I think this should be done in CMake.


No tags attached.
Issue History
2013-07-15 11:26Nikita KrupenkoNew Issue
2013-07-15 12:41Clinton StimpsonNote Added: 0033540
2013-07-15 12:41Clinton StimpsonStatusnew => resolved
2013-07-15 12:41Clinton StimpsonResolutionopen => no change required
2013-07-15 12:41Clinton StimpsonAssigned To => Clinton Stimpson
2013-07-15 12:52Stephen KellyAssigned ToClinton Stimpson => Stephen Kelly
2013-07-15 12:52Stephen KellyNote Added: 0033541
2013-07-15 12:52Stephen KellyStatusresolved => feedback
2013-07-15 12:52Stephen KellyResolutionno change required => reopened
2013-07-15 12:52Stephen KellyStatusfeedback => assigned
2013-07-24 11:20Stephen KellyStatusassigned => resolved
2013-07-24 11:20Stephen KellyFixed in Version => CMake 2.8.12
2013-07-24 11:20Stephen KellyResolutionreopened => fixed
2013-12-02 08:51Robert MaynardNote Added: 0034655
2013-12-02 08:51Robert MaynardStatusresolved => closed

Notes
(0033540)
Clinton Stimpson   
2013-07-15 12:41   
No change required to CMake.

Qt5 comes with its own CMake config files maintained by Qt developers.
Any bugs in those files need to be submitted to them.

By the way, it has already been fixed for Release builds, and there is already a bug report for RelWithDebInfo builds.
https://bugreports.qt-project.org/browse/QTBUG-32403 [^]
(0033541)
Stephen Kelly   
2013-07-15 12:52   
Actually this is a CMake bug. The Qt5::Core IMPORTED target has the appropriate INTERFACE_COMPILE_DEFINITIONS, but CMake is not processing it correctly.

I've merged the fix-mapped-config-genex branch to next to fix that.
(0034655)
Robert Maynard   
2013-12-02 08:51   
Closing resolved issues that have not been updated in more than 4 months.