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 not correctly finding the configuration package for 3.7.0 #7939

Closed
jelizaga3-gatech opened this issue Aug 28, 2019 · 4 comments
Closed
Assignees
Labels
category:question This issue is a question

Comments

@jelizaga3-gatech
Copy link

Describe the bug
cmake find-package is not correctly finding the nlohmann_json package installed from vcpkg

Environment

  • OS: Windows 10
  • Compiler: Clang I think, on a Windows 10 machine x64

The Clang file was located here, I used VS + CMake:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe

To Reproduce
Steps to reproduce the behavior:

  1. Run vcpkg search nlohmann-json
    Response: vcpkg-2019.07>vcpkg search nlohmann-json

    nlohmann-json 3.7.0 JSON for Modern C++

1a. Install vcpkg. vcpkg.exe install nlohmann-json

  1. vcpkg installs to vcpkg-2019.07\packages\nlohmann-json_x86-windows

  2. Use find_package in CMakeLists.txt in project

     # CMakeLists.txt
    set(nlohmann_json_DIR ${PROJECT_SOURCE_DIR}/../vcpkg-2019.07/packages/nlohmann- 
    json_x86-windows/share/nlohmann_json)
    find_package(nlohmann_json 3.7.0 REQUIRED)
    

Expected behavior
CMake finds package.

Failure logs

1> CMake Error at ${PROJECT_SOURCE_DIR}\CMakeLists.txt:17 (find_package):
1>   Could not find a configuration file for package "nlohmann_json" that is
1>   compatible with requested version "3.7.0".
1> 
1>   The following configuration files were considered but not accepted:
1> 
1>     ${PROJECT_SOURCE_DIR}/../vcpkg-2019.07/packages/nlohmann-json_x86-windows/share/nlohmann_json/nlohmann_jsonConfig.cmake, version: 3.7.0 (32bit)

Additional context
Link to release:
Released version 3.7.0 - https://github.com/nlohmann/json/tree/v3.7.0

Referenced here: nlohmann/json#1721 was told to create a ticket here.

@AlvinZhangH AlvinZhangH added the category:question This issue is a question label Aug 28, 2019
@JackBoosY JackBoosY reopened this Sep 9, 2019
@microsoft microsoft deleted a comment from AlvinZhangH Sep 9, 2019
@JackBoosY JackBoosY self-assigned this Sep 9, 2019
@JackBoosY
Copy link
Contributor

JackBoosY commented Sep 9, 2019

Hi @jelizaga3-gatech, you need to run .\vcpkg.exe integrate install and add -DCMAKE_TOOLCHAIN_FILE=YOUR_VCPKG_PATH/scripts/buildsystems/vcpkg.cmake to the cmake parameter.

See documentation.

Thanks.

@JackBoosY
Copy link
Contributor

Does this issue still bother you?

@SeanOMik
Copy link

SeanOMik commented Jan 1, 2020

No, it was a while ago but I remember that it kind of just fixed itself after I removed the find_package. And it somehow did link with it just the find_package was the thing that broke it for some reason.

@JackBoosY
Copy link
Contributor

If this issue is still not resolved, please reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

4 participants