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 #1721

Closed
jelizaga3-gatech opened this issue Aug 22, 2019 · 4 comments
Closed

Comments

@jelizaga3-gatech
Copy link

  • What is the issue you have?
    cmake find-package is not correctly finding the nlohmann_json package installed from vcpkg

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

  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)
    
  • What is the expected behavior?
    CMake finds package.

  • And what is the actual behavior instead?

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)
  • Which compiler and operating system are you using? Is it a supported compiler?
    Clang I think, on a Windows 10 machine x64
    C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe

  • Did you use a released version of the library or the version from the develop branch?

Released version 3.7.0 - https://github.com/nlohmann/json/tree/v3.7.0

@jelizaga3-gatech
Copy link
Author

jelizaga3-gatech commented Aug 22, 2019

It returns the same thing for this in CMake, as well

set(CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/../vcpkg-2019.07/packages/nlohmann-json_x86-windows/share/nlohmann_json;${CMAKE_PREFIX_PATH}")

I set these paths because CMake tells me to.
nlohmann_json_DIR-NOTFOUND:

1>   By not providing "Findnlohmann_json.cmake" in CMAKE_MODULE_PATH this
1>   project has asked CMake to find a package configuration file provided by
1>   "nlohmann_json", but CMake did not find one.
1> 
1>   Could not find a package configuration file provided by "nlohmann_json"
1>   (requested version 3.7.0) with any of the following names:
1> 
1>     nlohmann_jsonConfig.cmake
1>     nlohmann_json-config.cmake
1> 
1>   Add the installation prefix of "nlohmann_json" to CMAKE_PREFIX_PATH or set
1>   "nlohmann_json_DIR" to a directory containing one of the above files.  If
1>   "nlohmann_json" provides a separate development package or SDK, be sure it
1>   has been installed.
1> 

@jelizaga3-gatech
Copy link
Author

jelizaga3-gatech commented Aug 22, 2019

This is also included in my CMakeLists

cmake_minimum_required (VERSION 3.12) 

project(FMSAirSDK VERSION 0.1 LANGUAGES CXX)

set_property(GLOBAL PROPERTY CXX_STANDARD 17)

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
endif(MSVC)

@nlohmann
Copy link
Owner

This seems to be a vcpkg issue. Could you file your issue here: https://github.com/Microsoft/vcpkg/issues ?

@nlohmann
Copy link
Owner

nlohmann commented Sep 2, 2019

Can this issue be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants