Comments (5)
Possible solutions:
- Do not set NUGET_EXCLUDE_VERSION option to FALSE (default value is TRUE); or
- Wipe out your CMake cache, and run CMake cache generation/configure again; or
- Unset cache variables set by find_package calls if the corresponding package version has been changed.
From the user's perspective, a convenient approach can be the following for unsetting the appropriate cache variables. One can extend the nuget_add_dependencies() syntax with something like this:
nuget_add_dependencies(
PACKAGE flatbuffers.x64-windows.vcpkg-export
VERSION 1.11.0
CMAKE_PREFIX_PATHS installed/x64-windows
ON_VERSION_CHANGED
UNSET_CACHE_PREFIXES "Flatbuffers_"
)
#...
find_package(Flatbuffers CONFIG REQUIRED)
Cache variables that have the "Flatbuffers_" prefix in their names would be unset only if the VERSION number of the package has been actually changed. (We would not be able to catch the version number change if the CMake cache has not been generated, but the original issue would not exist either then.) Then, the find_package(Flatbuffers CONFIG REQUIRED)
call is going to repopulate the unset variables properly with new valid values.
from cmakenugettools.
Note: also mind our newer CMAKE_TOOLCHAIN_FILE argument for nuget_add_dependencies(). That one needs to be tidied up anyway with better checks detecting misuse (e.g. calls after project commands). I need to think this through.
from cmakenugettools.
I'll probably mark the NUGET_EXCLUDE_VERSION option as advanced, add some comments that you should only set it to FALSE if you really know what you are doing, and do not bother implementing anything like 3. in the above. It does not worth the coding effort; it just demands from the user to write more arguments that ideally should not be necessary at all; it makes your CMakeLists.txt more intertwined in a way. Simpler is better.
If there is a use-case where you cannot really avoid versioned NuGet package install directories in case of nuget_add_dependencies(), then I might reopen this issue. I currently do not see a reasonable use-case now. We do not allow to have multiple versions of the same NuGet package ID in a CMake project anyway. (Maybe if you have a common packages directory outside your project directory shared by many projects, and those separate projects want to use different versions of a package... I am not sure. Sounds like an edge case.)
from cmakenugettools.
Marked NUGET_EXCLUDE_VERSION as advanced.
from cmakenugettools.
Mind new NUGET_AUTO_UNSET_CACHE_VARS_WHEN_PACKAGE_DIR_CHANGED advanced setting set to default OFF as default behaviour sets NUGET_EXCLUDE_VERSION to ON meaning after a package version update the NuGet package directory path itself does not change. If you set the advanced NUGET_EXCLUDE_VERSION setting to OFF, you are most probably going to need NUGET_AUTO_UNSET_CACHE_VARS_WHEN_PACKAGE_DIR_CHANGED set to ON if you do not want to delete your CMake cache after every NuGet package version change in your nuget_add_dependencies() calls.
from cmakenugettools.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmakenugettools.