summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEneas U de Queiroz2025-06-20 13:18:58 +0000
committerChristian Marangi2025-11-05 15:57:51 +0000
commite4956451353b744fe15312366a09b0d17832332d (patch)
tree1e0f5d1549ffc586377a924ca86015c69d074551
parentac7abe070a316533d18d399cb5cc7cafcf7cfe3a (diff)
downloadopenwrt-e4956451353b744fe15312366a09b0d17832332d.tar.gz
cmake: set CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
According to CMake documentation[1]: [CMAKE_FIND_ROOT_PATH] is a list of directories that contain the target environment. [CMAKE_FIND_ROOT_PATH_MODE_PROGRAM] sets the default behavior for the find_program command. In most cases, find_program is used to search for an executable which will then be executed, e.g. using execute_process or add_custom_command. So in most cases an executable from the build host is required, so setting CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to NEVER is normally preferred. Since CMAKE_FIND_ROOT_PATH is set to the target staging dir, and the toolchain root dir, it will find target programs before the host ones. An example of this problem is if you try to build antiblock from the packages feed after llvm from the video feeds is built. Antiblock will search for clang-format, pickup the target version, and fail to build. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com> [1] https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html Link: https://github.com/openwrt/openwrt/pull/20656 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--include/cmake.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/cmake.mk b/include/cmake.mk
index 699257506a..b6e485eb4f 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -113,7 +113,7 @@ define Build/Configure/Default
-DCMAKE_NM="$(CMAKE_NM)" \
-DCMAKE_RANLIB="$(CMAKE_RANLIB)" \
-DCMAKE_FIND_ROOT_PATH="$(CMAKE_FIND_ROOT_PATH)" \
- -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_STRIP=: \