toolchainfile.cmake.in 5.0 KB

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