find_library disobeying NO_DEFAULT_PATH?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

find_library disobeying NO_DEFAULT_PATH?

Andrew Brownsword
I’m using this command:

find_library(LIBPQXX_LIBRARY
        NAMES libpqxx.a libpqxx
        PATHS ${LIBPQXX_DEPS_DIR}/src/src
        PATH_SUFFIXES .libs
        NO_DEFAULT_PATH)
message(STATUS "libpqxx @ " ${LIBPQXX_LIBRARY})

This prints a path to where an older version is installed in /usr/local/lib/.  My understanding is that NO_DEFAULT_PATH should limit the search to the supplied PATHS.  What am I doing wrong?

--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: find_library disobeying NO_DEFAULT_PATH?

Andrew Brownsword
I solved this problem by discovering that found libraries are one of the things cached between runs of cmake.  Deleting CMakeCache.txt solves the problem.  Hopefully this serves as a warning to people having the same issue.

> On Apr 21, 2018, at 7:53 PM, Andrew Brownsword <[hidden email]> wrote:
>
> I’m using this command:
>
> find_library(LIBPQXX_LIBRARY
>        NAMES libpqxx.a libpqxx
>        PATHS ${LIBPQXX_DEPS_DIR}/src/src
>        PATH_SUFFIXES .libs
>        NO_DEFAULT_PATH)
> message(STATUS "libpqxx @ " ${LIBPQXX_LIBRARY})
>
> This prints a path to where an older version is installed in /usr/local/lib/.  My understanding is that NO_DEFAULT_PATH should limit the search to the supplied PATHS.  What am I doing wrong?
>
--

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:
https://cmake.org/mailman/listinfo/cmake