Linking with jack using qmake - c++

I have two similar projects on the same machine. Their difference is that one is using GUI (Qt and Qwt) and the other is not. As the result, the one that has Qt is using qmake to compile and the other one cmake.
The project itself is about signal processing and working with audio. I decided to use RtAudio for capturing audio signal. I can compile and run the example code fine when I'm compiling with cmake but when I try to compile the other project using qmake, it fails.
The problem is jack (audio library) which is not found when compiling using qmake. But first, let's start with the project that works. Here's what I have in my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.18)
project(cli_test)
set(CMAKE_CXX_STANDARD 17)
add_executable(cli_test main.cpp)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(arecord PRIVATE Threads::Threads)
target_link_libraries(arecord PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fftw/lib/libfftw3.a)
include_directories(./rtaudio/include/rtaudio)
#list(GET LIB_TARGETS 0 LIBRTAUDIO)
set(LINKLIBS)
list(APPEND LINKLIBS ${ALSA_LIBRARY})
list(APPEND INCDIRS ${ALSA_INCLUDE_DIR})
target_link_libraries(cli_test ${CMAKE_CURRENT_SOURCE_DIR}/rtaudio/lib/librtaudio.a ${LINKLIBS})
target_link_libraries(cli_test PRIVATE Threads::Threads)
target_link_libraries(cli_test PRIVATE jack)
target_link_libraries(cli_test PRIVATE /usr/lib/libasound.so)
target_link_libraries(cli_test PRIVATE /usr/lib/libpulse.so)
target_link_libraries(cli_test PRIVATE /usr/lib/libpulse-simple.so)
(which again, works just fine). Then I got this one for qwt_test.pro:
CONFIG += c++1z c++14
INCLUDEPATH += .
INCLUDEPATH += $${PWD}/rtaudio/include/rtaudio
LIBS += $${PWD}/fftw/lib/libfftw3.a
LIBS += $${PWD}/rtaudio/lib/librtaudio.a
LIBS += jack
LIBS += /usr/lib/libasound.so
LIBS += /usr/lib/libpulse.so
LIBS += /usr/lib/libpulse-simple.so
TARGET = qwt_test
SOURCES = \
main.cpp
The error that I get is:
linking ../bin/qwt_test
/usr/bin/ld: cannot find jack: No such file or directory
collect2: error: ld returned 1 exit status
My question is, how can I link my project that is using qmake with jack?

To let qmake know where to find the lib please add
LIBS += -L"where-you-have-jack-lib" -ljack

Related

how to convert qmake.pro file to cmake [duplicate]

I have a .pro file on my project, but now I want to port it to a CMakeLists.txt file. How can I do this?
QT += core
QT -= gui
CONFIG += c++11
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
QT += network
SOURCES += main.cpp \
test_interface.cpp \
motomanlibrary.cpp \
processing.cpp
SOURCES += main.cpp \
test_interface.h \
motomanlibrary.h \
processing.h
QMake: The required libraries.
QT += core
QT -= gui
QT += network
CMake: only the add is necessary. An exclude (QT -= gui) is not required.
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
QMake: Additional Compiler flags:
CONFIG += c++11
CMake: Extend the list of compiler flags as required.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
QMake: The source files
SOURCES += main.cpp \
test_interface.cpp \
motomanlibrary.cpp \
processing.cpp
CMake: Create a list of source files
set(SOURCES
main.cpp
test_interface.cpp
motomanlibrary.cpp
processing.cpp
)
QMake: The header to be included:
SOURCES += main.cpp \
test_interface.h \
motomanlibrary.h \
processing.h
CMake: Just show where the header files are.
include_directory(.) # or include_directory(${CMAKE_CURRENT_SOURCE_DIR})
include_directory(some/where/else)
QMake: The target to be built:
TARGET = test
CMake: Set the name of the target, add the sources, link the required libs.
add_executable(test ${SOURCES} )
qt5_use_modules(test Core Network) # This macro depends from the Qt version
# Should not be necessary
#CONFIG += console
#CONFIG -= app_bundle
#TEMPLATE = app
See further details on Convert qmake to cmake
There is a python script to convert QMake to CMake on a WIP branch of Qt Base: https://code.qt.io/cgit/qt/qtbase.git/tree/util/cmake/pro2cmake.py?h=wip/cmake
It will probably be released with Qt 6 when CMake will become the main build system.
This is what you would typically write in a simple Qt application built with cmake consuming Qt. A few gotchas:
Use automoc. This reduces the maintenance overhead significantly. It is also fast enough even for large projects so that you do not need to care about build-time slow-down.
Use versionless cmake targets so that they are compatible across Qt versions.
If you can, take advantage of the QT_DISABLE_DEPRECATED_BEFORE variable.
As a bonus, enable some usual warning, error and sanitizer detections if you aim for high quality.
You may or may not want to add a Qt 5 fallback in case anyone would like to use your software with Qt 5. This requirement may phase out slowly, but surely.
project(Application VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS Widgets)
if (NOT Qt6_FOUND)
find_package(Qt5 5.15 REQUIRED COMPONENTS Widgets)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "(Clang|GNU)")
add_compile_options(-Wall -Wpedantic -Wextra -Werror)
add_compile_options(-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "/w")
endif()
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0xFFFFFF)
add_executable(Application
mainwindow.cpp
main.cpp
)
target_link_libraries(Application Qt::Widgets)

