Re: [CMake] Preventing search for libraries in random prefixes
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 mo...@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 FindFoo 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 -- 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
Re: [CMake] Preventing search for libraries in random prefixes
Hi Mojca, I don't know if removing these paths would break your build maybe...I'm sorry I couldn't help. Angeliki On Fri, Jun 27, 2014 at 11:26 AM, Mojca Miklavec mo...@macports.org wrote: On Fri, Jun 27, 2014 at 10:42 AM, Angeliki Chrysochou wrote: 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 The problem is that some files like FindGTK2.cmake explicitly specify additional (undesired) search paths, for example: find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr} PATHS ${_gtk2_arch_dir} /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/gnome/include /opt/gnome/lib /opt/openwin/include /usr/openwin/lib /sw/include /sw/lib /opt/local/include /opt/local/lib /usr/pkg/lib /usr/pkg/include/glib $ENV{GTKMM_BASEPATH}/include $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib PATH_SUFFIXES ${_suffixes} ) I would like to get rid of those. Mojca On Thu, Jun 26, 2014 at 10:56 PM, Mojca Miklavec mo...@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 FindFoo 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
Re: [CMake] Preventing search for libraries in random prefixes
On Fri, Jun 27, 2014 at 11:28 AM, Angeliki Chrysochou wrote: Hi Mojca, I don't know if removing these paths would break your build maybe...I'm sorry I couldn't help. It wouldn't break my build, but it seems weird and unnatural to do such extensive patching to CMake's Find modules. 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
Re: [CMake] Preventing search for libraries in random prefixes
Hi Mojca, On 27 June 2014 10:26, Mojca Miklavec mo...@macports.org wrote: On Fri, Jun 27, 2014 at 10:42 AM, Angeliki Chrysochou wrote: 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 The problem is that some files like FindGTK2.cmake explicitly specify additional (undesired) search paths, for example: find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr} PATHS ${_gtk2_arch_dir} /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/gnome/include /opt/gnome/lib /opt/openwin/include /usr/openwin/lib /sw/include /sw/lib /opt/local/include /opt/local/lib /usr/pkg/lib /usr/pkg/include/glib $ENV{GTKMM_BASEPATH}/include $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib PATH_SUFFIXES ${_suffixes} ) I would like to get rid of those. I don't think you can get rid of them as such as I'm not sure if a global setting of things like NO_DEFAULT_PATH and so on exist (do they?). I think you can bias the search though by using variables like CMAKE_PREFIX_PATH - these should be first in the search path according to the docs for find_path and find_library. I've used this to point CMake at my own toolkits and it's worked quite well. Ben. Mojca On Thu, Jun 26, 2014 at 10:56 PM, Mojca Miklavec mo...@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 FindFoo 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 -- 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: