CMake: include header files in install directive #25

Open
besommer opened this Issue Aug 13, 2015 · 1 comment

Projects

None yet

1 participant

@besommer

Installing pbrt currently includes build binaries and the static library only. For compiling against pbrt library from other programs, we need the header files of pbrt.

Possible solution: change CMakeLists.txt s.t. all source header files located in ./src/ are copied to include/pbrt/ which preserves directory structure. This is done by appending

INSTALL ( DIRECTORY src/
  DESTINATION include/pbrt
  FILES_MATCHING PATTERN "*.h"
  )

to CMakeLists.txt. All relevant header files should be included. I locally extended it this way and it works. Further usage details: http://www.cmake.org/cmake/help/v3.2/command/install.html

@besommer

Maybe I should add the following: unless I am mistaken, I think that establishing pbrt as a library to link to (from programs other than pbrt) first requires solving

  1. name conflicts when including pbrt headers. solution: encapsulate pbrt in a namespace.
  2. some include files can not be found. I actually encountered this problem. solution: make include paths relative to the current file to a) help the compiler and b) make a unique solution in case of multiple files with identical file name but in different directories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment