totakke/homebrew-openni2

CMake can't find OPENNI2_LIBRARY and OPENNI2_INCLUDE_DIR

Closed this issue · 7 comments

I'm compiling RGBdemo and nestk with CMake (OS X 10.8.4 FWIW), which has a dependency on openni (which I got through the ZigFu plugin installer) and openni2 (which I'm trying to get through your formula). CMake can find the former, but not the latter. Here's the error dump:

-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.dylib)
CMake Error at /usr/local/Cellar/cmake/2.8.11.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/2.8.11.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  nestk/cmake/FindOpenNI2.cmake:39 (find_package_handle_standard_args)
  nestk/cmake/find_nestk_deps.cmake:107 (FIND_PACKAGE)
  nestk/UseEmbeddedNestk.cmake:23 (INCLUDE)
  nestk/CMakeLists.txt:67 (INCLUDE)

Is this a case of the formula not adding OPENNI2_LIBRARY and OPENNI2_INCLUDE_DIR to the path?

This formula doesn't add OPENNI2_LIBRARY and OPENNI2_INCLUDE_DIR.
Maybe they are options for RGBDemo Cmake.

I recommend adding the following official envs to your .bash_profile.

export OPENNI2_INCLUDE=/usr/local/include/ni2
export OPENNI2_REDIST=/usr/local/lib/ni2

And run CMake with the options.

$ cmake -DOPENNI2_LIBRARY=$OPENNI2_REDIST -DOPENNI2_INCLUDE_DIR=$OPENNI2_INCLUDE

Cool, thanks for clarifying that

I have got the same problem. But, there are no ni2 folders in /usr ... there is /nite in the include ... but not in the /lib directory for adding to the OPENNI2_REDIST .. besides, where do I run the CMake? (anywhere) ... sorry for silly questions. I'm just a beginner for all these.

Sorry for another quick question. The previous problem is fixed somehow when I installed openni-dev, but when I run ./linux_build.sh afterwards, it says ...

make: *** No targets specified and no makefile found. Stop.

There is the makefile in the directory. But, it keep saying there is no makefile found. Any suggestions? Thanks.

Specifying the full path to the dylib file makes CMake find the openni2 files.

export OPENNI2_INCLUDE=/usr/local/include/ni2
export OPENNI2_REDIST=/usr/local/lib/ni2/libOpenNI2.dylib

$ cmake -DOPENNI2_LIBRARY=$OPENNI2_REDIST -DOPENNI2_INCLUDE_DIR=$OPENNI2_INCLUDE

When I install OpenNI2 the installer does not place the lib files in the usr/lib nor in usr/local/lib. Does anybody know how to solve this?

Please help. Thanks in advance.

If it goes to local it means you installed from source. Try to use the binary installation. @josuerocha