[CMake] qt+cmake != qt+qmake on mac os x

Craig Scott craig.scott at crascit.com
Sun May 8 16:20:23 EDT 2016


Add the MACOSX_BUNDLE keyword to your add_executable() command. See the CMake
docs <https://cmake.org/cmake/help/latest/command/add_executable.html> for
details.

On Mon, May 9, 2016 at 12:33 AM, Evgeniy Dushistov <dushistov at gmail.com>
wrote:

> Hi,
>
> I created simple hello world with qt5 (5.6) using  cmake 3.5.2:
>
> set(test_app_UIS mainwin.ui)
> set(test_app_MOC_HDRS mainwin.hpp)
> qt5_wrap_ui(test_app_UIS_H ${test_app_UIS})
> qt5_wrap_cpp(test_app_MOC_SRCS ${test_app_MOC_HDRS})
> add_executable(test_app ${test_app_UIS_H} ${test_app_MOC_SRCS}
> ${test_app_MOC_HDRS} mainwin.cpp main.cpp)
> target_link_libraries(test_app Qt5::Widgets)
>
> it builds and I  can run it, but there is strange bug:
>
> after start I can not access menu, but if I give focus to another
> application,
> and then return back to test_app it is possible to open menu.
>
> I build the same application with qmake and bug disappear.
>
> the difference was how qmake and cmake place executables inside build
> directory:
>
> qmake put binary inside test_app.app directory, with content like:
> Info.plist MacOS PkgInfo Resources
>
> cmake put binary in the same way as on linux - just binary test_app
>
> So, to work with cmake + qt on mac I have write some special cmake
> with pre_build hook to generate suitable structure? Or there is more
> convenient way to resolve this problem?
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Craig Scott
Melbourne, Australia
http://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160509/3325eb34/attachment.html>


More information about the CMake mailing list