Would anyone know what the PNG Include directory variable should be for CMAKE. I can't seem to find a Cmake module to search for PNG in the program which depends on LIBPNG (unlike all it's other dependencies). I've been using PNG_INCLUDE_DIR but CMAKE doesn't seem to recognise it?

thanks.

  1. Make sure that libpng and zlib are installed on your computer.
  2. Make sure that FindPNG.cmake module is installed on your computer (should be by the default cmake install). To find it, make a file search for the file name "FindPNG.cmake", and you should find it in CMake's "Modules" directory.
  3. Make a small test to make sure it is found correctly, i.e., try this CMakeLists.txt file:

    cmake_minimum_required (VERSION 2.6)
    project(PNGTest)

    find_package(PNG REQUIRED)

    message(STATUS "LibPNG package was found with include dir: '${PNG_INCLUDE_DIRS}'")

  4. Run a clean cmake configuration on the code that you originally wanted to compile.

Not sure what step 3 means? Is that to be entered into the cmd prompt?

Make sure that FindPNG.cmake module is installed on your computer
Definetly there.

Here's what I enter into the command prompt. Withouth the zlib, libjpeg, png & freetype arguments it goes through some process for a minute or so then tells me it need zlib.

If I add these arguments in I get the error shown at the bottom of the entry below.

I'm thinking that I just don't know how to add arguments for dependencies into the build instructions. Would you know why I'm getting the errors below? Am I using these arguments correctly? I have, during the build process implicitely specified the lib, include and bin directory for my compiler (MinGW).

**WITHOUT DEPENDENCY ARGUMENTS**

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.


C:\podofo-0.9.1\podofo-build>cmake -G "MinGW Makefiles" ../ -DCMAKE_INCLUDE_PATH
=..\..\CodeBlocks\MinGW\include  -DCMAKE_LIBRARY_PATH=..\..\CodeBlocks\MinGW\lib
 -DPODOFO_BUILD_SHARED:BOOL=FALSE
