0

I am building a C++ library on Windows and Linux, and would like to verify that the Version is being set correctly. I have added the following to the CMakeLists.txt file:

project ("TestProject" VERSION 999.999.999 LANGUAGES C CXX)

add_subdirectory ("TestProject")

set_target_properties("TestProject" PROPERTIES 
                              VERSION ${PROJECT_VERSION}
                            SOVERSION ${PROJECT_VERSION_MAJOR})

When I build on Linux, I can see that the version is appended to the end of the .so file. But on Windows, all I see is the .dll file.

Is there any way for me to validate the version of the .so and .dll files?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
165plo
  • 713
  • 1
  • 8
  • 20
  • 1
    ***Is there any way for me to validate the version of the .so and .dll files?*** No, I don't believe anything is builtin to do that. Although with that said you can change the naming convention to append the version. – drescherjm Jul 05 '23 at 23:04
  • 2
    I'm not sure if `SOVERSION` has any effect for MS Windows DLLs, though someone else may well correct me. If you want a cross-platform way to embed the version of a project into a binary, you can set macro definitions in the CMake file and then use these to populate some global variables in your program/library. I do this for some of my projects, here is a code template: https://github.com/saxbophone/CPP20-Cross-Platform-Template – saxbophone Jul 05 '23 at 23:35
  • 1
    About checking version of a `.dll` file, see e.g. [that question](https://stackoverflow.com/questions/284258/how-do-i-set-the-version-information-for-an-existing-exe-dll). (As noted by previous commenter, version of the `.dll` is not of soversion kind, so SOVERSION property doesn't affect on it.) About checking version of `.so` file, it can be performed with `objdump -p ` or `readelf --dynsym `, both outputs will contain the `SONAME` entry. – Tsyvarev Jul 06 '23 at 11:13

0 Answers0