Question

I have a project which uses PoDoFo for PDF support and I am trying to update it to use the HEAD version from the SVN tree.

The big change from the last version I used is the addition on libcrypto from OpenSSL, which seems to be required. I downloaded and built OpenSSL and set up the appropriate options (or so I had hoped) so that cmake could find libcrypto.

cmake seems to find it ok, but when I try to build from the resulting makefile, I get the error:

Encrypt.cpp(50) : fatal error C1083: Cannot open include file: 'openssl/md5.h': No such file or directory

I whittled down my build script so that I could focus on this problem:

setlocal
set ROOT=%CD%
pushd podofo

set CMAKE_PARAMS=-Wno-dev -C ..\BuildSetup.cmake . -DCMAKE_INSTALL_PREFIX:PATH=%1
set CMAKE_PARAMS_RELEASE=-DCMAKE_BUILD_TYPE=Release %CMAKE_PARAMS%

call "%VS100COMNTOOLS%..\..\vc\vcvarsall.bat" x86
del CMakeCache.txt >nul
rd /s /q CMakeFiles >nul

set CMAKE_PREFIX_PATH=%ROOT%\install\zlib\x86
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROOT%\install\freetype\x86
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROOT%\install\libjpeg\x86
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROOT%\install\libpng\x86
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROOT%\install\openssl\x86
set CRYPTO=-DLIBCRYPTO_INCLUDE_DIR=%ROOT%\install\openssl\x86\include
set CRYPTO=%CRYPTO% -DLIBCRYPTO_LIBRARY_NAMES=libeay32

cmake %CRYPTO% %CMAKE_PARAMS_RELEASE%\x86 -G "NMake Makefiles"
cmake --build . --target install --clean-first

popd
endlocal

My BuildSetup.cmake file:

set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "config types" FORCE)
set (CMAKE_INSTALL_PREFIX "../install" CACHE PATH "install path" FORCE)

set (CMAKE_C_FLAGS_RELEASE "/MT /O1 /Ob2 /D NDEBUG" CACHE STRING "C release flags" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE "/MT /O1 /Ob2 /D NDEBUG" CACHE STRING "C++ release flags" FORCE)

set (CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1" CACHE STRING "C debug flags" FORCE)
set (CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1" CACHE STRING "C++ debug flags" FORCE)

set (BUILD_SHARED_LIBS OFF CACHE STRING "")

I tried explicitly adding the path of openssl/md5.h to the INCLUDE environment variable with no effect.

I also tried using the "Visual Studio 10" generator. Same problem.

Was it helpful?

Solution 2

StefanB's answer is correct. I needed to add the include path to get cmake to correctly build it. However, instead of manually hacking the project file (or makefile in my case), I used the CL environment variable to tell the compiler where to look for the OpenSSL headers. I added the command:

set CL=/I "%ROOT%\install\openssl\x86\include"

before running cmake and it built without errors.

OTHER TIPS

i just run into the same issue!

If you are building with VisualStudio, you have to add the openssl directory manually to the c++ include directories in the project properties of podofo.

in my case ..\openssl_vc10\include

then the build is successfull. dont have time atm to check why cmake dont set this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top