title: CMake find_package() search paths when cross compiling on windows
body: <p>I am trying to cross compile with arm-none-eabi-gcc on windows using cmake, and for some reason find_package() is searching versions of all the directories in my $PATH and <em>not</em> the CMAKE_FIND_ROOT_PATH I provided in the toolchain file. specifically, in the toolchain file I have the following lines:</p>
  
  <pre><code>SET(CMAKE_INSTALL_PREFIX "C:/toolchains/cm0p_root" CACHE PATH "Cmake install prefix")
  set(CMAKE_FIND_ROOT_PATH ${CMAKE_INSTALL_PREFIX})
  ...
  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)
  </code></pre>
  
  <p>I compiled and installed my library with the same toolchain, and everything was installed correctly to the cmp0_root directory.</p>
  
  <p>My projects CMakeLists.txt file has this in it:</p>
  
  <pre><code>find_package(myLIB REQUIRED)
  target_link_libraries(testProject PUBLIC myLIB::myLIB)
  </code></pre>
  
  <p>and find_package() fails to find the library. It succeeds if I put either of the two versions with HINTS or PATHS</p>
  
  <pre><code>find_package(myLIB REQUIRED HINTS /)
  find_package(myLIB REQUIRED PATHS "C:/toolchains/cm0p_root")
  </code></pre>
  
  <p>and using the command line option <code>-D CMAKE_FIND_DEBUG_MODE=ON</code> I can see it is searhcing the following paths:</p>
  
  <pre><code>Checking prefix [C:/toolchains/cm0p_root/git-sdk-64/mingw64/]
  Checking prefix [C:/toolchains/cm0p_root/Users/myname/]
  Checking prefix [C:/toolchains/cm0p_root/Program Files/ConEmu/]
  Checking prefix [C:/toolchains/cm0p_root/Python/Python36-32/]
  Checking prefix [C:/toolchains/cm0p_root/Python/Python36-32/Scripts/]
  Checking prefix [C:/toolchains/cm0p_root/Windows/]
  Checking prefix [C:/toolchains/cm0p_root/LLVM/]
  Checking prefix [C:/toolchains/cm0p_root/Program Files (x86)/IAR Systems/Embedded Workbench 8.0/common/]
  Checking prefix [C:/toolchains/cm0p_root/Program Files (x86)/IAR Systems/Embedded Workbench 8.0/avr/]
  Checking prefix [C:/toolchains/cm0p_root/Program Files (x86)/IAR Systems/Embedded Workbench 8.2/arm/]
  Checking prefix [C:/toolchains/cm0p_root/Program Files (x86)/MSBuild/12.0/Bin/]
  </code></pre>
  
  <p>and many more, but it is clear that CMake is prefixing the FIND_ROOT_PATH to the beginning of all my windows $PATH variables! the list is a lot longer but it never searches <code>C:/toolchains/cm0p_root/</code> which is what I need (I guess why the hint works).</p>
  
  <p>How do I get CMake to not search all these directories? I am cross compiling, and as far as I know it should only be searching my "fake" root directory since <code>CMAKE_FIND_ROOT_PATH_MODE_PACKAGE</code> is set to <code>ONLY</code></p>