I want to use DirectXTK via vcpkg and link it with my cmake project.
vcpkg.exe list
shows the following:
directxtk:x86-windows apr2021 A collection of helper classes for writing Direc...
directxtk:x86-windows-static-md apr2021 A collection of helper classes for writing Direc...
libzip:x86-windows 1.7.3#2 A library for reading, creating, and modifying z...
libzip:x86-windows-static-md 1.7.3#2 A library for reading, creating, and modifying z...
zlib:x86-windows 1.2.11#10 A compression library
zlib:x86-windows-static-md 1.2.11#10 A compression library
[dependnencies from these are not included here]
You can see that DirectXTK,libzip and zlib is installed.
Now my CMakeLists.txt
looks like this:
find_package(ZLIB REQUIRED)
target_link_libraries(Game PRIVATE ZLIB::ZLIB)
if(WIN32)
find_package(directxtk CONFIG REQUIRED)
target_link_libraries(Game PRIVATE DirectXTK)
endif()
find_package(libzip REQUIRED)
target_link_libraries(Game PRIVATE libzip)
When I try to compile my project, it says
fatal error LNK1104: cannot open file 'DirectXTK.lib'
fatal error LNK1104: cannot open file 'libzip.lib'
It can't find the lib files for DirectXTK
and libzip
when linking.
It compiles fine though, which means it can find zlib.h
and DirectXTK/WICTextureLoader
for example.
How am I supposed to fix that?
The cmake Toolchain is correctly set to vcpkg.cmake
and I used vcpkg.exe integrate install
prior.