You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set up a project according to this tutorial: https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vscode
Add SDL2 to the CMakeLists.txt
Example:
cmake_minimum_required(VERSION 3.0.0)
project(Project LANGUAGES C)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
add_executable(Project main.c)
target_link_libraries(Project ${SDL2_LIBRARIES})
Attempt to build (F7)
Failure logs
[build] CMake Error at build/vcpkg_installed/x64-linux/share/sdl2/SDL2staticTargets.cmake:104 (message):
[build] The imported target "SDL2::SDL2-static" references the file
[build]
[build] "/path/to/project/build/vcpkg_installed/debug/lib/libSDL2d.a"
[build]
[build] but this file does not exist. Possible reasons include:
[build]
[build] * The file was deleted, renamed, or moved to another location.
[build]
[build] * An install or uninstall procedure did not complete successfully.
[build]
[build] * The installation package was faulty and contained
[build]
[build] "/path/to/project/build/vcpkg_installed/x64-linux/share/sdl2/SDL2staticTargets.cmake"
[build]
[build] but not all the files it references.
[build]
[build] Call Stack (most recent call first):
[build] build/vcpkg_installed/x64-linux/share/sdl2/SDL2Config.cmake:56 (include)
[build] /usr/lib/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
[build] CMakeLists.txt:5 (find_package)
[build]
[build]
[build] ninja: error: rebuilding 'build.ninja': subcommand failed
[build] -- Configuring incomplete, errors occurred!
[build] See also "/path/to/project/build/CMakeFiles/CMakeOutput.log".
[build] FAILED: build.ninja
[build] /usr/bin/cmake --regenerate-during-build -S/path/to/project -B/path/to/project/build
[proc] The command: /usr/bin/cmake --build /path/to/project/build --parallel 10 exited with code: 1
[driver] Build completed: 00:00:01.355
[build] Build finished with exit code 1
Additional context
The issue seems to come from line 63 of SDL2staticTargets.cmake get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) (aka the third time this is run)
After this is run, it removes the triplet from the path breaking it (e.g. "build/vcpkg_installed/x64-linux" becomes "build/vcpkg_installed")
The text was updated successfully, but these errors were encountered:
Somehow fixed it not sure how
Anyone finding this later try moving your vcpkg directory, installing libsdl2-dev (and uninstalling after) and/or adding vcpkg/installed/x64-linux to your CMAKE_PREFIX_PATH if not using the manifest
Operating system
Linux Mint 21.3
Compiler
No response
Steps to reproduce the behavior
Failure logs
Additional context
The issue seems to come from line 63 of SDL2staticTargets.cmake
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
(aka the third time this is run)After this is run, it removes the triplet from the path breaking it (e.g. "build/vcpkg_installed/x64-linux" becomes "build/vcpkg_installed")
The text was updated successfully, but these errors were encountered: