function(default_build_type val) if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "No build type selected, default to Release") set(CMAKE_BUILD_TYPE ${val} CACHE STRING "Build type (default ${val})" FORCE) endif() endfunction()