<div dir="ltr"><div>Hi,</div><div><br></div><div>Sorry a small correction.</div><div><br></div><div>There is no such thing as "NO_CMAKE_SYSROOT".<br></div><div><br></div><div><span class="gmail-im"><div>find_file(AWSSDK_CORE_HEADER_FILE Aws.h<br>            "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_INCLUDEDIR}/aws/core"<br>            "${AWSSDK_DEFAULT_ROOT_DIR}/${AWSSDK_INSTALL_INCLUDEDIR}/aws/core"</div></span><div>            NO_CMAKE_FIND_ROOT_PATH</div><div><b>            NO_CMAKE_SYSTEM_PATH</b><br></div><div>            )</div><div><br></div><div>Regards,</div><div>Ugesh<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 31, 2019 at 9:49 AM ugesh reddy <<a href="mailto:abhiugeshreddy@gmail.com">abhiugeshreddy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I also have the same issue with find_file/find_path/find_package when I use the Android NDK and Eric's explanation make sense.<br></div><div><br></div><div>One way to solve this</div><div><br></div><div>find_file(AWSSDK_CORE_HEADER_FILE Aws.h<br>            "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_INCLUDEDIR}/aws/core"<br>            "${AWSSDK_DEFAULT_ROOT_DIR}/${AWSSDK_INSTALL_INCLUDEDIR}/aws/core"</div><div><b>            NO_CMAKE_FIND_ROOT_PATH</b></div><div><b>            NO_CMAKE_SYSROOT</b><br></div><div>            )</div><div><br></div><div></div><div>Regards,</div><div>Ugesh Gurram.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 31, 2019 at 9:16 AM Eric Doenges <<a href="mailto:doenges@mvtec.com" target="_blank">doenges@mvtec.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    Am 31.07.19 um 08:20 schrieb Stephan Menzel:<br>
    <blockquote type="cite">
      
      <div dir="ltr">Hello all,
        <div><br>
        </div>
        <div>I'm trying to adapt my CMake based toolchain to Android and
          I'm noticing very strange behavior that I'd like to ask about.</div>
        <div>My toolchain is C++ based with some dependencies such as
          Boost, OpenSSL or protobuf. So far it works on a variety of
          platforms such as Windows (MSVC), several Linuxes, including
          Raspbian on ARM. So I considered myself well prepared for
          Android, thinking it can't be that different. How wrong I
          was... I'm cross compiling from a Linux system, which is able
          to build the source in question just fine with clang and gcc.
          Most recent Android SDK and bundled NDK.</div>
        <div><br>
        </div>
        <div>As soon as I started building and finding my 3rd party
          dependencies I noticed that many commands in my own scripts or
          others that try to find a file (like a header) or a lib fail
          despite the file being there.</div>
        <div>Like here in this case for example (randomly taken from the
          AWS SDK installed CMake finders):</div>
      </div>
    </blockquote>
    <p>My experience has been that find_file and friends behave in
      unexpected ways when you set CMAKE_SYSROOT. In our toolchain
      files, we set</p>
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)<br>
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)<br>
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)<br>
    set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)<br>
    <p>as suggested in the cmake-toolchains(7) documentation. We then
      add the path to the top-level directory where we keep all our
      thirdparty dependencies to CMAKE_FIND_ROOT_PATH, as otherwise
      find_package and find_path cannot find anything even when we give
      them the absolute path where to search (the find_file
      documentation suggests that the elements of the
      CMAKE_FIND_ROOT_PATH are prepended to the paths specified in the
      find_file arguments, but that does not seem to happen if the
      search paths are subpaths of the CMAKE_FIND_ROOT_PATH). My guess
      would be that the NDK does something similar, meaning you would
      need to add the path where to look for AWS to
      CMAKE_FIND_ROOT_PATH.<br>
    </p>
    <p>CMake feature request: it would be real nice to have a verbose
      mode for the find_XXX functions that tell you exactly where CMake
      is looking for stuff and why to help debug problems like this.</p>
    <p>With kind regards,<br>
      Eric<br>
    </p>
    -- <br>
    <div class="gmail-m_-4730681873049219729gmail-m_1892470205654918474moz-signature">
      <div style="width:480px;text-align:left;font-family:Arial,Helvetica,sans-serif">
        <p style="color:rgb(6,45,100);font-size:14px;text-align:left;font-family:Arial,Helvetica,sans-serif"><b>
            Dr. Eric Dönges
          </b><br>
          Senior Software Engineer
        </p>
        <p style="color:rgb(6,45,100);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif">MVTec Software
          GmbH | Arnulfstr. 205 | 80634 Munich | Germany<br>
          <a style="font-size:12px;font-family:Arial,Helvetica,sans-serif;color:rgb(6,45,100)" href="mailto:doenges@mvtec.com" target="_blank">doenges@mvtec.com</a>
          | Tel: +49 89 457 695-0 | <a style="font-size:12px;font-family:Arial,Helvetica,sans-serif;color:rgb(6,45,100)" href="http://www.mvtec.com" target="_blank">www.mvtec.com</a>
        </p>
        <p style="color:rgb(6,45,100);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif"><img valign="bottom" width="16" height="16"> <a style="font-size:12px;font-family:Arial,Helvetica,sans-serif;color:rgb(6,45,100);font-weight:bold" href="http://www.mvtec.com/newsletter" target="_blank">Sign up</a> for our
          MVTec Newsletter!</p>
        <p style="margin:0px;color:rgb(102,102,102);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif">Geschäftsführer:
          Dr. Wolfgang Eckstein, Dr. Olaf Munkelt<br>
          Amtsgericht München HRB 114695</p>
        <p style="margin:0px;color:rgb(102,102,102);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif"> </p>
        <img alt="MVTec Software GmbH Logo"></div>
    </div>
  </div>

-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail-m_-4730681873049219729gmail_signature"> Ugesh</div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"> Ugesh</div>