I am starting to work with CMake and have a problem creating a Qt application package for MacOS X. Let's look at the application of the simple helloworld widget in only one file main.cpp.
#include <QApplication>
#include <QLabel>
int main(int argc, char** argv)
{
QApplication app(argc,argv);
QLabel lbl("Hello");
lbl.show();
return app.exec();
}
The file is CMakeLists.txtalso simple.
cmake_minimum_required( VERSION 3.0 )
project( QtBundle )
set( CMAKE_INCLUDE_CURRENT_DIR ON )
set( CMAKE_AUTOMOC ON )
set( SOURCES main.cpp )
find_package( Qt5Widgets REQUIRED )
add_executable( ${PROJECT_NAME} MACOSX_BUNDLE ${SOURCES} )
qt5_use_modules( ${PROJECT_NAME} Widgets )
I run cmake .. -DCMAKE_PREFIX_PATH=/path/to/Qt5.5.1/and generate Makefilein a directory build.
Then I started makeand had the directory QtBundle.appas I wanted, and the QtBundle.app/Contents/MacOS/QtBundleexecutable, OK.
But when I run it, I get:
This application failed to start because it could not find or load the Qt platform plugin "cocoa".
Reinstalling the application may fix this problem.
Abort trap: 6
, - , - Qt (Framework libs ), macdeployqt Framework PlugIns .
, CMake BundleUtilities macdeployqt.
, Qt5 BundleUtilities.
- "helloworld" , CMake ?
.
: CMake BundleUtilities ?