How to add successfully pcl library to a qt project with qmake

i am trying to include pcl library to my qt application project using qmake. I found some similar questions, however none of the answers help to solve my problem.
I have tried to add to the .pro file the paths from pcl lib as well as the 3rd party libraries which are used by pcl. Here is the include lines of my .pro file.
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/lib
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/3rdParty/Eigen/bin
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/3rdParty/Boost/lib
INCLUDEPATH += D:/Libraries/PCL_1.6.0/include/pcl-1.6
DEPENDPATH += D:/Libraries/PCL_1.6.0/include/pcl-1.6
INCLUDEPATH += D:/Libraries/PCL_1.6.0/3rdParty/Eigen/include
DEPENDPATH += D:/Libraries/PCL_1.6.0/3rdParty/Eigen/include
INCLUDEPATH += D:/Libraries/PCL_1.6.0/3rdParty/Boost/include
DEPENDPATH += D:/Libraries/PCL_1.6.0/3rdParty/Boost/include
After that, i am just trying put this include to one of my files:
include pcl/io/pcd_io.h
And these are the errors i am getting back:
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:604: error: unable to find string literal operator 'operator""X' with 'const char [2]', 'long long unsigned int' arguments
EIGEN_ASM_COMMENT("mybegin2");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:640: error: unable to find string literal operator 'operator""X' with 'const char [2]', 'long long unsigned int' arguments
EIGEN_ASM_COMMENT("myend");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:644: error: unable to find string literal operator 'operator""X' with 'const char [2]', 'long long unsigned int' arguments
EIGEN_ASM_COMMENT("mybegin4");
Can you please help me to solve the problem?
I suggest to use CMake. See the links below:
These are two examples provided by PointCloudLibrary with CMake: qt_colorize_cloud and qt_visualizer.
Here is the explanation for the configuration in Qt.
The CMakeList.txt is as follows:
cmake_minimum_required(VERSION 2.8.11)
project(pcl_visualizer)
# init_qt: Let's do the CMake job for us
set(CMAKE_AUTOMOC ON) # For meta object compiler
set(CMAKE_AUTORCC ON) # Resource files
set(CMAKE_AUTOUIC ON) # UI files
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Find the QtWidgets library
find_package(Qt5 REQUIRED Widgets)
find_package(VTK REQUIRED)
find_package(PCL 1.7.1 REQUIRED)
# Fix a compilation bug under ubuntu 16.04 (Xenial)
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
set(project_SOURCES main.cpp pclviewer.cpp)
add_executable(${PROJECT_NAME} ${project_SOURCES})
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES} Qt5::Widgets)
Hope it will help you.

Qt Creator Error: cannot find -lopencv_imgcodecs

