CMaize Initialization
The point of this page is to describe what happens when CMaize is initialized.
Initialization Sequence
CMaize initialization is triggered by the user including the top-level CMake
module, cmaize/cmaize.cmake via include(cmaize/cmaize).
Load
cmaize_impl.cmake. This entails:An early exit if
cmaize_impl.cmakehas already been loaded.Asserting the user is using a build directory.
Defining CMaize global configuration options
Bringing the CMaize classes, user API, and utility functions into scope.
Create a
CMaizeProjectfor the most recent call to CMake’sprojectcommand.The name of the project is read from
${PROJECT_NAME}
Set global rpath options including:
CMAKE_SKIP_BUILD_RPATH,CMAKE_BUILD_WITH_INSTALL_RPATH,CMAKE_INSTALL_RPATH_USE_LINK_PATH, andCMAKE_INSTALL_RPATH.
Other Notes
Initialization may end up happening many times. For example, if a project’s dependencies also use CMaize, CMaize may be loaded multiple times.
As a corollary of the previous point, CMaize’s initialization should be kept short to avoid adding too much runtime overhead.
Not using a build directory will cause CMake to contaminate the source code of the project. Of particular note CMakePPLang will contaminate the source code with auto generated class bindings.