-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Minimal CMake
By :
When looking at macOS in The CPack macOS bundle package section earlier, we used the CPack generator Bundle type to package our application’s build artifacts in a macOS bundle. There is, however, an interesting alternative that is worth briefly mentioning.
CMake provides an option to directly build an application as a macOS bundle. The setting is called MACOSX_BUNDLE, and it can be passed directly to add_executable or set separately with set_target_properties, as shown here:
set_target_properties(
${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE) The effect of this is to produce a file called Minimal CMake - Game of Life.app in the build/<preset>/<config> folder, instead of the executable file and collection of loose files, including libraries and resources, that we’ve seen so far. The truth is that the .app file is just a folder holding all these files; the only difference is that it’s presented in a slightly...