2

Been trying two days everything I can google. Here is the 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)

Here is the output:

[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,114,111,114,32,97,116,32,67,58,47,118,99,112,107,103,47,105,110,115,116,97,108,108,101,100,47,120,54,52,45,119,105,110,100,111,119,115,47,115,104,97,114,101,47,115,100,108,50,47,118,99,112,107,103,45,99,109,97,107,101,45,119,114,97,112,112,101,114,46,99,109,97,107,101,58,49,32,40,95,102,105,110,100,95,112,97,99,107,97,103,101,41,58,10,32,32,67,111,117,108,100,32,110,111,116,32,102,105,110,100,32,97,32,99,111,110,102,105,103,117,114,97,116,105,111,110,32,102,105,108,101,32,102,111,114,32,112,97,99,107,97,103,101,32,34,83,68,76,50,34,32,116,104,97,116,32,105,115,32,99,111,109,112,97,116,105,98,108,101,10,32,32,119,105,116,104,32,114,101,113,117,101,115,116,101,100,32,118,101,114,115,105,111,110,32,34,34,46,10,10,32,32,84,104,101,32,102,111,108,108,111,119,105,110,103,32,99,111,110,102,105,103,117,114,97,116,105,111,110,32,102,105,108,101,115,32,119,101,114,101,32,99,111,110,115,105,100,101,114,101,100,32,98,117,116,32,110,111,116,32,97,99,99,101,112,116,101,100,58,10,10,32,32,32,32,67,58,47,118,99,112,107,103,47,105,110,115,116,97,108,108,101,100,47,120,54,52,45,119,105,110,100,111,119,115,47,115,104,97,114,101,47,115,100,108,50,47,83,68,76,50,67,111,110,102,105,103,46,99,109,97,107,101,44,32,118,101,114,115,105,111,110,58,32,50,46,48,46,49,50,32,40,54,52,98,105,116,41,10,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","data":[67,97,108,108,32,83,116,97,99,107,32,40,109,111,115,116,32,114,101,99,101,110,116,32,99,97,108,108,32,102,105,114,115,116,41,58,10,32,32,67,58,47,118,99,112,107,103,47,115,99,114,105,112,116,115,47,98,117,105,108,100,115,121,115,116,101,109,115,47,118,99,112,107,103,46,99,109,97,107,101,58,52,52,52,32,40,105,110,99,108,117,100,101,41,10,32,32,67,77,97,107,101,76,105,115,116,115,46,116,120,116,58,56,32,40,102,105,110,100,95,112,97,99,107,97,103,101,41,10,10,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] 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):","command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","retc":1}
[ctest] There was an error running ctest to determine available test executables

I did run the .\vcpkg integrate install and the library does seem to work in Visual Studio 2019 with MSBUILD.

  • Did you build your vcpkg tree using mingw? MSVC binaries will not work. – drescherjm Sep 12 '20 at 02:11
  • That's probably it then. I'll have to look up to see how to build it with mingw. Thanks –  Sep 12 '20 at 02:25
  • At least for SDL2, the wiki states "On Windows, SDL does not depend on a C runtime at all, not even for malloc(). This means it's possible to build SDL with almost any Windows compiler and have it work with a program built with any other." –  Sep 12 '20 at 04:46

1 Answers1

0

I believe the unhelpful error message you are seeing is unrelated to the actual issue with your CMake configuration.

There is an open, recent issue here and here.

Please try running cmake . in your build directory in the terminal in order to configure outside of VS code. This may give you a more helpful error message.

Panda
  • 690
  • 1
  • 6
  • 19
  • I'm not sure what the problem is. I even recompiled the sdl2 package with mingw32 just in case. I still had issues. However, I recompiled SDL2 by hand from the source outside of vcpkg and the cmake above worked with it (I deleted the cmake toolchain line of course) So, I suspect it has something to do with vcpkg's port of SDL2 –  Sep 15 '20 at 16:27