set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")

# Add separately include directories if we are to lazy to specify e.g. "#include <protocol/rbc_mesh.h>"
# We have removed include/third/nrf from here. This needs to be specified separately for the firmware versus the
# bootloader. Both need namely a different sdk_config.h file...
include_directories("include")
include_directories("include/ble")
include_directories("include/third")
include_directories("shared")

message(STATUS "NRF5_DIR: ${NRF5_DIR}")

include_directories(SYSTEM "${NRF5_DIR}")
include_directories(SYSTEM "${NRF5_DIR}/components/toolchain/cmsis/include")
include_directories(SYSTEM "${NRF5_DIR}/config")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/fstorage")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/experimental_section_vars")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/queue")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/util")
include_directories(SYSTEM "${NRF5_DIR}/components/ble/ble_db_discovery")
include_directories(SYSTEM "${NRF5_DIR}/components/ble/nrf_ble_gq")

include_directories(SYSTEM "${NRF5_DIR}/components/ble/ble_services")
include_directories(SYSTEM "${NRF5_DIR}/components/ble/common")
include_directories(SYSTEM "${NRF5_DIR}/components/device/")
include_directories(SYSTEM "${NRF5_DIR}/components/drivers_nrf/common/")
include_directories(SYSTEM "${NRF5_DIR}/components/drivers_nrf/comp/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/atomic/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/atomic_fifo/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/balloc/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/crc16/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/crc32/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/delay/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/experimental_log/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/experimental_log/src/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/experimental_memobj/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/experimental_section_vars/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/fds/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/fstorage/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/hardfault/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/log/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/log/src/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/memobj/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/ringbuf/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/scheduler/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/strerror/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/timer/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/trace/")
include_directories(SYSTEM "${NRF5_DIR}/components/libraries/util/")
include_directories(SYSTEM "${NRF5_DIR}/components/softdevice/common/")
include_directories(SYSTEM "${NRF5_DIR}/components/softdevice/common/softdevice_handler/")
include_directories(SYSTEM "${NRF5_DIR}/components/softdevice/s${SOFTDEVICE_SERIES}/headers")
include_directories(SYSTEM "${NRF5_DIR}/components/toolchain/")
include_directories(SYSTEM "${NRF5_DIR}/components/toolchain/cmsis/include")
include_directories(SYSTEM "${NRF5_DIR}/components/toolchain/gcc/")
include_directories(SYSTEM "${NRF5_DIR}/external/fprintf/")
include_directories(SYSTEM "${NRF5_DIR}/integration/nrfx/")
include_directories(SYSTEM "${NRF5_DIR}/modules/nrfx/")
include_directories(SYSTEM "${NRF5_DIR}/modules/nrfx/drivers/include/")
include_directories(SYSTEM "${NRF5_DIR}/modules/nrfx/hal/")
include_directories(SYSTEM "${NRF5_DIR}/modules/nrfx/mdk/")
include_directories(SYSTEM "${NRF5_DIR}/external/segger_rtt")
include_directories(SYSTEM "${NRF5_DIR}/integration/nrfx/legacy/")

include_directories(SYSTEM "${NRF5_DIR}/components/softdevice/s132/headers/nrf52")

if(BUILD_MESHING)
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/stack/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/prov/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/prov/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/access/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/access/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/dfu/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/dfu/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/core/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/core/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/bearer/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/bearer/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/gatt/api")
	include_directories(SYSTEM "${MESH_SDK_DIR}/mesh/gatt/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/models/foundation/config/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/models/foundation/health/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/models/model_spec/common/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/models/model_spec/generic_onoff/include")
	include_directories(SYSTEM "${MESH_SDK_DIR}/external/micro-ecc")
	include_directories(SYSTEM "${MESH_SDK_DIR}/examples/common/include")
	if(MESH_MEM_BACKEND STREQUAL "mem_manager")
		include_directories(SYSTEM "${NRF5_DIR}/components/libraries/mem_manager")
	endif()
endif() # BUILD_MESHING

list(APPEND NORDIC_SOURCE "${NRF5_DIR}/components/libraries/util/app_util_platform.c")
