1# 2# Automatically generated file; DO NOT EDIT. 3# CMake toolchain file for Buildroot 4# 5 6# In order to allow the toolchain to be relocated, we calculate the 7# HOST_DIR based on this file's location: $(HOST_DIR)/share/buildroot 8# and store it in RELOCATED_HOST_DIR. 9# All the other variables that need to refer to HOST_DIR will use the 10# RELOCATED_HOST_DIR variable. 11string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR}) 12 13# Point cmake to the location where we have our custom modules, 14# so that it can find our custom platform description. 15list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) 16 17if(NOT DEFINED CMAKE_SYSTEM_NAME) 18 set(CMAKE_SYSTEM_NAME Buildroot) 19endif() 20if(NOT DEFINED CMAKE_SYSTEM_VERSION) 21 set(CMAKE_SYSTEM_VERSION 1) 22endif() 23if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR) 24 set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@) 25endif() 26 27# Set the {C,CXX}FLAGS appended by CMake depending on the build type 28# defined by Buildroot. CMake defaults these variables with -g and/or 29# -O options, and they are appended at the end of the argument list, 30# so the Buildroot options are overridden. Therefore these variables 31# have to be cleared, so that the options passed in CMAKE_C_FLAGS do 32# apply. 33# 34# Note: 35# if the project forces some of these flag variables, Buildroot is 36# screwed up and there is nothing Buildroot can do about that :( 37if(NOT DEFINED CMAKE_C_FLAGS_DEBUG) 38 set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS") 39endif() 40if(NOT DEFINED CMAKE_C_FLAGS_RELEASE) 41 set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS") 42endif() 43 44# Build type from the Buildroot configuration 45if(NOT DEFINED CMAKE_BUILD_TYPE) 46 set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration") 47endif() 48 49# Buildroot defaults flags. 50# If you are using this toolchainfile.cmake file outside of Buildroot and 51# want to customize the compiler/linker flags, then: 52# * set them all on the cmake command line, e.g.: 53# cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ... 54# * and make sure the project's CMake code extends them like this if needed: 55# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_definitions") 56if(NOT DEFINED CMAKE_C_FLAGS) 57 set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS") 58endif() 59if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS) 60 set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables") 61endif() 62if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS) 63 set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries") 64endif() 65if(NOT DEFINED CMAKE_MODULE_LINKER_FLAGS) 66 set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries") 67endif() 68 69if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 70 set(CMAKE_INSTALL_SO_NO_EXE 0) 71endif() 72 73if(NOT DEFINED CMAKE_PROGRAM_PATH) 74 set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin") 75endif() 76if(NOT DEFINED CMAKE_SYSROOT) 77 set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") 78endif() 79if(NOT DEFINED CMAKE_FIND_ROOT_PATH) 80 set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") 81endif() 82if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) 83 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 84endif() 85if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) 86 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 87endif() 88if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) 89 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 90endif() 91if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) 92 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 93endif() 94set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") 95 96# This toolchain file can be used both inside and outside Buildroot. 97if(NOT DEFINED CMAKE_C_COMPILER) 98 set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@") 99endif() 100if(@@TOOLCHAIN_HAS_CXX@@) 101 if(NOT DEFINED CMAKE_CXX_FLAGS_DEBUG) 102 set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS") 103 endif() 104 if(NOT DEFINED CMAKE_CXX_FLAGS_RELEASE) 105 set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS") 106 endif() 107 if(NOT DEFINED CMAKE_CXX_FLAGS) 108 set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS") 109 endif() 110 if(NOT DEFINED CMAKE_CXX_COMPILER) 111 set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@") 112 endif() 113endif() 114if(@@TOOLCHAIN_HAS_FORTRAN@@) 115 if(NOT DEFINED CMAKE_Fortran_FLAGS_DEBUG) 116 set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS") 117 endif() 118 if(NOT DEFINED CMAKE_Fortran_FLAGS_RELEASE) 119 set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS") 120 endif() 121 if(NOT DEFINED CMAKE_Fortran_FLAGS) 122 set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS") 123 endif() 124 if(NOT DEFINED CMAKE_Fortran_COMPILER) 125 set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@") 126 endif() 127endif() 128 129# For Qt6 130if(NOT DEFINED QT_HOST_PATH) 131 set(QT_HOST_PATH "${RELOCATED_HOST_DIR}") 132endif() 133 134if(NOT DEFINED QT_HOST_PATH_CMAKE_DIR) 135 set(QT_HOST_PATH_CMAKE_DIR "${RELOCATED_HOST_DIR}/lib/cmake") 136endif() 137