Source code adaptation for Cortex core MCUs is done in CMSIS standard by its CMSIS-way source code organization.
CMSIS standard adaptation to current MCU model is done by <device.h> system_<device>.c and system_<device>.h files.
This project also suggest a new <bsp_board_def.h> file for Board source code adaptation. Also there is backward compatibility to CMSIS standard if you do not have BSP file.
It is necessary to do automatic generation of some header source files. Also it is necessary to configure some command line compiler switches and definitions. CMAKE and CMAKE rules written on specific Lisp-like language do this automatic generation functions.
Adjusting a some project to specific micro-controller and board is made by running CMAKE utility with three commandline parameters.