Improve project C++17 support (#4334)

Poco now use C++17. We can take some old code away because of that. We
also raise requiments for C++17 so everything works as excpected with
it.

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander 2023-12-13 03:16:35 +02:00 committed by GitHub
parent 12a99dcd18
commit 10f41c06d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 37 deletions

View File

@ -42,7 +42,7 @@
"forcedInclude": [], "forcedInclude": [],
"compilerPath": "/usr/bin/clang", "compilerPath": "/usr/bin/clang",
"cStandard": "c11", "cStandard": "c11",
"cppStandard": "c++14", "cppStandard": "c++17",
"compileCommands": "", "compileCommands": "",
"browse": { "browse": {
"path": [ "path": [
@ -63,7 +63,7 @@
"forcedInclude": [], "forcedInclude": [],
"compilerPath": "/usr/bin/gcc", "compilerPath": "/usr/bin/gcc",
"cStandard": "c11", "cStandard": "c11",
"cppStandard": "c++14", "cppStandard": "c++17",
"compileCommands": "", "compileCommands": "",
"browse": { "browse": {
"path": [ "path": [

View File

@ -42,7 +42,7 @@ endif()
# Setup C/C++ compiler options # Setup C/C++ compiler options
################################################################################# #################################################################################
# C++11/17 compiler flags # C++17 compiler flags
include(CXX1x) include(CXX1x)
check_for_cxx17_compiler(CXX17_COMPILER) check_for_cxx17_compiler(CXX17_COMPILER)

View File

@ -223,11 +223,4 @@
// Uncomment to explicitly disable SQLParser // Uncomment to explicitly disable SQLParser
// #define POCO_DATA_NO_SQL_PARSER // #define POCO_DATA_NO_SQL_PARSER
// Automatically disable SQL parser for < c++17 compile
#if !defined(POCO_DATA_NO_SQL_PARSER)
#ifndef POCO_HAVE_CPP17_COMPILER
#define POCO_DATA_NO_SQL_PARSER
#endif
#endif
#endif // Foundation_Config_INCLUDED #endif // Foundation_Config_INCLUDED

View File

@ -25,7 +25,7 @@ and [Getting Started](https://pocoproject.org/docs/00200-GettingStarted.html) do
### Prerequisites ### Prerequisites
- CMake 3.5 or newer - CMake 3.5 or newer
- A C++14 compiler (Visual C++ 2015, GCC 5.0, Clang 3.4, or newer) - A C++17 compiler (Visual C++ 2017, GCC 8.0, Clang 5, or newer)
- OpenSSL headers and libraries (optional, but recommended) - OpenSSL headers and libraries (optional, but recommended)
- MySQL, PostgreSQL and ODBC client libraries (optional) - MySQL, PostgreSQL and ODBC client libraries (optional)

View File

@ -18,31 +18,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Determines whether the compiler supports C++11
macro(check_for_cxx11_compiler _VAR)
message(STATUS "Checking for C++11 compiler ...")
set(${_VAR})
try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON)
if(NOT _COMPILER_TEST_RESULT AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON)
if(_COMPILER_TEST_RESULT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
else()
message(STATUS "To enable C++11 install libc++ standard library from https://libcxx.llvm.org/")
endif()
endif()
if(_COMPILER_TEST_RESULT AND ((MSVC AND (MSVC10 OR MSVC11 OR MSVC12 OR MSVC14)) OR
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.1) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "QCC" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.1) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.3) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")))
set(${_VAR} 1)
message(STATUS "Checking for C++11 compiler - available")
else()
message(STATUS "Checking for C++11 compiler - unavailable")
endif()
endmacro()
# Determines whether the compiler supports C++17 # Determines whether the compiler supports C++17
macro(check_for_cxx17_compiler _VAR) macro(check_for_cxx17_compiler _VAR)
message(STATUS "Checking for C++17 compiler") message(STATUS "Checking for C++17 compiler")

View File

@ -123,7 +123,7 @@ done
: ${CC:=gcc} : ${CC:=gcc}
: ${CXX:=g++} : ${CXX:=g++}
: ${CXXFLAGS:=-std=c++11} : ${CXXFLAGS:=-std=c++17}
echo "CC=$CC" >>$build/PocoDoc.ini echo "CC=$CC" >>$build/PocoDoc.ini
echo "CXX=$CXX" >>$build/PocoDoc.ini echo "CXX=$CXX" >>$build/PocoDoc.ini