title: CMake not able to find OpenSSL library
body: <p>I am trying to install a software that uses cmake to install itself.  When I run <code>cmake ..</code> on the command line, it gives me following error in the <code>CMakeLists.txt</code> on the line that says <code>find_package(OpenSSL REQUIRED)</code>:</p>
  <pre><code>-- Could NOT find Git (missing:  GIT_EXECUTABLE) 
  ZLib include dirs: /usr/include
  ZLib libraries: /usr/lib/arm-linux-gnueabihf/libz.so
  Compiling with SSL support
  CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
    Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
    system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
    OPENSSL_INCLUDE_DIR)
  Call Stack (most recent call first):
    /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
    /usr/local/share/cmake-2.8/Modules/FindOpenSSL.cmake:313 (find_package_handle_standard_args)
    CMakeLists.txt:436 (find_package)
  </code></pre>
  <p>Here is the part of the file <code>CMakeLists.txt</code> where the error is coming from:</p>
  <pre><code>#
  # OpenSSL
  #
  if (WITH_SSL)
      message(&quot;Compiling with SSL support&quot;)
  
      if (USE_CYASSL)
          # Use CyaSSL as OpenSSL replacement.
          # TODO: Add a find_package command for this also.
          message(&quot;CyaSSL include dir: ${CYASSL_INCLUDE_DIRS}&quot;)
          message(&quot;CyaSSL libraries: ${CYASSL_LIB}&quot;)
  
          # Additional to the root directory we need to include
          # the cyassl/ subdirectory which contains the OpenSSL
          # compatability layer headers.
          foreach(inc ${CYASSL_INCLUDE_DIRS})
              include_directories(${inc} ${inc}/cyassl)
          endforeach()
  
          list(APPEND LIB_LIST ${CYASSL_LIB})
      else()
          # TODO: Add support for STATIC also.
          find_package(OpenSSL REQUIRED)
  
          message(&quot;OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}&quot;)
          message(&quot;OpenSSL libraries: ${OPENSSL_LIBRARIES}&quot;)
  
          include_directories(${OPENSSL_INCLUDE_DIR})
          list(APPEND LIB_LIST ${OPENSSL_LIBRARIES})
      endif()
  endif(WITH_SSL)
  </code></pre>
  <p>I have OpenSSL installed here:</p>
  <pre><code>ssl header is here   -- &gt; /usr/local/ssl/include/openssl/
  ssl library is here  -- &gt; /usr/local/ssl/lib/libssl.a
                            /usr/local/ssl/lib/libcrypto.a
  openssl is here      -- &gt; /usr/local/ssl/bin
  </code></pre>
  <p>I have in my <code>.profile</code>:</p>
  <pre><code>export LD_LIBRARY_PATH=/usr/local/ssl/include/openssl:/usr/lib:/usr/local/lib:/usr/lib/pkgconfig:/usr/local/include/wx-2.8/wx:$LD_LIBRARY_PATH
  export PKG_CONFIG_PATH=/usr/lib/pkgconfig
  export OPENSSL_ROOT_DIR=/usr/local/ssl
  export OPENSSL_LIBRARIES=/usr/local/ssl/lib/
  
  PATH = /usr/local/ssl/bin:$PATH
  </code></pre>
  <p>How can I resolve this error?</p>
  <p><strong>EDIT:</strong></p>
  <p>Now I am getting this error</p>
  <pre><code>/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
  dso_dlfcn.c:(.text+0x10): undefined reference to `dlopen'
  dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
  dso_dlfcn.c:(.text+0x30): undefined reference to `dlclose'
  </code></pre>