cmake vs. opencv
Ryan Schmidt
ryandesign at macports.org
Tue Jun 12 04:08:13 PDT 2012
> On Jun 12, 2012 (Tuesday), at 2:57 AM, Ryan Schmidt wrote:
>
>> On Jun 11, 2012, at 14:05, Petr Vanek wrote:
>>
>>> hi all,
>>>
>>> I'm facing really strange issue. App I want to pack for macports uses cmake for building and OpenCV as a runtime/build dependency.
>>>
>>> OpenCV is handled by pkg-config in CMakeLists.txt. But the OpenCV_LIBRARIES variable is always empty.
>>>
>>> Here is a minimal example for CMakeLists.txt:
>>> ######
>>> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
>>>
>>> project(test)
>>>
>>> find_package(PkgConfig)
>>>
>>> pkg_check_modules(OpenCV opencv>=2.1.0)
>>> pkg_check_modules(Zlib zlib>=1.0)
>>>
>>> get_cmake_property(_variableNames VARIABLES)
>>> foreach (_variableName ${_variableNames})
>>> message(STATUS "${_variableName}=${${_variableName}}")
>>> endforeach()
>>> ######
>>>
>>> The zlib is there for reference (correctly filled).
>>> So what can be wrong? Cmake or OpenCV pkg-config file?
>>
>> Can you show us the Portfile you're working on?
Thanks for sending me the Portfile. I see the configure phase fails with this message:
> CMake Error at CMakeLists.txt:165 (find_package):
> By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
> asked CMake to find a package configuration file provided by "OpenCV", but
> CMake did not find one.
>
> Could not find a package configuration file provided by "OpenCV" (requested
> version 2.1.0) with any of the following names:
>
> OpenCVConfig.cmake
> opencv-config.cmake
>
> Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
> "OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
> provides a separate development package or SDK, be sure it has been
> installed.
So I used "port contents opencv" to discover that it installs the file /opt/local/lib/cmake/OpenCVConfig.cmake. Therefore I modified your Portfile and added "-DOpenCV_DIR=${prefix}/lib/cmake" to the configure.args. That allowed it to get through the configure phase, but it failed during the build phase with "error: #if with no expression".
More information about the macports-dev
mailing list