I have installed opencv, qt, qt creator, cmake on ubuntu 15.10 through VMware on windows.
The opencv is installed in this directory: /home/majidalaeinia/opencv/
The project repository is cloned in this directory: /home/majidalaeinia/Desktop/imgwarp-opencv/
I want to run the project through its CMakeLists.txt in qt creator and when I press Build now on qt creator, I get the following errors:
error: cannot find -lopencv_imgcodecs
error: collect2: error: ld returned 1 exit status
Where is the problem and how can I solve it?
# Majid Alaeinia, from the CMakeLists.txt file you posted it is not specified how CMAKE should find the libraries requested from your project. Also there are no target_link_libraries declared so CMAKE does not know where to link them. Hopefully the following small example template should be helpful for your project:
cmake_minimum_required (VERSION 3.1)
project(yourProject)
find_package( OpenCV REQUIRED )
find_package( Qt5 REQUIRED COMPONENTS Sql )
### this is for c++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
### QT stuff if you want a GUI
set(CMAKE_AUTOMOC ON) # autogenerate qt gui features
set(CMAKE_AUTORCC ON) # used for QT resource Files (if you need)
## Additional operation...
# From here you are specifically linking all OpenCV libraries and executables
### Add executables
add_executable(yourExecutable main/main.cpp ui/res/res.qrc ${SRCS} ${UI_HDRS} ${UI_SRCS})
target_link_libraries (yourProject example Qt5::Widgets ${OpenCV_LIBS} Qt5::Sql)
### Add Library
add_library(yourProject_lib SHARED ${SRCS} ${UI_HDRS})
target_link_libraries (yourProject_lib example Qt5::Widgets ${OpenCV_LIBS})
# Majid Alaeinia,I uploaded the repository and went through the code. if you go inside the demo folder and you change the present CMakeLists.txt file with the one I provided below it should compile (It does compile on mine with the provided changes):
project(demo)
cmake_minimum_required(VERSION 2.6)
find_package(Qt5 REQUIRED COMPONENTS Widgets Core)
FIND_PACKAGE( OpenCV REQUIRED )
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR})
set(demo_SRCS main.cpp projfile.cpp deformwin.cpp myimage.cpp singlephotoview.cpp pointspaint.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#qt5_automoc(${demo_SRCS})
QT5_WRAP_CPP(QOBJ_CPP ${demo_SRCS})
qt5_wrap_ui(helloworld_FORMS_HEADERS deformwin.ui)
add_executable(demo ${demo_SRCS} ${helloworld_FORMS_HEADERS})
target_link_libraries(demo ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} imgwarp-lib opencv_core opencv_imgproc opencv_imgcodecs)
The code in the repository is an old code and still carries Qt4 as main wrappers. I think you probably have Qt5 installed on your computer and in fact the code I provided it will work for Qt5. Use it as a guideline for the other CMakeLists.txt file present inside src folder and change accordingly.
CMake will compile but because it was used Qt4 you need to figure out the most important modules to add, for example the new standard for including QtGui/QApplication is usually substituted by QtWidgets/QApplication
I also wanted to leave my previous answer in case you need a starting point or a initial template. I hope this clarifies a bit more and can get you move forward for your project.

Cross-compile with CMake: How to exclude default qt libraries and not to pass them to linker's command line

I want to cross-compile Qt planets demo applicatioin on Linux x64 with CMake for ARM.
I installed arm cross compiler. I've built Qt libs on ARM board and copied them to x64 Linux box's /lib/arm-linux-gnueabihf.
For qmake I did this with only adding few lines to planets.pro file:
PLATFORM = arm-linux-gnueabihf
QMAKE_CXX = /usr/bin/$$PLATFORM-g++
QMAKE_LINK = /usr/bin/$$PLATFORM-g++
QMAKE_LIBS = -L/usr/$$PLATFORM/lib -L/lib/$$PLATFORM
It compiles successfully and runs perfectly on ARM board.
Now, I want to do this with CMake. So, I created the following CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
set(PLATFORM arm-linux-gnueabihf)
set(CMAKE_CXX_COMPILER /usr/bin/${PLATFORM}-g++)
link_directories(/usr/${PLATFORM}/lib /lib/${PLATFORM})
file(GLOB_RECURSE HEADERS "*.hpp")
file(GLOB SOURCES "*.cpp")
set(CMAKE_AUTOMOC ON)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED)
add_executable(planets-qml ${SOURCES})
target_link_libraries(planets-qml
Qt5::Qml
Qt5::Quick
)
With this I have the following warning in Qt Creator's log:
Cannot generate a safe runtime search path for target planets-qml because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libGL.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/lib/arm-linux-gnueabihf
Then, I'm building it, and I got linker error:
/home/dev/Qt5.7.0/5.7/gcc_64/lib/libQt5Quick.so.5.7.0:
file not recognized: File format not recognized
I assume this happens because linker tries to link x64 Qt libraries to ARM binary.
But why can't it find libs from /lib/arm-linux-gnueabihf ?
I found the command to the linker in the file linker.txt:
/usr/bin/arm-linux-gnueabihf-g++
CMakeFiles/planets-qml.dir/main.cpp.o
CMakeFiles/planets-qml.dir/planets-qml_automoc.cpp.o
-o planets-qml
-L/usr/arm-linux-gnueabihf/lib -L/lib/arm-linux-gnueabihf
/home/dev/Qt5.7.0/5.7/gcc_64/lib/libQt5Quick.so.5.7.0
/home/dev/Qt5.7.0/5.7/gcc_64/lib/libQt5Qml.so.5.7.0
/home/dev/Qt5.7.0/5.7/gcc_64/lib/libQt5Network.so.5.7.0
/home/dev/Qt5.7.0/5.7/gcc_64/lib/libQt5Gui.so.5.7.0
/home/dev/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5.7.0
-Wl,-rpath,/usr/arm-linux-gnueabihf/lib:/lib/arm-linux-gnueabihf:/home/dev/Qt5.7.0/5.7/gcc_64/lib
So, the question is: How to exclude these /home/dev/Qt5... entries and not to pass them to the linker?
What CMake command should I use in CMakeLists.txt file?
Problem is that you are looking at the wrong QT directory.
You need to recompile Qt for ARM. Then set Qt5_DIR before find_package calls.
set(Qt5_DIR <path-to-Qt>/lib/cmake/Qt5/)
Your <path-to-Qt>/lib/cmake/Qt5/ should look like this:
$ ls <path-to-Qt>/lib/cmake/Qt5/
Qt5Config.cmake Qt5ConfigVersion.cmake

