Support for older versions of CMake #682
Labels
No labels
announcement
bug
build
CI
dependencies
documentation
duplicate
enhancement
experience feedback
feature request
github_actions
help wanted
install
invalid
Long-term
optimization
portability
question
target-specific
test issue
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-Cyan4973/xxHash#682
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
add_compile_definitionscommand was added to CMake in version 3.12 but we use itI suggest using the command
add_definitionsfor older versions and wrap this command like hereWhat is wanted here is to set
XXH_DEBUGLEVEL=1in order to enableassert()in debug builds,which would allow to catch issues like #588 during CI tests.
add_compile_definitionswas added just for this purpose. It's the only place where it's employed.The
cmakerecipe is supposed to be compatible withcmakeversions as old asv2.8.12.So it's a concern that adding this single line broke that requirement.
A few questions :
add_definitions?cmakedocumentation, it doesn't go farther thanv3.0. That's fine foradd_compile_definitions, which clearly states being introduced inv3.12, but there is no such information foradd_definitions, which is only assumed being there "beforev3.0".add_definitions, it's not clear to me that it would work properly for MSVC compiler. It seems tied to the-Dprefix convention ofgcc.cmakerecipe for v2.8.12 compatibility in CI ?If we have no error signal, it will be easy for any future contributions to break that requirement again.
We may also question if
v2.8.12is a good minimum version, but that doesn't change the underlying issue : another minimum version will have to selected, and we are still lacking a test to ensure that updatescmakerecipes are still compatible with this version.I don't test it yet, but there's convenient GH-Action called
lukka/get-cmakewhich enables GH-Actions to install specific version of CMake.Basically,
get-cmakedownloads prebuild archive from official releases. It seems their oldest version isv2.4.8.Thanks @t-mat ,
indeed, that's the same method used in the newly added cmake version compatibility test.
add_definitioins()interpret both of-Dand/Das a preprocessor definition.When I add the following line to the
CMakeLists.txt,cmakeemits the following definitions into the.vcxprojfile.But the following block doesn't work with MSVC (and Xcode, etc) project.
Because
CMAKE_BUILD_TYPEonly works with "single-configuration generators" (Makefile, etc).Also, there're a lot of advice that we should avoid to use
CMAKE_BUILD_TYPE.So it seems using
target_compile_definitions()is the most simple way to define the debug build symbol.But it also has introduced at CMake 3.12 :(