问题描述
尝试了两天我能用Google搜索的一切。这是CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.0)
project(main VERSION 0.1.0)
set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake")
include(CTest)
enable_testing()
find_package(SDL2 CONfig required)
add_executable(main main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
target_link_libraries(main PRIVATE SDL2::SDL2 SDL2::SDL2main)
以下是输出:
[main] Building folder: Example
[main] Configuring folder: Example
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\g++.exe" -Hc:/Users/tausciam/Desktop/Programming/Example -Bc:/Users/tausciam/Desktop/Programming/Example/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):
[rollbar] Unhandled exception: Unhandled exception: Processing "data" event from proc stderr TypeError: message must be set {"data":{"type":"Buffer","data":[67,77,97,107,101,32,69,114,111,116,67,58,47,118,99,112,103,105,110,115,108,100,120,54,52,45,119,104,50,109,46,49,40,95,102,41,10,117,34,83,68,76,98,113,84,44,48,10]},"command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","args":["--no-warn-unused-cli","-DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gcc.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe","-Hc:/Users/tausciam/Desktop/Programming/Example","-Bc:/Users/tausciam/Desktop/Programming/Example/build","-G","MinGW Makefiles"]}
[cmake] -- Configuring incomplete,errors occurred!
[cmake] See also "C:/Users/tausciam/Desktop/Programming/Example/build/CMakeFiles/CMakeOutput.log".
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):
[rollbar] Unhandled exception: Unhandled exception: Processing "data" event from proc stderr TypeError: message must be set {"data":{"type":"Buffer",121,56,"MinGW Makefiles"]}
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):
[rollbar] Unhandled exception: Unhandled exception: Resolving process on "close" event TypeError: message must be set {"line_acc":"","stderr_line_acc":"CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):","retc":1}
[ctest] There was an error running ctest to determine available test executables
我确实运行了。\ vcpkg集成安装,该库似乎在带有MSBUILD的Visual Studio 2019中正常工作。