I am using a toolchain file from OpenEmbedded (Yocto Linux). It’s contents include the following:
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
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 )
I would like to change CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
back to BOTH
for an external project that I’m using as a dependency (I cannot modify the toolchain file itself). I have this:
ExternalProject_Add(
foo
URL ${CMAKE_CURRENT_SOURCE_DIR}/foo-v4.8.1.tar.gz
URL_MD5 5a1785b0491a6f420e63d940bf701772
CMAKE_CACHE_ARGS
"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE:STRING=BOTH"
INSTALL_COMMAND ""
)
However, it looks like my CMAKE_CACHE_ARGS
in ExternalProject_Add
are still being overwritten by the toolchain file.
How can I override a value set in the toolchain file, without modifying the toolchain file itself?