Configuring error with vcpkg
See original GitHub issueBrief Issue Summary
I’m using vcpkg to import a logging library (spdlog) with cmake 3.18.0, using this extension, cmake tools.
I followed all the steps in here, successfully downloaded the library I required with the command vcpkg install spdlog
and added the command-line argument specified here in the settings.json file like this:
"cmake.configureArgs": [
"-CMAKE_TOOLCHAIN_FILE:FILEPATH=\"${workspaceFolder}\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake\""
],
And my CMakeLists.txt file looks like this:
cmake_minimum_required(VERSION 3.18.0)
project("Ampoule" VERSION 1.0.0)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp *.h)
find_package(spdlog CONFIG REQUIRED)
add_executable(ampoule ${SOURCE_FILES})
target_link_libraries(main PRIVATE spdlog::spdlog spdlog::spdlog_header_only)
But I’m having an issue while loading the toolchain file (the one specified in the configureArgs) and the configuration fails because cmake is not able to find the package ‘spdlog’ since the vcpkg.make file, the one passed with the -CMAKE_TOOLCHAIN_FILE, fails to load.
Expected:
The project configures successfully and I’m able to #include the library sources into my source code
Apparent Behavior:
The project configuring fails since it is not able to find the package ‘spdlog’
CMake Tools log
The result when configuring (saving the CMakeLists.txt file) is the following:
[main] Configuring folder: Ampoule
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -CMAKE_TOOLCHAIN_FILE:FILEPATH="c:\Users\seriv\Documents\OneDrive\Ampoule\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\MinGW\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\MinGW\bin\g++.exe -Hc:/Users/seriv/Documents/OneDrive/Ampoule -Bc:/Users/seriv/Documents/OneDrive/Ampoule/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] loading initial cache file MAKE_TOOLCHAIN_FILE:FILEPATH="c:\Users\seriv\Documents\OneDrive\Ampoule\vcpkg\scripts\buildsystems\vcpkg.cmake"
[cmake] CMake Error: Error processing file: C:/Users/d4n1_/AppData/Local/Programs/Microsoft VS Code/MAKE_TOOLCHAIN_FILE:FILEPATH="c:/Users/seriv/Documents/OneDrive/Ampoule/vcpkg/scripts/buildsystems/vcpkg.cmake"
[cmake] CMake Error at CMakeLists.txt:6 (find_package):
[cmake] Could not find a package configuration file provided by "spdlog" with any
[cmake] of the following names:
[cmake]
[cmake] spdlogConfig.cmake
[cmake] spdlog-config.cmake
[cmake]
[cmake] Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
[cmake] "spdlog_DIR" to a directory containing one of the above files. If "spdlog"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
Notice these two lines, where the file starts loading:
[cmake] loading initial cache file MAKE_TOOLCHAIN_FILE:FILEPATH="c:\Users\seriv\Documents\OneDrive\Ampoule\vcpkg\scripts\buildsystems\vcpkg.cmake"
And when it errors:
[cmake] CMake Error: Error processing file: C:/Users/d4n1_/AppData/Local/Programs/Microsoft VS Code/MAKE_TOOLCHAIN_FILE:FILEPATH="c:/Users/seriv/Documents/OneDrive/Ampoule/vcpkg/scripts/buildsystems/vcpkg.cmake"
The path in the last one looks a bit different and weird.
Platform and Versions
- Operating System: Windows 10
- CMake Version: 3.18.0
- VSCode Version: 1.47.2
- CMake Tools Extension Version: 1.4.1
- Compiler/Toolchain: GCC 6.3.0 via MINGW-64
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Such as : ctrl + shift + p -> CMake : Edit User-Local CMake Kits { “name”: “my tool chain by toolchain file.”, “toolchainFile”: “c:\Users\seriv\Documents\OneDrive\Ampoule\vcpkg\scripts\buildsystems\vcpkg.cmake” }
@serivesmejia Hi, do you try it by command line?