RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.77k stars 164 forks source link

cmake add_subdirectory issues #8

Closed nobledemon closed 5 years ago

nobledemon commented 5 years ago

Hello,

context: I'm not entirely sure this is a legitimate issue, since I'm not doing what is explicitly said on your README.md, I'm trying to use your library with cmake using add_subdirectory, I'm not sure if this way of linking the project is intended to be supported. Also, I'm on windows using the commandline( not sure if this is relevant but I'm not trying to use cmake-gui)

error: when including the project with add_subdirectory, I get the following error:

CMake Error at external/oidn/CMakeLists.txt:55 (include): include could not find load file: package

temporary fix? I can solve these errors by replacing all the includes on your CMakeLists.txt, for example:

include(${CMAKE_CURRENT_LIST_DIR}/cmake/install.cmake)

and then all problems seem to be solved. I have the gut feeling that my lack of knowledge about cmake might be the problem here, is there something special to do before using add_subdirectory on your project? I hope this is not way too unrelated to your project, feel free to dismiss me if you feel that's the case, thanks for your time.

guerarda commented 5 years ago

Hi,

I'm no CMake expert either but this can be fixed by modifying the line CMakeList.txt:32 and use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR.

nobledemon commented 5 years ago

In the end I used the Install target and it worked like a charm (which means, the regular amount of guesswork needed to make any cmake project work). Not sure if this should remain opened. Thanks for your time.

atafra commented 5 years ago

This is now fixed in the devel branch and will be included in the next release. The include directory is also automatically added, so only the following is needed:

add_subdirectory(oidn)
target_link_libraries(${PROJECT_NAME} OpenImageDenoise)