vcpkg not working
trying to get vcpkg to work... I set it to compile with -DCMAKE_TOOLCHAIN_FILE=... but it still seems to not pick it up.
So... part of the problem is when I send the commands needed for vcpkg support in cmake -DCMAKE_TOOLCHAIN_FILE... For some reason cmake-js does not want to pass that along to cmake... I've worked around the issue by updating my local copy of cmake.js... might create a PR to add a new command for vcpkg support... will also need to do documentation etc... it's a big pain thats for sure.
if anyone has found another way to do this I'm all ears
@mupchurch-verys you should be able to do something like this at the top of your CMakeLists.txt
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
I am using this mechanism at https://github.com/japj/pa-opus-audio/blob/master/CMakeLists.txt#L4
Note that I followed this from a best practice as described at https://github.com/marketplace/actions/run-vcpkg#use-vcpkg-as-a-submodule-of-your-repository
I have the same issue. cmake don't find packages it's like CMAKE_TOOLCHAIN_FILE is ignore
@mupchurch-verys you need to call cmake-js compile --CDCMAKE_TOOLCHAIN_FILE="..."
@mupchurch-verys you need to call
cmake-js compile --CDCMAKE_TOOLCHAIN_FILE="..."
still not working...it's been a year
It works quite well for me.
@KaivnD have you tried it with something like this:
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
endif()
project(top-level-projeczt)
make sure, that the toolchain will get set before the very first project(...) call
@KaivnD have you tried it with something like this:
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake") endif() project(top-level-projeczt)make sure, that the toolchain will get set before the very first
project(...)call
Ok, I'll try it. But I think this way will mess my work director up. One of reason I choose vcpkg is I don't need add so many dependencies to my source code, to do so I need add vcpkg it self, that's wired, vcpkg don't have binary release, like nuget, perhaps I haven't totally get the vcpkg install way is more effective. Thanks anyway.
@KaivnD it's really common to add vcpkg as a submodule.
But if you have a local installation of vcpkg, you can pass it as a tool_chain_file, too.
If cmake-js compile --CDCMAKE_TOOLCHAIN_FILE="..." won't work for you, you can try to use
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${MY_TOOLCHAIN}")
endif()
project(top-level-project)
and call cmake-js with cmake-js compile --CDMY_TOOLCHAIN="<path_to_vcpkg>"