QtCreator cmake release build seems to be using debug libraries
ChortleMortal last edited by ChortleMortal
I have converted a qmake build to a cmake build. The debug build seems fine. But when using QrCreator I switch to the Release build, it compiles but does not link with numerous errors. Below is just the first instance of the errors. Seems like it is using Qt6Cored.lib rather than Qt6Core.lib. I would have thought that QtCreator would handle all this, but is there something that needs to be put into the CMakeLists.txt to say which libraries to use for release and debug. I would have thought the Qt Kit handled all that.
LINK: command "C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\TiledPatternMaker.rsp /out:TiledPatternMaker.exe /implib:TiledPatternMaker.lib /pdb:TiledPatternMaker.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console -DYNAMICBASE -NXCOMPAT -OPT:REF -OPT:ICF /MANIFEST /MANIFESTFILE:TiledPatternMaker.exe.manifest" failed (exit code 1120) with the following output:
Qt6Cored.lib(qmetaobject.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in mocs_compilation.cpp.obj
Qt6Cored.lib(qmetaobject.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in mocs_compilation.cpp.obj
ChortleMortal last edited by
Well I made two changes and don't know which one fixed it. But in case someone else has this problem, this is what I did.
First, I downloaded and started using QtCreator 4.15.0-beta 2 since it has lots of changes related to cmake.
Second, I added a call to qt_finalize_executable() it to my CmakeLists.tx().
So now, all the builds work