1# SPDX-License-Identifier: Apache-2.0 2# 3# Copyright (c) 2022, Nordic Semiconductor ASA 4 5find_program(SPARSE_COMPILER cgcc REQUIRED) 6message(STATUS "Found sparse: ${SPARSE_COMPILER}") 7 8# Create sparse.cmake which will be called as compiler launcher. 9# sparse.cmake will ensure that REAL_CC is set correctly in environment before 10# cgcc is called, thereby ensuring correct behavior of sparse without a need 11# for REAL_CC to be set in environment. 12configure_file(${CMAKE_CURRENT_LIST_DIR}/sparse.template ${CMAKE_BINARY_DIR}/sparse.cmake @ONLY) 13 14set(launch_environment ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/sparse.cmake --) 15set(CMAKE_C_COMPILER_LAUNCHER ${launch_environment} CACHE INTERNAL "") 16 17list(APPEND TOOLCHAIN_C_FLAGS -D__CHECKER__) 18# Avoid compiler "attribute directive ignored" warnings 19list(APPEND TOOLCHAIN_C_FLAGS -Wno-attributes) 20