C

Qt Quick Ultralite Automotive Cluster Demo

#######################################################################
# The Embedded Template Library (https://www.etlcpp.com/)
#######################################################################

#######################################################################
# Define an option to allow consumers of the library to
# specify the profile they would like to compile to.  If
# not explicitly set CMake will attempt to choose an appropriate
# profile based on the compiler
#######################################################################
set(ETL_PROFILE "DEFAULT" CACHE STRING "Defines what profile header to include.  See https://www.etlcpp.com/setup.html"
)

add_library(automotive_etl INTERFACE)

target_include_directories(automotive_etl
  INTERFACE
  $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
  $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/etl/profiles>
  )

if (${ETL_PROFILE} STREQUAL DEFAULT)
  # Fallback: if compiler id is empty, use executable name
  if(CMAKE_CXX_COMPILER_ID STREQUAL "")
    get_filename_component(CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER} NAME_WE)
  endif()

  if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
    set(ETL_PROFILE "PROFILE_GCC_GENERIC")

  elseif (CMAKE_CXX_COMPILER_ID MATCHES "IAR")
    set(ETL_PROFILE "PROFILE_GCC_GENERIC")

  elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
    set(ETL_PROFILE "PROFILE_MSVC")

  elseif (CMAKE_CXX_COMPILER_ID MATCHES "ARMCC")
    if (CXX_STANDARD EQUAL 11)
      set(ETL_PROFILE "PROFILE_ARMV6")
    else ()
      set(ETL_PROFILE "PROFILE_ARMV5")
    endif()

  elseif (CMAKE_CXX_COMPILER_ID MATCHES "TI")
    set(ETL_PROFILE "PROFILE_TICC")

  elseif (CMAKE_CXX_COMPILER_ID MATCHES "cxv850" OR CMAKE_CXX_COMPILER_ID MATCHES "GHS")
    set(ETL_PROFILE "PROFILE_GHS_V850")

  elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE)
    set(ETL_PROFILE "PROFILE_GCC_GENERIC")
  elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND APPLE)
    set(ETL_PROFILE "PROFILE_CLANG_MACOS")

  else()
    message(FATAL_ERROR "Can't generate default profile for compiler: ${CMAKE_CXX_COMPILER_ID}")
  endif()
endif()

message(STATUS "Compiling with ETL profile set to: ${ETL_PROFILE}")

target_compile_definitions(automotive_etl
  INTERFACE
  ${ETL_PROFILE}
  ETL_NO_PROFILE_HEADER
  )