Skip to content

What is the most appropriate setting for CMAKE_FIND_ROOT_PATH_MODE? #1695

@Dirreke

Description

@Dirreke

In toolchain.cmake, we have already set the following flags for cross-compilation :

  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

However, these settings have led to a series of issues, as discussed in: #1291 , #1270 , #1180 . In particular, problems can arise when an absolute path is provided to functions like find_library. With the current settings, find_library does not search the actual absolute path as expected, but instead looks under ${CMAKE_FIND_ROOT_PATH}/${MBEDTLS_FOLDER_LIBRARY}, which causes failures to locate the required libraries—even if the correct path is given.

Given the issues above, I would like to discuss what is the most appropriate way to configure these CMAKE_FIND_ROOT_PATH_MODE_* flags for cross-compilation scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cmakeArea: Cmake compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions