[CMake] find_library while cross compiling?

Parag Chandra parag at ionicsecurity.com
Thu Apr 30 22:43:26 EDT 2015


Hi Robert,

I encountered a similar problem when I was cross-compiling for NaCl on
Windows. You need to set various CMake variables that explicitly override
things like the library suffix/prefix. For example, in my case I needed to
set the following:

set (CMAKE_STATIC_LIBRARY_PREFIX "lib")
set (CMAKE_STATIC_LIBRARY_SUFFIX ".a")
set (CMAKE_EXECUTABLE_SUFFIX ".pexe" CACHE STRING "" FORCE)
set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".so")

Hope this helps.




Parag Chandra
Senior Software Engineer, Mobile Team
Mobile: +1.919.824.1410

 <https://ionic.com>

Ionic Security Inc.
1170 Peachtree St. NE STE 400, Atlanta, GA 30309











On 4/30/15, 4:34 PM, "Robert Dailey" <rcdailey.lists at gmail.com> wrote:

>I'm on Windows and I am cross compiling for Android NDK. I use
>find_library() with PATHS to hunt down some libssl.a files, plus a few
>others.
>
>However, find_library() says it can't find them. I'm assuming this is
>because I'm on Windows and it doesn't recognize *.a files as a valid
>library on that platform. Is there a way to make CMake search
>libraries based on the platform the target is being compiled for?
>-- 
>
>Powered by www.kitware.com
>
>Please keep messages on-topic and check the CMake FAQ at:
>http://www.cmake.org/Wiki/CMake_FAQ
>
>Kitware offers various services to support the CMake community. For more
>information on each offering, please visit:
>
>CMake Support: http://cmake.org/cmake/help/support.html
>CMake Consulting: http://cmake.org/cmake/help/consulting.html
>CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list