In nVidia's OpenGL sample code nvpro, does cmake variable X11_Xcursor_INCLUDE_PATH transmit include path of Xcursor to generated Makefile?

I’m trying to build OpenGL sample code in nVidia’s github repo on a remote ubuntu where I am only a normal user and therefore can’t use sudo apt-get install to install packages into system. The sample I’m trying to build is gl_cadscene_rendertechniques. At the cmake phase, it complains that it could not find Xcursor. I found that the complaint arose from line 177 of nvpro-samples/nvpro_core/third_party/glfw/CMakeLists.txt:

if (NOT X11_Xcursor_INCLUDE_PATH)

So, I installed Xcursor’s development package libxcursor-dev, among others, in my user space. Then I set the value of X11_Xcursor_INCLUDE_PATH to the path that contains Xcursor’s header X11/Xcursor/Xcursor.h, i.e., the parent directory of X11, by -D command-line option of cmake. After that, cmake finished successfully. At the make phase, however, I received an error

In file included from $HOME/nvpro-samples/nvpro_core/third_party/glfw/src/internal.h:188,
                 from $HOME/nvpro-samples/nvpro_core/third_party/glfw/src/context.c:30:
$HOME/nvpro-samples/nvpro_core/third_party/glfw/src/x11_platform.h:37:10: fatal error: X11/Xcursor/Xcursor.h: No such file or directory
   37 | #include <X11/Xcursor/Xcursor.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

My question is: since I have told cmake the directory containing the header X11/Xcursor/Xcursor.h via variable X11_Xcursor_INCLUDE_PATH, why can’t cmake set the gcc's -I option accordingly? Does the sample code attempt to form the -I option in generated Makefile using values in X11_Xcursor_INCLUDE_PATH variable? If so, did I miss anything in the cmake phase for this purpose?

PS, I know I can set environment variable to specify additional include path during make, but I just want to know if I can use the value of X11_Xcursor_INCLUDE_PATH variable set in cmake command line to specify this. Thanks.

Hi @hzhou3 ,

The corresponding CMakeLists.txt and the sources including XCursor that are causing you issues is actually a third party library. glfw is not a repository maintained by NVIDIA. That makes it a bit difficult for us to help.

That said, would you be able to share the Makefile generated by CMake? Maybe that will help shed some light. You should verify that the Makefile has an Include entry for the XCursor header directory. If it is there then it would rather be an issue with how the compiler searches the include paths. Having them in a user directory instead installed as proper dev headers should not cause a problem though.