How to tell CMake which libpng.dylib to use?

Michael Dickens michaelld at macports.org
Mon Jan 21 13:14:03 PST 2013


Hi Mojca - In the top build directory there will be a file
CMakeCache.txt.  Look in this file for whatever you want, and there will
be a CMake define associated with it in the style of
"FOO[stuff]=/usr/X11R6/lib/libpng.dylib".  When you issue the cmake
command, add in "-DFOO=/opt/local/lib/libpng.dylib" (or, whatever your
correction is), run the CMake command, and then verify from the
CMakeCache.txt file that it's correct.  Most of the time this will work;
rarely it won't and you have to find other ways around the issue. - MLD

On Jan 21, 2013, at 4:03 PM, Mojca Miklavec <mojca at macports.org> wrote:
> I'm playing with CMake-based ports (Root in particular). While these ports work, I noticed the following:
>   -- Found JPEG: /opt/local/lib/libjpeg.dylib
>   -- Found PNG: /usr/X11R6/lib/libpng.dylib (found version "1.5.4")
> 
> Some documentation about searching the libraries is here:
>   http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
> All the code that a port uses to find the PNG library is the following:
>   find_Package(PNG)
> so there is no path or anything else to plug in.
> 
> I'm unable to figure out how to tell CMake that it should use a specific libpng.dylib. The resulting binaries and libraries consequently link to
>   /usr/X11/lib/libpng15.15.dylib
>   /usr/X11/lib/libfreetype.6.dylib
>   /usr/lib/libz.1.dylib
> etc.
>
> I would be grateful for any hints about how to fix this.


More information about the macports-dev mailing list