8.1.2. CMake

8.1.2.1. Background

Your project is built using CMake.

8.1.2.2. What can be configured?

You can setup

  • analysis of your project by hooking into the generated build files (e.g., Makefiles, Ninja, or MSBuild files)

  • an Axivion toolchain to hook into the generation process for the build files

8.1.2.3. What needs to be done?

The usual setting of variables (CC=cafeCC CXX=cafeCC cmake -G "Unix Makefiles" ...) might work depending on the environment and the used generator.

On Windows with the “Visual Studio” generator, these will not work. Use generator “Ninja” (cmake -G "Ninja" ...) or generate the Visual Studio files (cmake -G "Visual Studio xx yyyy" ...) and use the MSBuild integration.

Remember to clean the generated build directory (or at least the file CMakeCache.txt) if you tinker with the environment variables to actually force CMake to respect those changes.

With CMake you can set parameters on the commandline via -D KEY=VALUE or in the CMakeLists.txt via set(KEY VALUE). You might be tempted to set the CMake variables CMAKE_C_COMPILER or CMAKE_CXX_COMPILER via the command line; this will not work in all setups as the default detection may overwrite these parameters. Even worse, CMake with the Visual Studio generator will not respect those variables in any case.

When using modern CMake (3.17 or later) with generators “Unix Makefiles” or “Ninja” you may want to use the axivion-launcher-toolchain.cmake toolchain file (this also works when using generator “Ninja” and MSVC toolchain):

Toolchain file for generators “Unix Makefiles”/”Ninja” and modern CMake (3.17 or later).
#  Copyright (C) 2025 Axivion GmbH
#  Copyright (C) 2025-2026 The Qt Company GmbH, a subsidiary of The Qt Group
#  https://www.qt.io
#
# ########################################################
#  Axivion Suite Compiler/Linker Launcher Toolchain File #
# ########################################################

cmake_minimum_required(VERSION 3.10)

message(STATUS "Using CMake version: ${CMAKE_VERSION}")

if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
  message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()

