Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: The following imported targets are referenced, but are missing #2370

Open
CheapMeow opened this issue Aug 30, 2024 · 3 comments
Open
Labels
question Further progress depends on answer from issue creator.

Comments

@CheapMeow
Copy link

CheapMeow commented Aug 30, 2024

Description

My build error

Preset CMake variables:

  CMAKE_BUILD_TYPE="Debug"
  CMAKE_CXX_COMPILER="g++"
  CMAKE_C_COMPILER="gcc"
  CMAKE_EXPORT_COMPILE_COMMANDS="ON"
  CMAKE_TOOLCHAIN_FILE="C:\src\vcpkg/scripts/buildsystems/vcpkg.cmake"
  VCPKG_TARGET_TRIPLET="x64-mingw-dynamic"

-- GLM: Version 1.0.2
-- GLM: Build with C++ features auto detection
-- Including Win32 support
volk: using Vulkan_INCLUDE_DIRS from FindVulkan module
CMake Error at C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package):
  Found package configuration file:

    C:/src/vcpkg/installed/x64-mingw-dynamic/share/spirv_cross_cpp/spirv_cross_cppConfig.cmake

  but it set spirv_cross_cpp_FOUND to FALSE so package "spirv_cross_cpp" is
  considered to be NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  spirv-cross-glsl

Call Stack (most recent call first):
  src/runtime/CMakeLists.txt:187 (find_package)


-- Configuring incomplete, errors occurred!
ninja: error: loading 'build.ninja': The system cannot find the file specified.

That is why? I follow everything that vcpkg need.

Build Config

My CMakeLists.txt

find_package(spirv_cross_core CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-core)

find_package(spirv_cross_cpp CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-cpp)

find_package(spirv_cross_glsl CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-glsl)

find_package(spirv_cross_hlsl CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-hlsl)

find_package(spirv_cross_msl CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-msl)

find_package(spirv_cross_reflect CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-reflect)

find_package(spirv_cross_util CONFIG REQUIRED)
target_link_libraries(${RUNTIME_NAME} PUBLIC spirv-cross-util)

my CMakePresets.json

    "configurePresets": [
        {
            "name": "debug",
            "displayName": "Debug Build with Ninja",
            "description": "Debug build using Ninja generator with GCC compiler and VCPKG toolchain.",
            "generator": "Ninja",
            "binaryDir": "${sourceDir}/build-debug",
            "cacheVariables": {
                "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
                "CMAKE_BUILD_TYPE": "Debug",
                "CMAKE_C_COMPILER": "gcc",
                "CMAKE_CXX_COMPILER": "g++",
                "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
                "VCPKG_TARGET_TRIPLET": "x64-mingw-dynamic"
            }
        },

build bat

@echo off

cls

REM Configure a debug build
cmake --preset=debug

cd build-debug

REM Actually build the binaries
ninja -j8 -d explain

cd ..

pause

Environment

vcpkg list

PS E:\repositories\MeowEngine> vcpkg list            
assimp:x64-mingw-dynamic                          5.4.2               The Open Asset import library
draco:x64-mingw-dynamic                           1.5.7               A library for compressing and decompressing 3D g...
jhasse-poly2tri:x64-mingw-dynamic                 2023-12-27          Sweep-line algorithm for constrained Delaunay tr...
kubazip:x64-mingw-dynamic                         0.2.6               A portable, simple zip library written in C
minizip:x64-mingw-dynamic                         1.3.1#1             Minizip zip file manipulation library
polyclipping:x64-mingw-dynamic                    6.4.2#12            The Clipper library performs clipping and offset...
pugixml:x64-mingw-dynamic                         1.14                Light-weight, simple and fast XML parser for C++...
rapidjson:x64-mingw-dynamic                       2023-07-17#1        A fast JSON parser/generator for C++ with both S...
spirv-cross:x64-mingw-dynamic                     1.3.290.0           SPIRV-Cross is a practical tool and library for ...
spirv-headers:x64-mingw-dynamic                   1.3.290.0           Machine-readable files for the SPIR-V Registry
stb:x64-mingw-dynamic                             2023-04-11#1        public domain header-only libraries
utfcpp:x64-mingw-dynamic                          4.0.5               UTF-8 with C++ in a Portable Way
vcpkg-cmake-config:x64-windows                    2024-05-23
vcpkg-cmake-get-vars:x64-windows                  2023-12-31
vcpkg-cmake:x64-windows                           2024-04-23
zlib:x64-mingw-dynamic                            1.3.1               A compression library

Platform: Windows11
cmake version 3.29.0-rc2
vcpkg package management program version 2024-08-01-fd884a0d390d12783076341bd43d77c3a6a15658

@HansKristian-Work
Copy link
Contributor

I don't know vcpkg, and I don't know how they package spirv-cross.
Is there a repro case without any external software dependencies outside of plain CMake and SPIRV-Cross repo?

@HansKristian-Work HansKristian-Work added the question Further progress depends on answer from issue creator. label Sep 2, 2024
@CheapMeow
Copy link
Author

I don't know vcpkg, and I don't know how they package spirv-cross. Is there a repro case without any external software dependencies outside of plain CMake and SPIRV-Cross repo?

If don't use vcpkg, I can use submodule and successfully compile.

@HansKristian-Work
Copy link
Contributor

Not sure what I can do then. I'll need someone to file a PR that fixes the issue in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further progress depends on answer from issue creator.
Projects
None yet
Development

No branches or pull requests

2 participants