简体   繁体   中英

Cmake package not found

I've installed Drogon using vcpkg, and in my IDE I have following error: Package 'Drogon' not found. After installing, regenerate the CMake cache. Package 'Drogon' not found. After installing, regenerate the CMake cache.

I am using Visual Studio 2022

vcpkg_rf.txt:

install
drogon

CMakeLists.txt:

# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

project ("Drogon Server1")

# Include sub-projects.
add_subdirectory ("Drogon Server1")

# Line below is showing the error
find_package(Drogon CONFIG REQUIRED)
target_link_libraries("Drogon Server1" PRIVATE Drogon::Drogon)

I have found this error also:

CMake Error at C:/Users/MY_USERNAME/Documents/sdk/vcpkg/scripts/buildsystems/vcpkg.cmake:829 (_find_package):
  Could not find a package configuration file provided by "Drogon" with any
  of the following names:

    DrogonConfig.cmake
    drogon-config.cmake

  Add the installation prefix of "Drogon" to CMAKE_PREFIX_PATH or set
  "Drogon_DIR" to a directory containing one of the above files.  If "Drogon"
  provides a separate development package or SDK, be sure it has been
  installed.

Considering the given information:

Visual Studio 2022

-> Means CMake will default to x64 -> vcpkg will use VCPKG_TARGET_TRIPLET=x64-windows

vcpkg_rf.txt: install drogon

-> Means you use a response file to install drogon. Without specifying the triplet this is x86-windows

As such your triplet used by CMake and vcpkg doesn't agree. Consider using vcpkg in manifest mode by providing a vcpkg.json with the dependency instead of a response file. This way you won't have a discrepancy in your triplet selection

(As always chanigng this also requires to delete the cmake cache for a clean reconfigure. Furthermore don't have spaces in your target and paths; you are just asking for trouble.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM