#94 has brought in support for GPRT as a raytracing backend. However right now the way in which we link to GPRT at configuration time is not ideal.
When attempting to link gprt to xdg in the CMakeLists.txt, I was encountering a CMake error to do with GPRT not exporting install targets:
CMake Error: install(EXPORT "xdg-targets" ...) includes target "xdg" which requires target "gprt" that is not in any export set.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
This error would be thrown but CMake would still generate the Makefile and XDG could be compiled as normal with tests passing and installation still seemingly working.
As a work around for this CMake error I changed the following line in the CMakeLists.txt:
target_link_libraries(xdg gprt)
to:
target_link_libraries(xdg $<BUILD_INTERFACE:gprt>)
This ensures linking only happens at build time and not installation time. This is more of a workaround than a real fix and I am unsure if we will need GPRT to be linked at installation time as well as build time.
This is fine for executables built within the XDG CMake scope but I think it will result in issues when trying to build a downstream application (i.e OpenMC) using XDG with GPRT support. Ideally we should be able to just use target_link_libraries(xdg gprt) to ensure that libgprt is properly available even when dynamic linking.
I don't fully understand the problem at hand here but perhaps this is an issue that needs to be resolved at the GPRT level.
#94 has brought in support for GPRT as a raytracing backend. However right now the way in which we link to GPRT at configuration time is not ideal.
When attempting to link gprt to xdg in the CMakeLists.txt, I was encountering a CMake error to do with GPRT not exporting install targets:
As a work around for this CMake error I changed the following line in the CMakeLists.txt:
target_link_libraries(xdg gprt)to:
target_link_libraries(xdg $<BUILD_INTERFACE:gprt>)This ensures linking only happens at build time and not installation time. This is more of a workaround than a real fix and I am unsure if we will need GPRT to be linked at installation time as well as build time.
This is fine for executables built within the XDG CMake scope but I think it will result in issues when trying to build a downstream application (i.e OpenMC) using XDG with GPRT support. Ideally we should be able to just use
target_link_libraries(xdg gprt)to ensure thatlibgprtis properly available even when dynamic linking.I don't fully understand the problem at hand here but perhaps this is an issue that needs to be resolved at the GPRT level.