If NUGET_EXCLUDE_VERSION=FALSE and VERSION of a PACKAGE entry in nuget_add_dependencies() changed, then find_package() does not respect the package directory change.
E.g. if flatbuffers comes from a "pack.vcpkg" NuGet package that you refer in a nuget_add_dependencies() call with version number 1.0.10, and you change this version to 1.0.11, you are going to get errors if your CMake cache has been already generated: the find_package(Flatbuffers CONFIG REQUIRED)
call caches directory locations, and if that directory path contains a version number, then it is going to become invalid. E.g. inside the CMakeCache file, under EXTERNAL cache entries, you might have:
Flatbuffers_DIR:PATH=C:/workspace/mylittleproject/packages/pack.vcpkg.1.0.10/installed/x64-windows/share/flatbuffers
This one becomes an invalid directory if you change the version to 1.0.11. All of the above is not a problem if you leave the NUGET_EXCLUDE_VERSION option to its default TRUE value as the nuget CLI does not add the version number to the directory name of the package during a nuget install if the -ExcludeVersion
option is provided.