How to link release and debug version of libtorch library with CMake?

Hi everybody,

i wrote some code using the libtorch library. For this I used the debug version of libtorch. I linked it with cmake as decribed on the tutorial page ‘using the c++ frontend’. Now, I want to bring my code to release version. How do I link both the debug and the release version of the library via CMake so that the correct library is used for the particular purpose? As we set the CMAKE_PREFIX_PATH where the library is saved, there may be an opportunity to set one or two CMake variables to the two different library paths with kind of a flag wich one should be used for debugging or release mode. Do you have any suggestions?

I found this thread on a popular website but I don’t know how to deal with this problem according to libtorch, because there is only one variable TORCH in the config files.