[CMake] find_library() and mark_as_advanced()

Paul Harris harris.pc at gmail.com
Tue Jun 18 13:20:47 EDT 2013


Hi there,

I have modified FindZLIB.cmake and FindPNG.cmake, because I want to specify
a separate release and debug library for MSVC to link to.

The problem is, my libraries are not in any standard place.
I want to use cmake-gui, run cmake and punch in exactly where these
libraries live.

So I have a call in FindPNG, like this:
  find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES_RELEASE} )

which it will not find.

at the bottom, there is:
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY  PNG_LIBRARY_RELEASE
PNG_LIBRARY_DEBUG)


My problem is, PNG_LIBRARY_DEBUG/RELEASE do NOT appear in cmake-gui.
Only PNG_PNG_INCLUDE_DIR and PNG_LIBRARY show up.


Is this because if Find_Target() doesn't find anything, it does not define
the variable at all?

This creates a problem.  If find_target doesn't find the target, the
variable is not defined, and thus the user isn't given the chance to input
the correct location.

Note that PNG_LIBRARY is not good enough, because you can't specify a set
of optimized/debug libraries in the slot.

My only choice seems to be to hack the cmake files to define the
PNG_RELEASE_LIBRARY variable.  Which is not ideal, because I'm compiling
VTK, this is not my own project, so I'll have to maintain a patch just for
this hack.

thanks,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130619/2b44b4fd/attachment.htm>


More information about the CMake mailing list