Issue
I have two library binaries (debug an release) I need to point to the correct one when the user chooses between debug and release in VS. How do I in CMAKE instruct it to point to different directories. If I just use if statements only one will be set, but I need it to be done such that when I select between one or the other, the correct binary is selected and not that only debug or only release is set in the VS project.
Solution
You may add them to your target_link_libraries
command and prefix them with keywords optimized
for Release and debug
for Debug builds, e.g.
target_link_libraries(fancy_project PUBLIC optimized librelease.lib debug libdebug.lib)
See documentation of target_link_libraries for an explanation of those keywords.
Answered By - vre