[Cmake] FindLibrary problems
Brad King
brad.king at kitware.com
Fri Feb 28 10:08:39 EST 2003
> Suppose I have a CMakeLists.txt in a directory (/proj/dir) which
> contains a sub-directory called `mex'. FIND_LIBRARY(mex PATH
> ${MATLAB_LIB_DIR}) will return /proj/dir/mex which is not a library (or
> even a regular file) even though there is a libmex.so in
> ${MATLAB_LIB_DIR}. These sections
>
> --- cmSystemTools.cxx 14 Feb 2003 15:56:21 -0000 1.218
> +++ cmSystemTools.cxx 28 Feb 2003 12:26:25 -0000
> @@ -1625,12 +1625,6 @@
> std::string cmSystemTools::FindLibrary(const char* name,
> const std::vector<std::string>& userPaths)
> {
> - // See if the executable exists as written.
> - if(cmSystemTools::FileExists(name))
> - {
> - return cmSystemTools::CollapseFullPath(name);
> - }
> -
We cannot rule out the possibility that the file exists as written. The
string "mex" is a valid library name on unix. It just cannot be used with
a -l flag, but it can be used if the full path is given to ld.
Try changing the test to
if(cmSystemTools::FileExists(name) &&
!cmSystemTools::FileIsDirectory(name))
That should reduce the restrictions on source tree structure. If this
works, let me know and I'll include it in CMake proper, along with a
documentation update.
We could also consider only doing this check if the name has slashes in
it.
-Brad
More information about the CMake
mailing list