# If another toolchain file is required, use this one with CMAKE_TOOLCHAIN_FILE
# and chainload the original one with AXIVION_CHAINLOAD_TOOLCHAIN_FILE.
if(NOT "${AXIVION_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "")
  message(STATUS "Chainloading toolchain file: ${AXIVION_CHAINLOAD_TOOLCHAIN_FILE}")
  include("${AXIVION_CHAINLOAD_TOOLCHAIN_FILE}")
endif()

if("$ENV{BAUHAUS_CONFIG}" STREQUAL "")
  message("Warning: BAUHAUS_CONFIG unset ... expect failures due to missing compiler profile.")
endif()

if("$ENV{CAFECC_BASEPATH}" STREQUAL "")
  message("Warning: CAFECC_BASEPATH unset ... results will not be usable within axivion_ci later.")
endif()

if(${CMAKE_VERSION} VERSION_LESS "3.21")
  message("Warning: Consider upgrading to at least CMake 3.21 for better integration")
endif()

# Disable IR compression for CMake test compilations, so that CMake can
# properly reflect the IR files and search for the test strings there.
set(ENV{BAUHAUS_IR_COMPRESSION} none)

# When doing CMake configuration/generation, only create original files,
# no need for Axivion IR files at that stage.
set(ENV{COMPILE_ONLY} yes)

# Flag to remember whether the build_directory was created by the CMakeIntegration
# within axivion_ci or whether it was already existing before. This flag is used to
# differentiate the behavior in the clean phase: If the build_directory was created
# from within axivion_ci, then the whole directory is deleted, otherwise only
# "cmake ... --target clean" is called.
set(AXIVION_BUILD_DIRECTORY_CREATED_BY_AXIVION_CI FALSE CACHE BOOL "")

# Toolchain paths (Axivion tools are expected to be in PATH).
find_program(IR_CMAKE_LAUNCHER NAMES irCMAKELAUNCHER PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_CC             NAMES irCC            PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_CXX            NAMES irCXX           PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_NVCC           NAMES irNVCC          PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_AR             NAMES irAR            PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_LIBTOOL        NAMES irLIBTOOL       PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_RANLIB         NAMES irRANLIB        PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_LTO_RANLIB     NAMES irLTORANLIB     PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_MT             NAMES irMT            PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_OBJCOPY        NAMES irOBJCOPY       PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_OBJDUMP        NAMES irOBJDUMP       PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_STRIP          NAMES irSTRIP         PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_SIZE           NAMES irSIZE          PATHS ENV PATH NO_DEFAULT_PATH)

# Set executables settings.
set(CMAKE_C_COMPILER_LAUNCHER         "${IR_CMAKE_LAUNCHER}" CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER       "${IR_CMAKE_LAUNCHER}" CACHE FILEPATH "" FORCE)
# There does not exist a CMAKE_ASM_COMPILER_LAUNCHER as of CMake 3.25, so fall back ...
set(CMAKE_ASM_COMPILER                "${IR_CC}"             CACHE FILEPATH "" FORCE)
set(CMAKE_C_COMPILER_AR               "${IR_AR}"             CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER_AR             "${IR_AR}"             CACHE FILEPATH "" FORCE)
set(CMAKE_ASM_COMPILER_AR             "${IR_AR}"             CACHE FILEPATH "" FORCE)
set(CMAKE_AR                          "${IR_AR}"             CACHE FILEPATH "" FORCE)
set(CMAKE_C_COMPILER_RANLIB           "${IR_LTO_RANLIB}"     CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER_RANLIB         "${IR_LTO_RANLIB}"     CACHE FILEPATH "" FORCE)
set(CMAKE_ASM_COMPILER_RANLIB         "${IR_LTO_RANLIB}"     CACHE FILEPATH "" FORCE)
if(CMAKE_HOST_APPLE AND APPLE)
  set(CMAKE_LIBTOOL                   "${IR_LIBTOOL}"        CACHE FILEPATH "" FORCE)
endif()
set(CMAKE_RANLIB                      "${IR_RANLIB}"         CACHE FILEPATH "" FORCE)
set(CMAKE_MT                          "${IR_MT}"             CACHE FILEPATH "" FORCE)
set(CMAKE_OBJCOPY                     "${IR_OBJCOPY}"        CACHE FILEPATH "" FORCE)
set(CMAKE_OBJDUMP                     "${IR_OBJDUMP}"        CACHE FILEPATH "" FORCE)
set(CMAKE_STRIP                       "${IR_STRIP}"          CACHE FILEPATH "" FORCE)
set(CMAKE_SIZE                        "${IR_SIZE}"           CACHE FILEPATH "" FORCE)

if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
  set(CMAKE_C_LINKER_LAUNCHER         "${IR_CMAKE_LAUNCHER}" CACHE FILEPATH "" FORCE)
  set(CMAKE_CXX_LINKER_LAUNCHER       "${IR_CMAKE_LAUNCHER}" CACHE FILEPATH "" FORCE)
  set(CMAKE_CUDA_LINKER_LAUNCHER      "${IR_CMAKE_LAUNCHER}" CACHE FILEPATH "" FORCE)
else()
  message("Warning: CMAKE_<LANG>_LINKER_LAUNCHER not supported, you need CMake >= 3.21, using fallback ...")
  set(CMAKE_C_LINK_EXECUTABLE         "\"${IR_CC}\" <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
  set(CMAKE_C_CREATE_SHARED_LIBRARY   "\"${IR_CC}\" <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
  set(CMAKE_CXX_LINK_EXECUTABLE       "\"${IR_CXX}\" <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
  set(CMAKE_CXX_CREATE_SHARED_LIBRARY "\"${IR_CXX}\" <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
endif()

set(CMAKE_CUDA_COMPILER_LAUNCHER    "${IR_CMAKE_LAUNCHER}" CACHE FILEPATH "" FORCE)
set(CMAKE_CUDA_COMPILER_AR          "${IR_AR}"             CACHE FILEPATH "" FORCE)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.1")
  # As of CMake 4.1 axivion-cuda-linker-hook.cmake is no longer required as CMake now
  # properly supports CMAKE_CUDA_LINKER_LAUNCHER out of the box.
else()
  # For pure CUDA projects without C/C++ parts, CMake hard-codes
  # CMAKE_CUDA_HOST_LINK_LAUNCHER depending on nvcc verbose output in
  # cmake/Modules/CMakeDetermineCUDACompiler.cmake, so we have to fix that with a
  # CMake CMAKE_PROJECT_INCLUDE which is executed after the project() call.
  set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/axivion-cuda-linker-hook.cmake")
endif()

if("${CMAKE_GENERATOR}" MATCHES "^Ninja")
  if(NOT DEFINED AXIVION_JOB_POOL_SETUP)
    if(DEFINED AXIVION_NUM_JOBS_COMPILE)
      if(AXIVION_NUM_JOBS_COMPILE EQUAL 0)
        set(AXIVION_NUM_JOBS_COMPILE 1)
      endif()
      message(STATUS "Using ${AXIVION_NUM_JOBS_COMPILE} cores for parallel compilation (set via AXIVION_NUM_JOBS_COMPILE).")
      set_property(GLOBAL APPEND PROPERTY JOB_POOLS "comp=${AXIVION_NUM_JOBS_COMPILE}")
      set(CMAKE_JOB_POOL_COMPILE "comp")
    else()
      message(STATUS "Using default parallel compilation (override with AXIVION_NUM_JOBS_COMPILE).")
    endif()
    if(DEFINED AXIVION_NUM_JOBS_LINK)
      if(AXIVION_NUM_JOBS_LINK EQUAL 0)
        set(AXIVION_NUM_JOBS_LINK 1)
      endif()
      message(STATUS "Using ${AXIVION_NUM_JOBS_LINK} cores for parallel linking (set via AXIVION_NUM_JOBS_LINK).")
      set_property(GLOBAL APPEND PROPERTY JOB_POOLS "link=${AXIVION_NUM_JOBS_LINK}")
      set(CMAKE_JOB_POOL_LINK "link")
    else()
      message(STATUS "Using default parallel linking (override with AXIVION_NUM_JOBS_LINK).")
    endif()
    set(AXIVION_JOB_POOL_SETUP "1" CACHE INTERNAL "")
  endif()
endif()

# qt6_add_big_resources() as defined in Qt6CoreMacros.cmake will set up rules to
# create temporary object files and then having tool "rcc" read in those object files
# to create the final resource object files. This does not work as the temporary
# object files are IR files in an analysis setup and "rcc" does not understand IR files.
# As there is no CMake variable like CMAKE_RCC we cannot inject a wrapper, therefore
# we have to hook the find_package(Qt6Core) call and re-define qt6_add_big_resources()
# to no-op as we are not interested in big image data anyway (similarly we can also
# disable qt6_add_resources() although that would work out of the box).
variable_watch(Qt6Core_FOUND axivion_disable_qt6_resources)
function(axivion_disable_qt6_resources var access value)
   if (var STREQUAL "Qt6Core_FOUND" AND access STREQUAL "MODIFIED_ACCESS" AND value)
       function(qt6_add_big_resources)
           # Required override with no-op.
       endfunction()
       function(qt6_add_resources)
           # Optional override with no-op.
       endfunction()
    endif()
endfunction()

When using older CMake with generators “Unix Makefiles” or “Ninja” you may want to use the axivion-replacement-toolchain.cmake toolchain file:

Toolchain file for generators “Unix Makefiles”/”Ninja” and older CMake.
# Copyright (C) 2025 Axivion GmbH
# Copyright (C) 2025 The Qt Company GmbH, a subsidiary of The Qt Group
# https://www.qt.io

############################################################
# Axivion Suite Compiler/Linker Replacement Toolchain File #
############################################################

cmake_minimum_required(VERSION 3.0)

message(STATUS "Using CMake version: ${CMAKE_VERSION}")

if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
  message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()

# If another toolchain file is required, use this one with CMAKE_TOOLCHAIN_FILE
# and chainload the original one with AXIVION_CHAINLOAD_TOOLCHAIN_FILE.
if(NOT "${AXIVION_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "")
  message(STATUS "Chainloading toolchain file: ${AXIVION_CHAINLOAD_TOOLCHAIN_FILE}")
  include("${AXIVION_CHAINLOAD_TOOLCHAIN_FILE}")
endif()

if("$ENV{BAUHAUS_CONFIG}" STREQUAL "")
  message("Warning: BAUHAUS_CONFIG unset ... expect failures due to missing compiler profile.")
endif()

if("$ENV{CAFECC_BASEPATH}" STREQUAL "")
  message("Warning: CAFECC_BASEPATH unset ... results will not be usable within axivion_ci later.")
endif()

if(${CMAKE_VERSION} VERSION_LESS "3.21")
  message("Warning: Consider upgrading to at least CMake 3.21 for better integration")
else()
  message("Warning: Your CMake is new enough, you might consider switching to axivion-launcher-toolchain.cmake")
endif()

# Set target system.
#set(CMAKE_SYSTEM_NAME Generic)
#set(CMAKE_SYSTEM_PROCESSOR x86_64)
#set(CMAKE_SYSTEM_VERSION 1)

# Disable IR compression for CMake test compilations, so that CMake can
# properly reflect the IR files and search for the test strings there.
set(ENV{BAUHAUS_IR_COMPRESSION} none)

# When doing CMake configuration/generation, only create original files,
# no need for Axivion IR files at that stage.
set(ENV{COMPILE_ONLY} yes)

# Flag to remember whether the build_directory was created by the CMakeIntegration
# within axivion_ci or whether it was already existing before. This flag is used to
# differentiate the behavior in the clean phase: If the build_directory was created
# from within axivion_ci, then the whole directory is deleted, otherwise only
# "cmake ... --target clean" is called.
set(AXIVION_BUILD_DIRECTORY_CREATED_BY_AXIVION_CI FALSE CACHE BOOL "")

# Toolchain paths (Axivion tools are expected to be in PATH).
find_program(IR_CC              NAMES irCC             PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_CXX             NAMES irCXX            PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_NVCC            NAMES irNVCC           PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_AR              NAMES irAR             PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_LIBTOOL         NAMES irLIBTOOL        PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_RANLIB          NAMES irRANLIB         PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_LTO_RANLIB      NAMES irLTORANLIB      PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_MT              NAMES irMT             PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_OBJCOPY         NAMES irOBJCOPY        PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_OBJDUMP         NAMES irOBJDUMP        PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_STRIP           NAMES irSTRIP          PATHS ENV PATH NO_DEFAULT_PATH)
find_program(IR_SIZE            NAMES irSIZE           PATHS ENV PATH NO_DEFAULT_PATH)

# Set executables settings.
set(CMAKE_C_COMPILER       "${IR_CC}"         CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER     "${IR_CXX}"        CACHE FILEPATH "" FORCE)
set(CMAKE_ASM_COMPILER     "${IR_CC}"         CACHE FILEPATH "" FORCE)
set(CMAKE_C_COMPILER_AR    "${IR_AR}"         CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER_AR  "${IR_AR}"         CACHE FILEPATH "" FORCE)
set(CMAKE_ASM_COMPILER_AR  "${IR_AR}"         CACHE FILEPATH "" FORCE)
set(CMAKE_AR               "${IR_AR}"         CACHE FILEPATH "" FORCE)
if(${CMAKE_VERSION} VERSION_GREATER "3.8.99")
  set(CMAKE_C_COMPILER_RANLIB   "${IR_LTO_RANLIB}" CACHE FILEPATH "" FORCE)
  set(CMAKE_CXX_COMPILER_RANLIB "${IR_LTO_RANLIB}" CACHE FILEPATH "" FORCE)
  set(CMAKE_ASM_COMPILER_RANLIB "${IR_LTO_RANLIB}" CACHE FILEPATH "" FORCE)
  set(CMAKE_RANLIB              "${IR_RANLIB}"         CACHE FILEPATH "" FORCE)
endif()
if(CMAKE_HOST_APPLE AND APPLE)
  set(CMAKE_LIBTOOL        "${IR_LIBTOOL}"     CACHE FILEPATH "" FORCE)
endif()
set(CMAKE_LINKER           "${IR_CXX}"        CACHE FILEPATH "" FORCE)
set(CMAKE_MT               "${IR_MT}"         CACHE FILEPATH "" FORCE)
set(CMAKE_OBJCOPY          "${IR_OBJCOPY}"    CACHE FILEPATH "" FORCE)
set(CMAKE_OBJDUMP          "${IR_OBJDUMP}"    CACHE FILEPATH "" FORCE)
set(CMAKE_STRIP            "${IR_STRIP}"      CACHE FILEPATH "" FORCE)
set(CMAKE_SIZE             "${IR_SIZE}"       CACHE FILEPATH "" FORCE)

if(${CMAKE_VERSION} VERSION_GREATER "3.9.99")
  set(CMAKE_CUDA_COMPILER    "${IR_NVCC}"       CACHE FILEPATH "" FORCE)
  set(CMAKE_CUDA_COMPILER_AR "${IR_AR}"             CACHE FILEPATH "" FORCE)
else()
  message("Warning: If you need CUDA support, you need CMake 3.10 or higher.")
endif()

# Force endianness, if required.
# Cannot be auto-detected because IR does not have string "INFO:byte_order[]" inside.
#set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
#set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN")

# ATTENTION: Only modify settings below if auto-detection of CMake fails
# and you need to forcefully overwrite settings.

# Disable Compiler checks.
#set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # test archiver instead of linker
#set(CMAKE_CROSSCOMPILING      TRUE CACHE INTERNAL "" FORCE)
#set(CMAKE_C_COMPILER_WORKS    TRUE CACHE INTERNAL "" FORCE)
#set(CMAKE_CXX_COMPILER_WORKS  TRUE CACHE INTERNAL "" FORCE)
#set(CMAKE_C_COMPILER_FORCED   TRUE CACHE INTERNAL "" FORCE)
#set(CMAKE_CXX_COMPILER_FORCED TRUE CACHE INTERNAL "" FORCE)
#set(CMAKE_C_COMPILER_ID_RUN   TRUE CACHE INTERNAL "" FORCE)
#set(CMAKE_CXX_COMPILER_ID_RUN TRUE CACHE INTERNAL "" FORCE)

# Force Compiler ID to "GNU".
#set(CMAKE_C_COMPILER_ID        "GNU"    CACHE STRING "CMAKE_C_COMPILER_ID"        FORCE)
#set(CMAKE_CXX_COMPILER_ID      "GNU"    CACHE STRING "CMAKE_CXX_COMPILER_ID"      FORCE)
#set(CMAKE_C_COMPILER_VERSION   "10.2.1" CACHE STRING "CMAKE_C_COMPILER_VERSION"   FORCE)
#set(CMAKE_CXX_COMPILER_VERSION "10.2.1" CACHE STRING "CMAKE_CXX_COMPILER_VERSION" FORCE)

# Force Compiler ID to "MSVC".
#set(CMAKE_C_COMPILER_ID        "MSVC"          CACHE STRING "CMAKE_C_COMPILER_ID"        FORCE)
#set(CMAKE_CXX_COMPILER_ID      "MSVC"          CACHE STRING "CMAKE_CXX_COMPILER_ID"      FORCE)
#set(CMAKE_C_COMPILER_VERSION   "19.29.30133.0" CACHE STRING "CMAKE_C_COMPILER_VERSION"   FORCE)
#set(CMAKE_CXX_COMPILER_VERSION "19.29.30133.0" CACHE STRING "CMAKE_CXX_COMPILER_VERSION" FORCE)

# Force Compiler ID to "IAR ARM".
#set(CMAKE_C_COMPILER_ID                 "IAR"    CACHE STRING "CMAKE_C_COMPILER_ID"                 FORCE)
#set(CMAKE_CXX_COMPILER_ID               "IAR"    CACHE STRING "CMAKE_CXX_COMPILER_ID"               FORCE)
#set(CMAKE_C_COMPILER_VERSION            "8.22.1" CACHE STRING "CMAKE_C_COMPILER_VERSION"            FORCE)
#set(CMAKE_CXX_COMPILER_VERSION          "8.22.1" CACHE STRING "CMAKE_CXX_COMPILER_VERSION"          FORCE)
#set(CMAKE_C_COMPILER_ARCHITECTURE_ID    "ARM"    CACHE STRING "CMAKE_C_COMPILER_ARCHITECTURE_ID"    FORCE)
#set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID  "ARM"    CACHE STRING "CMAKE_CXX_COMPILER_ARCHITECTURE_ID"  FORCE)
#set(CMAKE_C_COMPILER_VERSION_INTERNAL   "8.22.1" CACHE STRING "CMAKE_C_COMPILER_VERSION_INTERNAL"   FORCE)
#set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "8.22.1" CACHE STRING "CMAKE_CXX_COMPILER_VERSION_INTERNAL" FORCE)

# Force language standard.
#set(CMAKE_C_STANDARD_COMPUTED_DEFAULT 99)
#set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT 17)

# Overwrite archiver commands in case cafeAR expects different arguments.
#set(CMAKE_C_ARCHIVE_CREATE          "<CMAKE_AR> cr <TARGET> <OBJECTS>" CACHE STRING "" FORCE)
#set(CMAKE_CXX_ARCHIVE_CREATE        "<CMAKE_AR> cr <TARGET> <OBJECTS>" CACHE STRING "" FORCE)
#set(CMAKE_C_CREATE_STATIC_LIBRARY   "<CMAKE_AR> cr <TARGET> <OBJECTS>" CACHE STRING "" FORCE)
#set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> cr <TARGET> <OBJECTS>" CACHE STRING "" FORCE)

# Overwrite linker commands in case the default one does not fit.
#set(CMAKE_C_LINK_EXECUTABLE         "${IR_CC} <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
#set(CMAKE_C_CREATE_SHARED_LIBRARY   "${IR_CC} <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
#set(CMAKE_CXX_LINK_EXECUTABLE       "${IR_CXX} <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "" FORCE)
#set(CMAKE_CXX_CREATE_SHARED_LIBRARY "${IR_CXX} <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" CACHE STRING "" FORCE)

With environment variable COMPILE_ONLY=1 you can control to only invoke the native compiler of the project and not execute the Axivion compiler at all. With environment variable COMPILE_ONLYIR=1 you can configure to only invoke the Axivion compiler instead of the original compiler of the project. When none of the two environment variables are set, then both are executed, the native compiler and the Axivion compiler. If you set both variables, then COMPILE_ONLY=1 takes precedence and no Axivion IR files are being generated.

8.1.2.4. Usage of Resources and Big Resources

When setting COMPILE_ONLYIR=1 in build_environment (which is the default) and therefore only building IR, then resources are silently skipped and omitted completely from the IR.

When you remove COMPILE_ONLYIR=1 and thus also want to compile with the native compiler in addition to the Axivion compiler, this may not work. When you use Q_INIT_RESOURCE() in your code this creates a symbol reference to the resource files which the linker cannot resolve. Therefore, when using resources and wanting to compile native objects and Axivion IR, you have to remove the last 20 lines from the file profiles/cmake/axivion-launcher-toolchain.cmake

Note however, that this does not work for “big resources”. Currently it is not supported to build native objects and Axivion IR with CMake when using “big resources”!