Comments (4)
Yes, this is on my list -- mosra/magnum#453.
I feel your pain, I just didn't have the courage to start yet because the downstream breakages will be serious if I don't provide backwards compatibility... and it won't really solve the name collisions if I provide backwards compatibility.
from corrade.
You could keep the existing option names with the following strategy:
- Create a new option CORRADE_DISABLE_CMAKE_BACKCOMPAT, or similar, default to ON.
- If CORRADE_DISABLE_CMAKE_BACKCOMPAT is not set to OFF, then 3.
- if 2, then for each existing option, if the CORRADE_ version is not set, then
set(CORRADE_${optname} ${optname})
This would allow projects that understand the new symbols names to not have conflicts, and projects that do not understand them keep the existing behavior.
Then some day in the future, you change the default of CORRADE_DISABLE_CMAKE_BACKCOMPAT from ON to OFF, and eventually remove it and the old names.
from corrade.
Hm, I actually had a similar idea before but there were some loose ends:
- There's now a
BUILD_DEPRECATED
option (enabled by default), which would becomeCORRADE_BUILD_DEPRECATED
(enabled by default). - If
CORRADE_BUILD_DEPRECATED
is enabled, the old unprefixed names are still recognized, but with a deprecation warning.BUILD_DEPRECATED
doesn't affect this. - Projects that disable only
BUILD_DEPRECATED
would still have the old unprefixed names recognized (because otherwise everything would break for everyone) - Projects that disable
CORRADE_BUILD_DEPRECATED
would not have the old unprefixed names recognized anymore, thus preventing conflicts. But this also affects deprecations in the C++ APIs, meaning people get either no backwards compatibility at all, or backwards compatibility including the unprefixed CMake names.
Yeah, and adding a dedicated option just for this one CMake change feels dirty to me. -DCORRADE_PLEASE_BEHAVE_THANKS_VERY_MUCH=ON
. Not a fan of flags that people have to learn to enable to get reasonable defaults.
Oh, or I could detect if any new prefixed CORRADE_
options are set, and then assume the user is aware of the prefixed options aready and not even provide the backwards compat. But that's also not 100% bulletproof, because (and especially with Corrade, as opposed to Magnum), the default set of options is usually fine and nobody needs to enable/disable anything.... so you'd have to explicitly do something trivial like -DCORRADE_WITH_UTILITY=ON
to cause the backwards compat to get disabled.
from corrade.
This should be implemented as of 878624a, with similar commits gradually appearing in other repos. See the commit message for details.
There's quite a bit of nontrivial logic to both satisfy backwards compatibility and allow the unprefixed variables to be repurposed by other projects, and while I tried to verify all corner cases, it might not be covering everything, especially the more obscure combinations of options. Please report if it misbehaves in some way -- thanks! :)
from corrade.
Related Issues (20)
- String API additions and SIMD optimizations
- Path::homeDirectory(): asserts when run by Windows users without home directory HOT 3
- Emscripten toolchain should point to cache sys root HOT 4
- Corrade's test suite fails under AddressSanitizer HOT 9
- Corrade with BUILD_TESTS=ON compilation error: call to non-‘constexpr’ function HOT 5
- Error when installing via HunterGate HOT 7
- Windows: inconsistent redefinition of _aligned_malloc HOT 3
- Corrade adds /wd*** warning disablements to "clang.exe" on windows. HOT 1
- Building Corrade with -std=c++20 causes errors inside MinGW <numbers> header HOT 3
- Corrade fails to compile with emscripten 3.1.22 HOT 4
- Opt-in to native UTF-8 support for OS interaction on Windows
- std::tuple_size / tuple_element specializations for Corrade containers HOT 1
- error: cannot initialize a variable of type 'const char *const' with an rvalue of type 'int' HOT 3
- Optimizing compilation time for the test suite -- an analysis HOT 3
- Interconnect - Slots are not called according to their record order HOT 1
- V8::Zone Allocator HOT 1
- NEON code does not build on armv7 HOT 2
- what to set CORRADE_INCLUDE_DIR to for in-source-builds HOT 2
- JsonToken::asObject() odd behavior with empty objects HOT 2
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 corrade.