Skip to content

Commit

Permalink
Build: Update to C++17 version
Browse files Browse the repository at this point in the history
The main rationale for this is for when fetching external GTest.
Currently we are stuck to GTest-1.12.1 which is the latest version
supporting C++11. Later versions require C++14.
The issue with GTest-1.12.1 is that its CMakeLists.txt has a
``cmake_minimum_required(VERSION 3.5)`` which causes the following
warning with modern CMake versions:
```
CMake Deprecation Warning at build/_deps/googletest-src/CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.
```
  • Loading branch information
rouault committed Jan 2, 2025
1 parent 5500ba7 commit 5b09705
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ cmake_policy(SET CMP0054 NEW)

# Set C++ version
# Make CMAKE_CXX_STANDARD available as cache option overridable by user
set(CMAKE_CXX_STANDARD 11
CACHE STRING "C++ standard version to use (default is 11)")
set(CMAKE_CXX_STANDARD 17
CACHE STRING "C++ standard version to use (default is 17)")
message(STATUS "Requiring C++${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Build requirements
++++++++++++++++++

- C99 compiler
- C++11 compiler
- C++17 compiler
- CMake >= 3.16
- SQLite3 >= 3.11: headers and library for target architecture, and sqlite3 executable for build architecture
- libtiff >= 4.0 (optional but recommended)
Expand All @@ -160,7 +160,7 @@ Test requirements

These are only required if testing is built (see :option:`BUILD_TESTING`, default ON)

- GoogleTest (GTest) >= 1.8.1; if not found and :option:`TESTING_USE_NETWORK` is ON, then version 1.12.1 is fetched from GitHub and locally installed
- GoogleTest (GTest) >= 1.8.1; if not found and :option:`TESTING_USE_NETWORK` is ON, then version 1.15.2 is fetched from GitHub and locally installed
- Python >= 3.7
- `importlib_metadata <https://pypi.org/project/importlib-metadata/>`_ only needed for Python 3.7
- One of either `PyYAML <https://pypi.org/project/PyYAML/>`_ or `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_
Expand Down
4 changes: 3 additions & 1 deletion test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ elseif(HAS_NETWORK)
cmake_policy(SET CMP0135 NEW) # for DOWNLOAD_EXTRACT_TIMESTAMP option
endif()

set(GTEST_VERSION "1.15.2")

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
URL https://github.com/google/googletest/archive/refs/tags/release-${GTEST_VERSION}.zip
EXCLUDE_FROM_ALL # ignored before CMake 3.28
)

Expand Down

0 comments on commit 5b09705

Please sign in to comment.