google / benchmark

A microbenchmark support library
Apache License 2.0
8.59k stars 1.57k forks source link

[REGRESSION] Cmake script in 1.8.4 says that its version is 0.0.0, libbenchmark_main.so.1 became libbenchmark_main.so.0 #1792

Closed yurivict closed 1 month ago

yurivict commented 1 month ago

Describe the bug This cmake script:

cmake_minimum_required(VERSION 3.15)

project(x VERSION 0.11.1 LANGUAGES CXX)

find_package(benchmark REQUIRED)
message("benchmark_VERSION=${benchmark_VERSION}")

prints:

benchmark_VERSION=0.0.0

System Which OS, compiler, and compiler version are you using:

LebedevRI commented 1 month ago

Seems to be working fine here:

$ git describe 
v1.8.4
$ cmake .. -DBUILD_SHARED_LIBS=ON
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Failed to find LLVM FileCheck
-- Found Git: /usr/bin/git (found version "2.45.1")
-- Google Benchmark version: v1.8.4, normalized to 1.8.4
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST - Success
-- Performing Test HAVE_CXX_FLAG_WCONVERSION
-- Performing Test HAVE_CXX_FLAG_WCONVERSION - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Compiling and running to test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Compiling and running to test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Compiling and running to test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Compiling and running to test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Compiling and running to test HAVE_PTHREAD_AFFINITY
-- Performing Test HAVE_PTHREAD_AFFINITY -- success
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Looking for Google Test sources
-- Looking for Google Test sources in /repositories/googlebenchmark/googletest
-- Found Google Test in /repositories/googlebenchmark/googletest
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /repositories/googlebenchmark/build-Clang17-release/third_party/googletest
[1/9] Creating directories for 'googletest'
[2/9] No download step for 'googletest'
[3/9] No update step for 'googletest'
[4/9] No patch step for 'googletest'
[5/9] No configure step for 'googletest'
[6/9] No build step for 'googletest'
[7/9] No install step for 'googletest'
[8/9] No test step for 'googletest'
[9/9] Completed 'googletest'
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python3: /usr/bin/python3 (found version "3.11.9") found components: Interpreter
-- Performing Test HAVE_CXX_FLAG_WNO_UNUSED_VARIABLE
-- Performing Test HAVE_CXX_FLAG_WNO_UNUSED_VARIABLE - Success
-- Performing Test BENCHMARK_HAS_O3_FLAG
-- Performing Test BENCHMARK_HAS_O3_FLAG - Success
-- Performing Test BENCHMARK_HAS_DEPRECATED_DECLARATIONS_FLAG
-- Performing Test BENCHMARK_HAS_DEPRECATED_DECLARATIONS_FLAG - Success
-- Performing Test BENCHMARK_HAS_WNO_ODR
-- Performing Test BENCHMARK_HAS_WNO_ODR - Success
-- Performing Test BENCHMARK_HAS_WNO_LTO_TYPE_MISMATCH
-- Performing Test BENCHMARK_HAS_WNO_LTO_TYPE_MISMATCH - Success
-- Configuring done (3.3s)
-- Generating done (0.0s)
-- Build files have been written to: /repositories/googlebenchmark/build-Clang17-release
$ ninja
[115/115] Linking CXX executable test/benchmark_gtest
$ ls -lah lib/
total 1.4M
drwxr-xr-x 1 lebedevri lebedevri  194 May 24 19:16 .
drwxr-xr-x 1 lebedevri lebedevri  520 May 24 19:16 ..
lrwxrwxrwx 1 lebedevri lebedevri   18 May 24 19:16 libgmock.so -> libgmock.so.1.14.0
-rwxr-xr-x 1 lebedevri lebedevri 328K May 24 19:16 libgmock.so.1.14.0
lrwxrwxrwx 1 lebedevri lebedevri   23 May 24 19:16 libgmock_main.so -> libgmock_main.so.1.14.0
-rwxr-xr-x 1 lebedevri lebedevri 7.6K May 24 19:16 libgmock_main.so.1.14.0
lrwxrwxrwx 1 lebedevri lebedevri   18 May 24 19:16 libgtest.so -> libgtest.so.1.14.0
-rwxr-xr-x 1 lebedevri lebedevri 1.1M May 24 19:16 libgtest.so.1.14.0
$ git describe 
v1.8.4
$
$ cmake . -Dbenchmark_DIR=/repositories/googlebenchmark/build-Clang17-release
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
benchmark_VERSION=1.8.4
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/qq
yurivict commented 1 month ago

You use the variable NORMALIZED_VERSION here.

It is not defined.

Where is this variable documented?

LebedevRI commented 1 month ago

Please provide reproduction steps for the issue described in your original comment.

LebedevRI commented 1 month ago

Ok, so it does not work when using tarball source.