Why CMake changes its mind about glog
<p>In my project, in the "configure" phase my CMake seems to find glog, but in the building phase I receive the error message: cannot find -llibglog</p>

<p>It makes no difference if I use </p>

<pre><code>sudo apt-get install libgoogle-glog-dev
</code></pre>

<p>or generate glog from source. Recently I had to ugrade to Ubuntu 16.04 from 14.04, and have series of problems, from source redefinition problems to building problems like this. </p>

<p>Edited:
It is a complex project, with many subprojects and packages, so it would not fair to post so many files. And, it worked before upgrading.</p>

<p>The relevant parts:</p>

<pre><code>(FindGlog.cmake)
find_package_handle_standard_args(Glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)

if(GLOG_FOUND)
  set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
  set(GLOG_LIBRARIES ${GLOG_LIBRARY})
  message(STATUS "Found glog    (include: ${GLOG_INCLUDE_DIR}, library: ${GLOG_LIBRARY})")
  mark_as_advanced(GLOG_ROOT_DIR GLOG_LIBRARY_RELEASE GLOG_LIBRARY_DEBUG
                                 GLOG_LIBRARY GLOG_INCLUDE_DIR)
endif()
</code></pre>

<p>and CMakeLists.txt</p>

<p>target_link_libraries(
    simtest
    libmain
    libglog
    ${Pthread}
)</p>

<p>and the message
/usr/bin/ls: cannot find --libglog</p>