I use CMake to build Mac application using wxWidgets 3.1.3.
I'm using standard wxMenu
to create menu, it works well on Windows and Linux but on MacOS after start the application the menu is disabled until change focus to another application and back.
Any ideas what I'm doing wrong?
Code:
wxMenu* menuFile = new wxMenu;
wxMenu* menuHelp= new wxMenu;
// fill the menus ...
wxMenuBar* menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");
menuBar->Append(menuHelp, "&Help");
SetMenuBar(menuBar);
MaxOS bundle should be set in CMakeLists.txt script:
if(APPLE)
set_target_properties(app-target PROPERTIES
MACOSX_BUNDLE TRUE
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" # to disable code sign
)
endif()
Now MacOS application will be created (.app) instead of just an executable.
This also solves problem with appearing console when launching from Finder.