C++ CMAKE Predicate no such file

First of all, the error log:
-- Boost version: 1.59.0
-- Success!
-- Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version "2.6.3")
-- LOADING OS --Windows--
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Gianluca/.CLion2016.2/system/cmake/generated/mcdu-57fe38f9/57fe38f9/Debug
[ 1%] Automatic moc for target untitled
[ 1%] Built target untitled_automoc
[ 2%] Building CXX object CMakeFiles/untitled.dir/main.cpp.obj
[ 3%] Building CXX object CMakeFiles/untitled.dir/mainwindow.cpp.obj
[ 4%] Building CXX object CMakeFiles/untitled.dir/gldisplay.cpp.obj
[ 7%] Building CXX object CMakeFiles/untitled.dir/svg/svg.cpp.obj
[ 7%] Building CXX object CMakeFiles/untitled.dir/svg/svgfont.cpp.obj
[ 8%] Building CXX object CMakeFiles/untitled.dir/svg/svgstring.cpp.obj
[ 11%] Building CXX object CMakeFiles/untitled.dir/ht1000scriptmanager.cpp.obj
[ 11%] Building CXX object CMakeFiles/untitled.dir/ht1000widgetfactory.cpp.obj
CMakeFiles\untitled.dir\build.make:149: recipe for target 'CMakeFiles/untitled.dir/svg/svg.cpp.obj' failed
In file included from C:\Work\PolitecProductions\mcdu\svg\svg.cpp:1:0:
C:\Work\PolitecProductions\mcdu\svg\svg.h:14:48: fatal error: boost/algorithm/string/predicate.hpp: No such file or directory
#include <boost/algorithm/string/predicate.hpp>
^
compilation terminated.
In file included from C:\Work\PolitecProductions\mcdu\svg\svgstring.cpp:3:0:
C:\Work\PolitecProductions\mcdu\svg\./svg.h:14:48: fatal error: boost/algorithm/string/predicate.hpp: No such file or directory
#include <boost/algorithm/string/predicate.hpp>
^
compilation terminated.
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/svg/svg.cpp.obj] Error 1
mingw32-make.exe[2]: *** Waiting for unfinished jobs....
In file included from C:\Work\PolitecProductions\mcdu\svg\svgfont.cpp:2:0:
C:\Work\PolitecProductions\mcdu\svg\./svg.h:14:48: fatal error: boost/algorithm/string/predicate.hpp: No such file or directory
#include <boost/algorithm/string/predicate.hpp>
^
compilation terminated.
CMakeFiles\untitled.dir\build.make:199: recipe for target 'CMakeFiles/untitled.dir/svg/svgstring.cpp.obj' failed
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/svg/svgstring.cpp.obj] Error 1
CMakeFiles\untitled.dir\build.make:174: recipe for target 'CMakeFiles/untitled.dir/svg/svgfont.cpp.obj' failed
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/svg/svgfont.cpp.obj] Error 1
CMakeFiles\untitled.dir\build.make:249: recipe for target 'CMakeFiles/untitled.dir/ht1000widgetfactory.cpp.obj' failed
In file included from C:\Work\PolitecProductions\mcdu\ht1000widgetfactory.cpp:1:0:
C:\Work\PolitecProductions\mcdu\./ht1000widgetfactory.h:5:25: fatal error: QScriptEngine: No such file or directory
#include <QScriptEngine>
^
compilation terminated.
more http://pastebin.com/72ySYdVd
This is my actual CMakeLists
cmake_minimum_required(VERSION 3.6)
project(mcdu)
#### Boost Check Version
find_package(Boost REQUIRED)
if(Boost_FOUND)
message(STATUS "Success!")
endif()
#### Qt5
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Script REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(FREETYPE)
set(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::OpenGL Qt5::Core Qt5::Script)
set( CMAKE_AUTOMOC ON )
ADD_DEFINITIONS(${QT_DEFINITIONS})
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage ")
add_definitions("-std=c++11")
# Find includes in corresponding build directories
include_directories(
${BOOST}
${FREETYPE}
${Qt5Widgets_INCLUDE_DIRS}
-lopengl32 -lglu32 -luser32
)
if (WIN32)
message(STATUS "LOADING OS --Windows--")
include_directories(
${BOOST}/lib32-msvc-14.0 -libboost_timer-vc140-mt-gd-1_59 -libboost_log-vc140-mt-gd-1_59 -libboost_log_setup-vc140-mt-gd-1_59
${FREETYPE}/objs/vc2010/Win32/ -lfreetype263d
)
endif ()
#Source Files
set(SOURCE_FILES
src files. Cut to be short
#Header Files
set(HEADER_FILES
header files. Cut to be short
)
#Add Forms
QT5_WRAP_UI(FORM_FILES
.ui files
)
add_executable(untitled ${SOURCE_FILES} ${HEADER_FILES} ${FORM_FILES})
more http://pastebin.com/uGf3SHUn
So under svg.h the include is as it follows:
#include <boost/algorithm/string/predicate.hpp>
I've MSVC2015 and BOOST + FREETYPE env. variables are added to the system AND Clion. If I build that from QT I only get predicate.hpp error.
Here is the QT PRO file
QT += core gui script opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = mcdu
TEMPLATE = app
DEFINES += WIN
DEFINES += OGLFT_NO_SOLID
DEFINES += OGLFT_NO_QT
DEFINES += TEST
INCLUDEPATH += $$(BOOST)
INCLUDEPATH += $$(FREETYPE)/include
INCLUDEPATH += status
INCLUDEPATH += systems
INCLUDEPATH += svg
INCLUDEPATH += displays
CONFIG += debug
win32 {
DEFINES += WINDOWS
LIBS += -lopengl32 -lglu32 -luser32
LIBS += -L$$(BOOST)/lib32-msvc-14.0 -libboost_timer-vc140-mt-gd-1_59 -libboost_log-vc140-mt-gd-1_59 -libboost_log_setup-vc140-mt-gd-1_59
LIBS += -L$$(FREETYPE)/objs/vc2010/Win32/ -lfreetype263d
}
linux {
message("Build for Linux")
DEFINES += LINUX
DEFINES += BOOST_LOG_DYN_LINK
LIBS += -lGLU
LIBS += -lfreetype
LIBS += -L/home/RINF/rogosz/source/boost_1_59_0/stage/lib -lboost_timer -lboost_log -lboost_log_setup -lboost_system -lboost_thread -lboost_filesystem
}
SOURCES += src files: cut to be short
HEADERS += header files. cut to be short
FORMS += form files. cut to be short
find_package(Boost REQUIRED)
# ...
# Find includes in corresponding build directories
include_directories(
${BOOST}
${FREETYPE}
${Qt5Widgets_INCLUDE_DIRS}
-lopengl32 -lglu32 -luser32
)
The variable set by the find_package( Boost ... ), containing the path to the Boost header files, is named Boost_INCLUDE_DIRS, not BOOST.
And unless FREETYPE is breaking the pattern, that should be FREETYPE_INCLUDE_DIRS as well.
And what are the linker directives (-lopengl32 -lglu32 -luser32) doing in there?
if (WIN32)
message(STATUS "LOADING OS --Windows--")
include_directories(
${BOOST}/lib32-msvc-14.0 -libboost_timer-vc140-mt-gd-1_59 -libboost_log-vc140-mt-gd-1_59 -libboost_log_setup-vc140-mt-gd-1_59
${FREETYPE}/objs/vc2010/Win32/ -lfreetype263d
)
endif ()
I am quite confused. What is this even meant to achieve? You use the command include_directories(), but it looks as if you are trying to give linker instructions here? Adding link dependencies is done via target_link_libraries()...
And even if you would be using the correct command, you would not give linker instructions (-lfreetype263d), but list link targets, preferably those provided by the various find_package() calls, i.e. ${Boost_LIBRARIES} (not ${BOOST}), and ${FREETYPE_LIBRARIES} (not ${FREETYPE}).
Further:
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage ")
add_definitions("-std=c++11")
These are compiler-specific options that won't float your boat if you are working with Visual Studio. Use if ( MSVC ) and if ( CMAKE_COMPILER_IS_GNUCC ) to check what compiler you are working with.