When I try building the SquadOVNext repository, I get this error.
Severity Code Description Project File Line Suppression State
Error CMake Error at src/tools/process_screenshot/CMakeLists.txt:5 (target_link_libraries):
Target "process_screenshot" links to:
Boost::program_options
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing. C:\Users\PLACEHOLDER\Documents\GitHub\SquadOVNext\src/tools/process_screenshot/CMakeLists.txt 5
All the dependencies are installed, and it compiles until this line:
target_link_libraries(process_screenshot PRIVATE
libav
Boost::program_options
)
CodePudding user response:
This is not how you use vcpkg
. What instead you should do is set the CMAKE_TOOLCHAIN_FILE to point to vcpkg's toolchain, e.g.:
cmake -S../my/project -Bbuild -DCMAKE_TOOLCHAIN_FILE=[vcpkg-root]/scripts/buildsystems/vcpkg.cmake
Then you can use the find_package()
to find boost and use predefined variables for your linking and include folders. Take a look at find_package(Boost).
EDIT: by [vcpkg-root]
I mean the actual path to your vcpkg
.