сабж. Вот мой CMakeLists :
cmake_minimum_required(VERSION 2.8)
project(InternalEye)
add_definitions(-std=c++14)
#set(CMAKE_PREFIX_PATH "/home/zamazan4ik/Qt/5.6/gcc_64/")
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets)
find_package(Qt5Core)
find_package(Qt5Gui)
#aux_source_directory(. SRC_LIST)
include_directories(
${CMAKE_SOURCE_DIR}/headers
${CMAKE_SOURCE_DIR}/headers/gui
)
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
add_executable(${PROJECT_NAME}
src/Application.cpp
src/cpu.cpp
src/DateDifference.cpp
src/main.cpp
src/Util.cpp
src/Vendor.cpp
src/gui/MainWindow.cpp
src/gui/MenuBar.cpp
src/modules/benchmark/Benchmarks.cpp
src/modules/computer/Boot.cpp
src/modules/computer/Computer.cpp
src/modules/computer/DevTools.cpp
src/modules/computer/DisplayInfo.cpp
src/modules/computer/Filesystem.cpp
src/modules/computer/Group.cpp
src/modules/computer/Language.cpp
src/modules/computer/LoadInfo.cpp
src/modules/computer/MemoryInfo.cpp
src/modules/computer/OperatingSystem.cpp
src/modules/computer/UptimeInfo.cpp
src/modules/computer/User.cpp
src/modules/devices/Devices.cpp
src/modules/devices/InputDevices.cpp
src/modules/devices/Module.cpp
src/modules/network/Network.cpp
)
qt5_use_modules(${PROJECT_NAME} Widgets Core Gui)
#target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
Errors :
20:35:22: Выполняются этапы для проекта InternalEye...
20:35:22: Запускается: «/usr/bin/make»
[ 3%] Automatic moc for target InternalEye
[ 3%] Built target InternalEye_automoc
Scanning dependencies of target InternalEye
[ 7%] Building CXX object CMakeFiles/InternalEye.dir/src/Application.cpp.o
[ 10%] Building CXX object CMakeFiles/InternalEye.dir/src/cpu.cpp.o
[ 14%] Building CXX object CMakeFiles/InternalEye.dir/src/DateDifference.cpp.o
[ 17%] Building CXX object CMakeFiles/InternalEye.dir/src/main.cpp.o
[ 21%] Building CXX object CMakeFiles/InternalEye.dir/src/Util.cpp.o
[ 25%] Building CXX object CMakeFiles/InternalEye.dir/src/Vendor.cpp.o
[ 28%] Building CXX object CMakeFiles/InternalEye.dir/src/gui/MainWindow.cpp.o
[ 32%] Building CXX object CMakeFiles/InternalEye.dir/src/gui/MenuBar.cpp.o
[ 35%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/benchmark/Benchmarks.cpp.o
[ 39%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/Boot.cpp.o
[ 42%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/Computer.cpp.o
[ 46%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/DevTools.cpp.o
[ 50%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/DisplayInfo.cpp.o
[ 53%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/Filesystem.cpp.o
[ 57%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/Group.cpp.o
[ 60%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/Language.cpp.o
[ 64%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/LoadInfo.cpp.o
[ 67%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/MemoryInfo.cpp.o
[ 71%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/OperatingSystem.cpp.o
[ 75%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/UptimeInfo.cpp.o
[ 78%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/computer/User.cpp.o
[ 82%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/devices/Devices.cpp.o
[ 85%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/devices/InputDevices.cpp.o
[ 89%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/devices/Module.cpp.o
[ 92%] Building CXX object CMakeFiles/InternalEye.dir/src/modules/network/Network.cpp.o
[ 96%] Building CXX object CMakeFiles/InternalEye.dir/InternalEye_automoc.cpp.o
[100%] Linking CXX executable InternalEye
CMakeFiles/InternalEye.dir/src/Application.cpp.o: In function `Application::Application()':
Application.cpp:(.text+0x32): undefined reference to `vtable for Application'
CMakeFiles/InternalEye.dir/src/Application.cpp.o: In function `Application::~Application()':
Application.cpp:(.text+0x1b9): undefined reference to `vtable for Application'
CMakeFiles/InternalEye.dir/build.make:747: recipe for target 'InternalEye' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/InternalEye.dir/all' failed
Makefile:83: recipe for target 'all' failed
CMakeFiles/InternalEye.dir/src/gui/MainWindow.cpp.o: In function `MainWindow::MainWindow(QWidget*)':
MainWindow.cpp:(.text+0x4e): undefined reference to `vtable for MainWindow'
MainWindow.cpp:(.text+0x60): undefined reference to `vtable for MainWindow'
CMakeFiles/InternalEye.dir/src/gui/MainWindow.cpp.o: In function `MainWindow::~MainWindow()':
MainWindow.cpp:(.text+0x341): undefined reference to `vtable for MainWindow'
MainWindow.cpp:(.text+0x353): undefined reference to `vtable for MainWindow'
CMakeFiles/InternalEye.dir/src/gui/MainWindow.cpp.o: In function `MainWindow::tr(char const*, char const*, int)':
MainWindow.cpp:(.text._ZN10MainWindow2trEPKcS1_i[_ZN10MainWindow2trEPKcS1_i]+0x3b): undefined reference to `MainWindow::staticMetaObject'
CMakeFiles/InternalEye.dir/src/gui/MenuBar.cpp.o: In function `MenuBar::MenuBar(QWidget*)':
MenuBar.cpp:(.text+0x27): undefined reference to `vtable for MenuBar'
MenuBar.cpp:(.text+0x39): undefined reference to `vtable for MenuBar'
CMakeFiles/InternalEye.dir/src/gui/MenuBar.cpp.o: In function `MenuBar::tr(char const*, char const*, int)':
MenuBar.cpp:(.text._ZN7MenuBar2trEPKcS1_i[_ZN7MenuBar2trEPKcS1_i]+0x3b): undefined reference to `MenuBar::staticMetaObject'
collect2: error: ld returned 1 exit status
make[2]: *** [InternalEye] Error 1
make[1]: *** [CMakeFiles/InternalEye.dir/all] Error 2
make: *** [all] Error 2
20:35:45: Процесс «/usr/bin/make» завершился с кодом 2.
Ошибка при сборке/установке проекта InternalEye (комплект: Desktop Qt 5.6.0 GCC 64bit)
Во время выполнения этапа «Сборка»
20:35:45: Прошло времени: 00:23.
Исходники (только в чуть другой иерархии): https://github.com/ZaMaZaN4iK/InternalEye
qmake всё делает нормально и всё работает:
#-------------------------------------------------
#
# Project created by QtCreator 2016-01-29T15:29:42
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = InternalEye
TEMPLATE = app
CONFIG += c++11\
c++14\
c++17
SOURCES += main.cpp\
MainWindow.cpp \
cpu.cpp \
Computer.cpp \
OperatingSystem.cpp \
Util.cpp \
MemoryInfo.cpp \
DisplayInfo.cpp \
UptimeInfo.cpp \
LoadInfo.cpp \
Benchmarks.cpp \
Boot.cpp \
DateDifference.cpp \
Network.cpp \
Devices.cpp \
InputDevices.cpp \
Vendor.cpp \
MenuBar.cpp \
SystemTray.cpp \
Application.cpp \
Group.cpp \
User.cpp \
Module.cpp \
Filesystem.cpp \
Language.cpp \
DevTools.cpp
HEADERS += MainWindow.h \
cpu.h \
Computer.h \
Util.h \
Benchmarks.h \
DateDifference.h \
Network.h \
Devices.h \
Vendor.h \
Constants.h \
MenuBar.h \
SystemTray.h \
Application.h
RESOURCES += \
Resources.qrc