I am writing a minimal Find*.cmake for OpenNI. To find the header files I wrote
find_path(OPENNI_INCLUDE_PATH XnOS.h)
which is working as expected (OPENNI_INCLUDE_PATH has the value /usr/include/ni). However, in my files I have to include the headers with
#include <ni/XnOS.h>
How can I get rid of the ni prefix, so I can write
#include <XnOS.h>
The problem with the first include is that a XnCppWrapper.h gets included and this file includes again some Xn*.h headers, but without the ni prefix. This results in a compiler error.
Always have the path you use for find_path
match the one in your #include
statements.
If you want to #include <ni/XnOS.h>
you should write
find_path(OPENNI_INCLUDE_PATH ni/XnOS.h)
If instead you want to #include <XnOS.h>
, use
find_path(OPENNI_INCLUDE_PATH XnOS.h)
Just be sure to make up your mind beforehand which one you want to use and stick to it. Mixing several include paths for the same library is a sure way to unnecessarily overcomplicate the build environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With