Closed bobhairgrove closed 2 years ago
No, there’s nothing like that, but I agree it could be useful. I’ve tried to implement it in the ver
branch, check it out.
At first, I did it through CMake defines, which may not be a good thing, as these defines are applied on the command line by CMake, meaning the user won’t be able to access these defines if compiling not with CMake. Because of that I switched to generating a header file containing that defines (quazip_version.h
included from quazip_global.h
and therefore available almost everywhere).
Thank you very much for including this new version header.
I looked at the ver
branch, but it seems that I still need to build QuaZip with CMake if I want the header quazip_version.h
to be generated. Unfortunately, I am using the sources directly, and my project builds with qmake
.
I suppose I'll just build it once with CMake and copy over the generated header file.
Unfortunately, I am running into a snag trying to build the ver
branch.
I downloaded the ver
branch as a ZIP file quazip_ver
and extracted the files to my code
directory. Following the instructions shown on the documentation page, I opened that folder and issued the following commands:
mkdir build
cd quazip
cmake -S . -B ../build
However, I get the following output from CMake:
CMake Warning at CMakeLists.txt:1 (project):
VERSION keyword not followed by a value or was followed by a value that
expanded to nothing.
CMake Error at CMakeLists.txt:1 (project):
VERSION not allowed unless CMP0048 is set to NEW
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.19)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
Obviously, I must be doing something wrong???
OK, my mistake was trying to build from the quazip
subdirectory instead of the top directory. So the working commands were:
cd quazip_ver
mkdir build
cmake -S . -B build
cd build
cmake --build .
Then I found the file quazip_version.h
under the build/quazip/generated_includes
folder.
In my application, I use several third-party libraries, including QuaZip. Most of these expose the current version information through a macro or function defined in a header which is included by the application using the library.
It would be nice if QuaZip had this feature; or if it already does, I haven't found it yet?