Override setting from CMAKE_TOOLCHAIN_FILE

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?

I’ve “solved” this in the meantime by explicitly adding

  "-DCMAKE_TOOLCHAIN_FILE:STRING="

to the CMAKE_CACHE_ARGS. This seems to work since the external project no longer uses the toolchain file (and thus no longer sets the CMAKE_FIND_ROOT_PATH_MODE_PACKAGE variable), but it still inherits all of the cross compilation options from the superproject.