Skip to content

missing cmake package version file (can't use cmake package versioning) #882

Description

GSL is missing the cmake package version file. Therefore it is not possible in cmake to use package version checking as in find_package(Microsoft.GSL 3.0.1 CONFIG REQUIRED)

Repro (using vcpkg for ease)

  1. Setup a working vcpkg with VS2019, e.g. using your instructions at https://github.com/microsoft/gsl#building-gsl---using-vcpkg
  2. vcpkg install ms-gsl
  3. Create your app's CMakeLists.txt with the needed toolchain file
  4. Add to that CMakeLists.txt the following: find_package(Microsoft.GSL 3.0.1 CONFIG REQUIRED)

Result

[cmake] CMake Error at C:/njs/vcpkg/scripts/buildsystems/vcpkg.cmake:329 (_find_package):
[cmake]   Could not find a configuration file for package "Microsoft.GSL" that is
[cmake]   compatible with requested version "3.0.1".
[cmake] 
[cmake]   The following configuration files were considered but not accepted:
[cmake] 
[cmake]     C:/njs/vcpkg/installed/x64-windows-static-md-v142-sdk81/share/Microsoft.GSL/Microsoft.GSLConfig.cmake, version: unknown
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:164 (find_package)
[cmake] -- Configuring incomplete, errors occurred!```

Expected

No errors and a later successful compile using the GSL library.

Solution

Add package versioning information to the port as described in official cmake docs https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#package-version-file

Notes

No reasonable alternative other than to remove package version in find_package(). Otherwise, the alternative is to implement what is already built into cmake.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions