It has been years since I worked in C++
, and I've never used CMake
before. I'm trying to compile a program called ngmlr, which uses CMake
. It worked seamlessly on other systems I tried to build it on. This time around, CMake
finds ZLIB
(Found ZLIB: /usr/lib64/libz.so (found version "1.2.3")
), as required by ngmlr
, but the subsequent make
fails with ld: cannot find -lz
.
I think I know what's happening: CMake
found the dynamic ZLIB
library (libz.so
), but the CMakeLists.txt
file requires static
(I found the following option in the file: option(STATIC "Build static binary" ON)
). As far as I can tell, the static library (libz.a
) is missing on this machine. It's not in the same /usr/lib64
directory as libz.so
. locate
is not available.
Questions:
- Does that seem correct?
- For education, assuming this is the problem, can you force
CMake
to look specifically forstatic
ZLIB
? e.g., since the developer requiredstatic
, it would have been nice to immediately know the missingstatic
library was the problem, rather than the embarrassingly long amount of time it took me to figure it out.
I've looked extensively for a clear answer to both, but didn't find anything conclusive (e.g., Force cmake to use static libraries).
UPDATE
I did confirm that the problem is that ld
could not find the static library. Now I'm particularly interested to know if the developer can tell CMake
to throw an error if the static
libraries are not present, and save someone else.
cmake version 2.8.8