Skip to content

CMake find_package() version mismatch #118

Closed

Description

@mablanchard

Building cpp_features 0.4.1 on both Linux and Windows, the CMake generated configuration script report a 0.1.0 package version, producing errors like:

  Could not find a configuration file for package "CpuFeatures" that exactly
  matches requested version "0.4.1".

  The following configuration files were considered but not accepted:

    .../lib/cmake/CpuFeatures/CpuFeaturesConfig.cmake, version: 0.1.0

Having a look at at CpuFeaturesConfigVersion.cmake, it feels like PACKAGE_VERSION isn't matching the project's version:

set(PACKAGE_VERSION "0.1.0")

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

  if("0.1.0" MATCHES "^([0-9]+)\\.")
    set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
  else()
    set(CVF_VERSION_MAJOR "0.1.0")
  endif()

  if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
    set(PACKAGE_VERSION_COMPATIBLE TRUE)
  else()
    set(PACKAGE_VERSION_COMPATIBLE FALSE)
  endif()

  if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
      set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()

Activity

  1. Mizux commented on May 20, 2020

    @Mizux
    Collaborator

    simply the project version has never been updated...

    project(CpuFeatures VERSION 0.1.0 LANGUAGES C)

  2. added
    bug
    on Sep 21, 2020
  3. added this to the Release v0.5.0 milestone on Sep 21, 2020
  4. gchatelet commented on Sep 21, 2020

    @gchatelet
    Collaborator

    @Mizux can I ask you to sen a PR to update to 0.5.0?

  5. added a commit that references this issue on Sep 21, 2020
    ad6f635
  6. mablanchard commented on Sep 21, 2020

    @mablanchard
    Author

    Many thanks!

  7. added a commit that references this issue on Feb 18, 2024
    4efc837
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions