Using CMAKE_ROLE to detect CMake run mode

The operating mode of CMake can be detected via CMAKE_ROLE. This variable must be read with:

get_property(cmake_role GLOBAL PROPERTY CMAKE_ROLE)

Here, the variables cmake_role is created and can then be used in if() statements as needed.