Skip to content

BasicConfigVersion and architecture-independent projects

The BasicConfigVersion templates include a section that tries to determine whether the architecture of the project calling find_package matches the architecture that the package to be found was built for. There are two problems with this:

  1. This architecture check is not documented in the CMakePackageConfigHelpers documentation. The documentation for write_basic_package_version_file does mention the BasicConfigVersion templates, but does not explicitly state that architecture is being tied to the version check (at least not in version 3.5.2 that I have installed.)
  2. Not all C++ projects are architecture dependent, so this check can lead to breakage in some cases. For example, a header-only template library like eigen3 can be shared between 32 and 64 bit projects.

I propose that the documentation be updated to explicitly state that CMake is testing for version AND architecture with the BasicConfigVersion templates. I also recommend that write_basic_package_version_file be updated so that the architecture check can be disabled by a project that does not require it. Projects can make copies of the BasicConfigVersion templates and remove the architecture check as a work-around, but I think it would be worthwhile to make it a supported option.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information