I have a CMake project for a Qt based application using plugins. The standard way to create a plugin is CMake (on all platforms) is with: ADD_LIBRARY(${PROJECT_NAME} MODULE ...) This creates a libxxx.so plugin (instead of a libxxx.dylib, if SHARED is used instead of MODULE above). Now, when running inside an IDE like Xcode or QtCreator, the application works fine, the plugin开发者_开发百科 is loaded and works. But if I create the .app bundle, the application does not start, saying "libxxx.so is not a valid Qt plugin"! How could be that possible? Maybe some library dependency is not found, but how can i check that? I have used tool -L and I think all the libraries are ok.
You may need a "qt.conf" file in your bundle to tell Qt where the plugins are.
You should read up on CMake's BundleUtilities fixup_bundle function and let it do all that "otool -L" and "install_name_tool" stuff for you.
See this recent related stackoverflow question and answer:
CMake: Copy Frameworks into App Bundle
精彩评论