I've tried this again, but on OSX. The first example,

   cmake_minimum_required( VERSION 3.0 )
   project( "cmakefindlibtest" )
   list( APPEND CMAKE_FIND_ROOT_PATH "/Users/tmiddleton/lib" )
   find_library( punycode_library_test punycode  )
   message( "punycode_library_test is now ${punycode_library_test}" )

doesn't work - perhaps because find_library() doesn't have any paths to
prepend with CMAKE_FIND_ROOT_PATH? But this,

   cmake_minimum_required( VERSION 3.0 )
   project( "cmakefindlibtest" )
   list( APPEND CMAKE_FIND_ROOT_PATH "/Users/tmiddleton" )
   list( APPEND CMAKE_LIBRARY_PATH "lib" )
   find_library( punycode_library_test punycode  )
   message( "punycode_library_test is now ${punycode_library_test}" )

and this,

    cmake_minimum_required( VERSION 3.0 )
    project( "cmakefindlibtest" )
    list( APPEND CMAKE_FIND_ROOT_PATH "/Users/tmiddleton" )
    find_library( punycode_library_test punycode PATHS "lib" )
    message( "punycode_library_test is now ${punycode_library_test}" )

DO work, as expected. Should I raise a bug for the Windows version? Is the
first example supposed to work too?






On Thu, Jul 10, 2014 at 10:55 AM, Ted Middleton <middleton....@gmail.com>
wrote:

> I'm using cmake 3.0.0 on win7 64-bit and I'm having a difficult time with
> CMAKE_FIND_ROOT_PATH. The cross-compiling cmake page as well as the
> find_library() docs seem to suggest that if CMAKE_FIND_ROOT_PATH is
> non-empty, find_library() will use it to prepend any paths it searches,
> sort of like an alternate sysroot? But that doesn't seem to be happening in
> my set-up and I can't figure out why? When I run this:
>
>    cmake_minimum_required( VERSION 3.0 )
>    project( "cmakefindlibtest" )
>    list( APPEND CMAKE_FIND_ROOT_PATH "C:/DEV/lib" )
>    find_library( punycode_library_test punycode  )
>    message( "punycode_library_test is now ${punycode_library_test}" )
>
> In this case, ${punycode_library_test} ends up being
> punycode_library_test-NOTFOUND. I thought that maybe this was because my
> CMAKE_LIBRARY_PATH was empty - perhaps the problem here is that
> find_library() doesn't have any paths to prepend with CMAKE_FIND_ROOT_PATH
> in the first place, so I tried this:
>
>    cmake_minimum_required( VERSION 3.0 )
>    project( "cmakefindlibtest" )
>    list( APPEND CMAKE_FIND_ROOT_PATH "C:/DEV/" )
>    list( APPEND CMAKE_LIBRARY_PATH "lib" )
>    find_library( punycode_library_test punycode  )
>    message( "punycode_library_test is now ${punycode_library_test}" )
>
> This doesn't work either, and neither does
>
>     cmake_minimum_required( VERSION 3.0 )
>     project( "cmakefindlibtest" )
>     list( APPEND CMAKE_FIND_ROOT_PATH "C:/DEV/" )
>     find_library( punycode_library_test punycode PATHS "lib" )
>     message( "punycode_library_test is now ${punycode_library_test}" )
>
> When I specify PATHS "C:/DEV/lib" to find_library(), or I add "C:/DEV/lib"
> to CMAKE_LIBRARY_PATH, I can find the punycode.lib sitting in my C:/DEV/lib
> directory, but I'd like to know what's going wrong with
> CMAKE_FIND_ROOT_PATH because I'm trying to use it for cross-compiling and
> it doesn't seem to be doing anything the way that I'm using it.
>
>
>
>
>
>
>
-- 

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

Reply via email to