I have this code in CMake to find debug and release libraries for a project that I have:
FIND_LIBRARY(MP4V2_LIBRARY_RELEASE libmp4v2 HINTS "${MP4V2_DIR}/bin/Windows-x64/Release Static (MT)")
FIND_LIBRARY(MP4V2_LIBRARY_BEDUG libmp4v2 HINTS "${MP4V2_DIR}/bin/Windows-x64/Debug Static (MTd)")
set(MP4V2_LIBRARIES "optimized ${MP4V2_LIBRARY_RELEASE} debug ${MP4V2_LIBRARY_BEDUG}")
message(STATUS ${MP4V2_LIBRARIES})
and it is expanded correctly when I run CMake:
optimized D:/MyData/SourceCode/camm_mp4v2/bin/Windows-x64/Release Static (MT)/libmp4v2.lib debug D:/MyData/SourceCode/camm_mp4v2/bin/Windows-x64/Debug Static (MTd)/libmp4v2.lib
and I added it to my application like this:
target_link_libraries(MyApp ${MP4V2_LIBRARIES})
When I create project for VS and try to compile it, I am getting this error:
cannot open file 'optimized D:\MyData\SourceCode\camm_mp4v2\bin\Windows-x64\Release Static (MT)\libmp4v2.lib debug D:\MyData\SourceCode\camm_mp4v2\bin\Windows-x64\Debug Static (MTd)\libmp4v2.lib.lib'
Apparently, the optimized and debug library was not detected by CMake.
What is wrong with this code and how I can fix it?