On 04/13/2011 09:26 PM, Brad King wrote: > On 04/13/2011 02:44 PM, Jean-Christophe Fillion-Robin wrote: >> Is there a solution to find a library having a revision number ? > > You can specify the actual library file name "libgfortran.so.3".
AFAIK, this is not sufficient because FIND_LIBRARY() only looks for library files - specified literally or not - which end with a suffix mentioned in FIND_LIBRARY_SUFFIXES. See the following CMakeLists.txt: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(XYZ NONE) SET(CMAKE_VERBOSE_MAKEFILE ON) FILE(WRITE ${CMAKE_BINARY_DIR}/libxyz.so.3 "") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so.3") FIND_LIBRARY(XYZ libxyz.so.3 PATHS ${CMAKE_BINARY_DIR} NO_DEFAULT_PATH) MESSAGE("XYZ: ${XYZ}") First, ${CMAKE_BINARY_DIR}/libxyz.so.3 is found, but if you remove the SET(CMAKE_FIND_LIBRARY_SUFFIXES ...) command and unset the XYZ cache entry, you'll probably see libxyz.so.3 not being found anymore. It is cmFindLibraryHelper::SetName() that implements this behaviour, if I'm not mistaken. So, a possible workaround is to temporarily add ".so.3" or whatever is desired to CMAKE_FIND_LIBRARY_SUFFIXES before calling FIND_LIBRARY(), cf. [1]. Regards, Michael [1] http://www.mail-archive.com/cmake@cmake.org/msg35219.html _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake