I am creating a simple test c++ application which is using spdlog for logging.
I am using vcpkg as package manager and Ninja as generator and cmake.
My package is installed successfully inside my project directory under build folder but i think when the app is gonna be built i get an error which is related to Ninja, i suppose.
Here are my application files :
main.cpp :
#include <spdlog/spdlog.h>
int main()
{
spdlog::info("Test log");
}
CmakeLists.txt :
cmake_minimum_required(VERSION 3.28)
set(CMAKE_C_COMPILER "C:/MinGW/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/MinGW/bin/g++.exe")
project(TestApp)
find_package(spdlog REQUIRED)
add_executable(TestApp main.cpp)
target_link_libraries(TestApp PRIVATE spdlog::spdlog)
vcpkg.json :
{
"dependencies": [
"spdlog"
]
}
This is the command that i am executing :
cmake -G "Ninja" -S . -B build -DCMAKE_TOOLCHAIN_FILE="F:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake" -Ax64
And after those steps i get this error logs :
-- Running vcpkg install
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
* fmt:[email protected]#2
spdlog:[email protected]
* vcpkg-cmake:x64-windows@2024-04-18
* vcpkg-cmake-config:x64-windows@2022-02-06#1
Additional packages (*) will be modified to complete this operation.
Restored 4 package(s) from C:UsershAppDataLocalvcpkgarchives in 229 ms. Use --debug to see more details.
Installing 1/4 vcpkg-cmake-config:x64-windows@2022-02-06#1...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 3.73 ms
vcpkg-cmake-config:x64-windows package ABI: b8a712261e9443cd39bae6bd0028a3878a661e9bb28f295ecb0143e2805ca720
Installing 2/4 vcpkg-cmake:x64-windows@2024-04-18...
Elapsed time to handle vcpkg-cmake:x64-windows: 10.1 ms
vcpkg-cmake:x64-windows package ABI: ded1630d48dd1567df273733992025b1a68c3d340c5b7dc5cf54318797eeece7
Installing 3/4 fmt:[email protected]#2...
Elapsed time to handle fmt:x64-windows: 14.5 ms
fmt:x64-windows package ABI: 3607a46075b6242cdccdb9413170961d98be188a2868b3893b2eac2dbdaa1ca7
Installing 4/4 spdlog:[email protected]...
Elapsed time to handle spdlog:x64-windows: 36.6 ms
spdlog:x64-windows package ABI: 97c92ae564489470fbd5fab9bd9589c8ea993d43dfefbf7d4f8d8a536c811224
Total install time: 65.1 ms
The package spdlog provides CMake targets:
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(main PRIVATE spdlog::spdlog)
# Or use the header-only version
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(main PRIVATE spdlog::spdlog_header_only)
-- Running vcpkg install - done
CMake Error at CMakeLists.txt:6 (project):
Generator
Ninja
does not support platform specification, but platform
x64
was specified.
-- Configuring incomplete, errors occurred!
As you can see, my package is installed but i have problem on building (spdlog files are under build directory).
Notice :
I do not have any problem when i use Visual studio 17 2022 as generator.