p-ranav / argparse

Argument Parser for Modern C++
MIT License
2.59k stars 244 forks source link

CMake package configuration version check is too strict #371

Closed sergiud closed 1 month ago

sergiud commented 1 month ago

While updating from argparse 3.0 to 3.1 I encountered the following problem:

CMake Error at CMakeLists.txt:11 (find_package):
  Could not find a configuration file for package "argparse" that is
  compatible with requested version "3.0.0".

  The following configuration files were considered but not accepted:

    /usr/lib/cmake/argparse/argparseConfig.cmake, version: 3.1.0
    /lib/cmake/argparse/argparseConfig.cmake, version: 3.1.0

Is it intentional that minor versions are considered incompatible between each other? If not, this code

https://github.com/p-ranav/argparse/blob/68fd0277eea5412aff9b91c0b70efc698359dae0/CMakeLists.txt#L57-L60

should be updated to use either AnyNewerVersion or SameMajorVersion instead of ExactVersion as the COMPATIBILITY argument.

p-ranav commented 1 month ago

Is it intentional that minor versions are considered incompatible between each other?

No, this is not intentional. Agreed, should be fixed.