[Solved] cmake, mingw, moc linker errors
-
I'm trying to build my application on Windows using MinGW, CMake, and Qt5.2.1. The application builds fine on Linux, however I am getting linker errors when trying to compile on windows. I'm getting a massive number of undefined reference errors that all resemble this:
@CMakeFiles/ArchaicEditor.dir/objects.a(ArchaicEditor_automoc.cpp.obj):ArchaicEdi
tor_automoc.cpp:(.rdata$_ZTV10MapManager[__ZTV10MapManager]+0x34): undefined ref
erence to `QObject::disconnectNotify(QMetaMethod const&)'@My CMakeLists
@cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)project(ArchaicEditor)
IF(MSYS)
set(CMAKE_PREFIX_PATH "C:/Qt/Qt5.2.1")
ENDIF(MSYS)file(GLOB_RECURSE src "src/*.cpp")
include_directories("../ArchaicEngine/includes")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_AUTOMOC ON)find_package(Qt5Core)
find_package(Qt5Widgets)QT5_ADD_RESOURCES(archaiceditor_RESOURCES resources/archaiceditor.qrc)
add_definitions(-std=c++11 -g)
add_executable(ArchaicEditor ${src} ${archaiceditor_RESOURCES})qt5_use_modules(ArchaicEditor Widgets)
@ -
Okay, the problem was that Windows is stupid and requires backslashes for pathnames:
set(CMAKE_PREFIX_PATH "C:\Qt\Qt5.2.1\5.2.1\mingw48_32")