leveldb
leveldb copied to clipboard
CMake configuration fails due to outdated `cmake_minimum_required` in `third_party/googletest/CMakeLists.txt`
Hi, I'm trying to build LevelDB on Windows 11 using the instructions provided in the documentation. However, I'm using Visual Studio 2022 with the following commands:
mkdir build
cd build
cmake -G "Visual Studio 17 2022" ..
When I run this, I get the following error:
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
-- The C compiler identification is MSVC 19.44.35209.0
-- The CXX compiler identification is MSVC 19.44.35209.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for crc32c_value in crc32c
-- Looking for crc32c_value in crc32c - not found
-- Looking for snappy_compress in snappy
-- Looking for snappy_compress in snappy - not found
-- Looking for zstd_compress in zstd
-- Looking for zstd_compress in zstd - not found
-- Looking for malloc in tcmalloc
-- Looking for malloc in tcmalloc - not found
-- Looking for fdatasync
-- Looking for fdatasync - not found
-- Looking for F_FULLFSYNC
-- Looking for F_FULLFSYNC - not found
-- Looking for O_CLOEXEC
-- Looking for O_CLOEXEC - not found
-- Performing Test HAVE_CLANG_THREAD_SAFETY
-- Performing Test HAVE_CLANG_THREAD_SAFETY - Failed
-- Performing Test LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS
-- Performing Test LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS - Failed
-- Performing Test HAVE_CXX17_HAS_INCLUDE
-- Performing Test HAVE_CXX17_HAS_INCLUDE - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
CMake Error at third_party/googletest/CMakeLists.txt:4 (cmake_minimum_required):
Compatibility with CMake < 3.5 has been removed from CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
-- Configuring incomplete, errors occurred!
It seems that the third_party/googletest/CMakeLists.txt is using a very old cmake_minimum_required() value which is no longer compatible with current versions of CMake.
Would it be possible to update the CMakeLists.txt in third_party/googletest to be compatible with modern CMake versions, or add guidance on how to workaround this when using newer Visual Studio versions?
Thanks!
You can use
cmake -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -G "Visual Studio 17" ..