[CMake] Preventing search for libraries in random prefixes

Angeliki Chrysochou angeliki.chrysochou at gmail.com
Fri Jun 27 04:42:59 EDT 2014


Hi Mojca,

>From what I know cmake will look for libraries in the directories specified
in link_directories(${LIBRARY_DIRS}) and for headers in the directories
specified in include_directories(${INCLUDE_DIRS}) and the property
INCLUDE_DIRECTORIES.

http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:link_directories

http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:include_directories

Cheers!
Angeliki



On Thu, Jun 26, 2014 at 10:56 PM, Mojca Miklavec <mojca at macports.org> wrote:

> Hi,
>
> In our package manager where it is of crucial importance to link
> against the proper library we often end up with hardcoding lots and
> lots of options, like:
>
> -DOPENGL_INCLUDE_DIR=${prefix}/include \
> -DX11_ICE_INCLUDE_PATH=${prefix}/include \
> -DX11_SM_INCLUDE_PATH=${prefix}/include \
> -DX11_X11_INCLUDE_PATH=${prefix}/include \
> -DX11_Xext_INCLUDE_PATH=${prefix}/include \
> -DX11_Xft_INCLUDE_PATH=${prefix}/include \
> -DX11_Xpm_INCLUDE_PATH=${prefix}/include \
> -DX11_ICE_LIB=${prefix}/lib/libICE.dylib \
> -DX11_SM_LIB=${prefix}/lib/libSM.dylib \
> -DX11_X11_LIB=${prefix}/lib/libX11.dylib \
> -DX11_Xext_LIB=${prefix}/lib/libXext.dylib \
> -DX11_Xft_LIB=${prefix}/lib/libXft.dylib \
> -DX11_Xpm_LIB=${prefix}/lib/libXpm.dylib \
> -DOPENGL_gl_LIBRARY=${prefix}/lib/libGL.dylib \
>
> With autotools that usually boiled down to just:
>     --with-x=${prefix}
>
> My question: is there any way to tell CMake the following?
>
> "Please don't search for any libraries or headers from /sw or /usr/X11
> or /opt/local or anything, I really really want you to search for the
> libraries in /my/special/prefix and only there".
>
> A while back a user asked for removing /sw from CMake Find<Foo>
> modules because that caused him problems. But I would like to
> understand the general policy about this.
>
> See:
>     https://trac.macports.org/ticket/41817
>
> I like that fact that CMake eventually offers more flexibility, but it
> makes it a bit painful to ensure that exactly the right libraries are
> used. I'm sure that I'm missing something though, so I would like to
> understand how to handle this properly.
>
> Thank you,
>     Mojca
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140627/ed72f104/attachment.html>


More information about the CMake mailing list