-- The C compiler identification is GNU 4.4.1
-- The CXX compiler identification is GNU 4.4.1
-- Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/CodeBlocks/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/CodeBlocks/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
WANT_LIB64 unset; assuming normal library directory names
Will install libraries to C:/Program Files/PoDoFo/lib
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - not found
-- Looking for winsock2.h
-- Looking for winsock2.h - found
-- Looking for mem.h
-- Looking for mem.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for BaseTsd.h
-- Looking for BaseTsd.h - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
Using gcc specific compiler options
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHan
dleStandardArgs.cmake:97 (MESSAGE):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardAr
gs.cmake:288 (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/FindZLIB.cmake:47 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:309 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!

C:\podofo-0.9.1\podofo-build>



**WITH DEPENDENCY ARGUMENTS**

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xxxx>cd C:\podofo-0.9.1\podofo-build

C:\podofo-0.9.1\podofo-build>cmake -G "MinGW Makefiles" ..\ -DCMAKE_INCLUDE_PATH
=..\..\CodeBlocks\MinGW\include  -DCMAKE_LIBRARY_PATH=..\..\CodeBlocks\MinGW\lib
 -DPODOFO_BUILD_SHARED:BOOL=FALSE -LIBJPEG_LIBRARY_DEBUG=C:\jpeg-6b -LIBJPEG_INC
LUDE_DIR=C:\jpeg-6b -FREETYPE_LIBRARY_DEBUG=C:\FREETYPE-2.3.5 -FREETYPE_INCLUDE_
DIR=C:\FREETYPE-2.3.5\include -PNG_LIBRARY=C:\libpng -PNG_PNG_INCLUDE_DIR=C:\lib
png -ZLIB_LIBRARY_DEBUG=C:\zlib -ZLIB_INCLUDE_DIR=C:\zlib
CMake Error: Error processing file:-PNG_PNG_INCLUDE_DIR=C:\libpng

C:\podofo-0.9.1\podofo-build>

`

As I told you in this other thread, the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH are environment variables, and they contain a list of paths that cmake ought to use in order to find the libraries on your system. You should definitely not set them as command-line argument to cmake. What is the output if you simply run this command:

cmake ..

In other words, without any options at all. All the options that you have put in the command line as per your last post, were wrong. You shouldn't define individual tokens like ZLIB_INCLUDE_DIR in the command-line. All your libraries seem to be installed on the C:\ directory, there should be not problem for cmake to find them automatically, as long as you leave the variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH intact, or make sure that C:\ is listed in them, when you look at their values in the environment variable listing of your computer.

OK, thanks again. Whilst I percieved the other post as a different question it turns out it is somewhat related to this one.

Oh'yes.. When I input cmake --version I get cmake version 2.89.

That seems to have worked though I had to put these environmental variables in myself, I got the impression from your reply above that these were set automatically but there was nothing amongst my environmental variables so I set them myself. I'm using Windows XP, MinGW 4.4.1 .

I now have a new error but I seem to be getting closer which is reassuring. The old errors seem to have dissipated. The error is at the bottom of the message below. Is this something else I've failed to set or would it be that I need to make a customization of some form in the cmake search files? I'm really lost with this but thanks for the help so far. Please see below.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xxxx>cd C:\podofo-0.9.1\podofo-build

C:\podofo-0.9.1\podofo-build>cmake -G "MinGW Makefiles"
CMake Error: The source directory "C:/podofo-0.9.1/podofo-build" does not appear
 to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

C:\podofo-0.9.1\podofo-build>cmake -G "MinGW Makefiles" ..\
-- The C compiler identification is GNU 4.4.1
-- The CXX compiler identification is GNU 4.4.1
-- Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/CodeBlocks/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/CodeBlocks/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
WANT_LIB64 unset; assuming normal library directory names
Will install libraries to C:/Program Files/PoDoFo/lib
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - not found
-- Looking for winsock2.h
-- Looking for winsock2.h - found
-- Looking for mem.h
-- Looking for mem.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for BaseTsd.h
-- Looking for BaseTsd.h - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
Using gcc specific compiler options
-- Found ZLIB: C:/zlib/zlib1.dll
Found zlib headers in c:/CodeBlocks/MinGW/include, library at C:/zlib/zlib1.dll
-- Found LIBJPEG: C:/jpeg-6b/libjpeg.a
Found libjpeg headers in C:/jpeg-6b, library at C:/jpeg-6b/libjpeg.a
-- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR)
Libtiff not found. TIFF support will be disabled
CMake Error at cmake/modules/FindPNG.cmake:70 (include):
  include could not find load file:

    C:/podofo-0.9.1/cmake/modules/FindPackageHandleStandardArgs.cmake
Call Stack (most recent call first):
  CMakeLists.txt:332 (FIND_PACKAGE)


-- Found PNG: c:/CodeBlocks/MinGW/lib/libpng.a (found version "1.5.13")
Found LibPng headers in c:/CodeBlocks/MinGW/include;c:/CodeBlocks/MinGW/include,
 library at c:/CodeBlocks/MinGW/lib/libpng.a;C:/zlib/zlib1.dll
-- Ensure you cppunit installed version is at least 1.12.0
Cppunit not found. No unit tests will be built.
Found freetype library at C:/freetype-2.4.10/objs/freetype.a, headers C:/freetyp
e-2.4.10/include;C:/freetype-2.4.10/include
-- Could NOT find Fontconfig (missing:  FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_
DIR)
-- Could NOT find Lua50 (missing:  LUA_LIBRARIES LUA_INCLUDE_DIR)
-- Could NOT find Lua (missing:  LUA_LIBRARIES LUA_INCLUDE_DIR)
Lua not found - PoDoFoImpose and PoDoFoColor will be built without Lua support
Building multithreaded version of PoDoFo.
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found.
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
Building static PoDoFo library
-- Configuring incomplete, errors occurred!

C:\podofo-0.9.1\podofo-build>

It seems to work. Now you just need to install the external libraries that are missing: tiff, cppunit, fontconfig, and lua50 / lua. Afterwards, rerun cmake and hopefully it will work.

Yep, the other dependencies are't necessary for podofo,t hey're optional. The minimum I need is zlib and freetype2 which I have and the compiler has picked them up. Having said that, if I choose not to use the other optional components is there something I need to do? Generally I mean. I'm not sure if these other components tiff, cppunit, fontconfig and lua are neccessary to make this work.

Thanks.

Oh, right, I didn't notice that at first. The error is about the missing FindPackageHandleStandardArgs.cmake module. Locate it on your computer or download it, and place it in the correct directory, that should fix it. If the other dependencies are optional, then there is nothing else you need to do.

Seriously, thanks for the help. I'll give that a go and touch wood... Things will be up and running.

Actually, I'm not sure that is the issue here. It looks like that has worked fine as it found all the other components. The error seems to be in the compiling process so I'm wondering if I've left something out. It looks like a static library was about to be compiled and things have just stopped?

It is definitely not a compilation problem. The output you posted in only cmake output given during configuration (compilation output looks very different). Also, it does say "Configuring incomplete, errors occurred!" and above it, the only Error found is this one:

CMake Error at cmake/modules/FindPNG.cmake:70 (include):
  include could not find load file:
    C:/podofo-0.9.1/cmake/modules/FindPackageHandleStandardArgs.cmake

Call Stack (most recent call first):
  CMakeLists.txt:332 (FIND_PACKAGE)

aha.. and it seems that that podofo directory doesn't contain a FindPNG Cmake file too. Could very well be the issue and I'm not sure why it's not there.

I'll look into that..

Thanks for pointing it out, I completely overlooked that.

It worked. My last post indicated that I was expecting to see a FindPNG cmake file in the podofo modules directory but that seems to have been wrong. There is none so I believe it is found via the zlib module in the same directory or something along that line.

I've provided the dos output below. Will probably try to install the other optional components now that I have been able to compile podofo.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.


C:\podofo-0.9.1\podofo-debug>cmake -G "MinGW Makefiles" ../
-- The C compiler identification is GNU 4.4.1
-- The CXX compiler identification is GNU 4.4.1
-- Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/CodeBlocks/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/CodeBlocks/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
WANT_LIB64 unset; assuming normal library directory names
Will install libraries to C:/Program Files/PoDoFo/lib
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - not found
-- Looking for winsock2.h
-- Looking for winsock2.h - found
-- Looking for mem.h
-- Looking for mem.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for BaseTsd.h
-- Looking for BaseTsd.h - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
Using gcc specific compiler options
-- Found ZLIB: C:/zlib/zlib1.dll
Found zlib headers in C:/zlib, library at C:/zlib/zlib1.dll
-- Found LIBJPEG: C:/jpeg-6b/libjpeg.a
Found libjpeg headers in C:/jpeg-6b, library at C:/jpeg-6b/libjpeg.a
-- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR)
Libtiff not found. TIFF support will be disabled
CMake Warning (dev) at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPN
G.cmake:34 (find_package):
  File C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPNG.cmake
  includes C:/podofo-0.9.1/cmake/modules/FindZLIB.cmake (found via
  CMAKE_MODULE_PATH) which shadows C:/Program Files/CMake
  2.8/share/cmake-2.8/Modules/FindZLIB.cmake.  This may cause errors later on
  .

  Policy CMP0017 is not set: Prefer files from the CMake module directory
  when including from there.  Run "cmake --help-policy CMP0017" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.
Call Stack (most recent call first):
  CMakeLists.txt:332 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PNG: C:/libpng/libpng.a (found version "1.5.13")
Found LibPng headers in C:/libpng;C:/zlib, library at C:/libpng/libpng.a;C:/zlib
/zlib1.dll
-- Ensure you cppunit installed version is at least 1.12.0
Cppunit not found. No unit tests will be built.
Found freetype library at C:/freetype-2.4.10/objs/freetype.a, headers C:/freetyp
e-2.4.10/include;C:/freetype-2.4.10/include
-- Could NOT find Fontconfig (missing:  FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_
DIR)
-- Could NOT find Lua50 (missing:  LUA_LIBRARIES LUA_INCLUDE_DIR)
-- Could NOT find Lua (missing:  LUA_LIBRARIES LUA_INCLUDE_DIR)
Lua not found - PoDoFoImpose and PoDoFoColor will be built without Lua support
Building multithreaded version of PoDoFo.
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found.
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
Building static PoDoFo library
-- Configuring done
-- Generating done
-- Build files have been written to: C:/podofo-0.9.1/podofo-debug

C:\podofo-0.9.1\podofo-debug>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.