cmake and high-dpi support on Mac

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

cmake and high-dpi support on Mac

René J. V.  Bertin

CMake had hardcoded default support for high-dpi screens in the applications it generated for Apple's desktop OS at some point, but that was removed very quickly in 286c75f7f034c5fdcd43bcb755da74d09c809642.

It is my understanding that you don't actually need to set the high-dpi key explicitly, but that it defaults to on for the desktop OS. IOW, it's enough to set the NSPrincipalClass property to NSApplication.

I cannot check this myself, and I have no idea if and how NSPrincipalClass can be set for Apple's other OS variants.
But maybe one could use this property in a minimal-change change to enable high-dpi support automatically in applications that do not provide their own Info.plist: add this to the bundle plist template:

+ <key>NSPrincipalClass</key>

If the target OS is known when the MACOSX_BUNDLE_* variables get their default, MACOSX_BUNDLE_PRINCIPALCLASS could default to whatever class is appropriate for the target OS, otherwise it would just be set to NSApplication (and users targetting other OS variants would have to set the property explicitly, which is still less cumbersome than providing a custom template).

Thoughts please?


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: