title: Undefined reference to symbol 'gzclose' with cmake and opencv
body: <p>I try to build the project, <a href="https://bitbucket.org/rodrigob/doppia" rel="nofollow noreferrer">doppia</a>, but linking error occurs. I guess this is a linker error, but I've spent a lot of time and haven't find a working answer.</p>
  
  <p>When I tried before, there is no error. But I have other error about CUDA, so I reinstalled opencv. After that, this linking error occurs.</p>
  
  <p>So, I think this is opencv-related problem such as mistake of path, etc.</p>
  
  <p><strong>Command:</strong></p>
  
  <pre><code>cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . &amp;&amp; make
  </code></pre>
  
  <p>path .bashrc</p>
  
  <pre><code>LD_LIBRARY_PATH=/home/username/Documents/Python/imra/code/opencv-2.4.11/release/lib:/home/username/Documents/Python/imra/code/opencv-2.4.11/release/3rdparty/lib/:$LD_LIBRARY_PATH
  
  export LD_LIBRARY_PATH
  PKG_CONFIG=$PKG_CONFIG_PATH:/home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/unix-install/
  export PKG_CONFIG_PATH
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <blockquote>
    <p>/usr/bin/ld:
    /home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/installed/lib/libopencv_core.a(persistence.cpp.o):
    undefined reference to symbol 'gzclose'
    /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libz.so:
    error adding symbols: DSO missing from command line collect2: error:
    ld returned 1 exit status make[2]: <strong>* [ground_estimation] error 1
    make<a href="https://bitbucket.org/rodrigob/doppia" rel="nofollow noreferrer">1</a>: *</strong> [CMakeFiles/ground_estimation.dir/all</p>
  </blockquote>
  
  <p>] error 2
  make: *** [all] error 2</p>
  
  <p><strong>some info:</strong></p>
  
  <ul>
  <li>Ubuntu 14.04 LTS 64bit</li>
  <li>OpenCV 2.4.11</li>
  <li>ZLIB 1.2.8</li>
  </ul>