mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
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:
parent
12a99dcd18
commit
10f41c06d9
4
.vscode/c_cpp_properties.json
vendored
4
.vscode/c_cpp_properties.json
vendored
@ -42,7 +42,7 @@
|
||||
"forcedInclude": [],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++14",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": "",
|
||||
"browse": {
|
||||
"path": [
|
||||
@ -63,7 +63,7 @@
|
||||
"forcedInclude": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++14",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": "",
|
||||
"browse": {
|
||||
"path": [
|
||||
|
@ -42,7 +42,7 @@ endif()
|
||||
# Setup C/C++ compiler options
|
||||
#################################################################################
|
||||
|
||||
# C++11/17 compiler flags
|
||||
# C++17 compiler flags
|
||||
include(CXX1x)
|
||||
check_for_cxx17_compiler(CXX17_COMPILER)
|
||||
|
||||
|
@ -223,11 +223,4 @@
|
||||
// Uncomment to explicitly disable SQLParser
|
||||
// #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
|
||||
|
@ -25,7 +25,7 @@ and [Getting Started](https://pocoproject.org/docs/00200-GettingStarted.html) do
|
||||
### Prerequisites
|
||||
|
||||
- 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)
|
||||
- MySQL, PostgreSQL and ODBC client libraries (optional)
|
||||
|
||||
|
@ -18,31 +18,6 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# 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
|
||||
macro(check_for_cxx17_compiler _VAR)
|
||||
message(STATUS "Checking for C++17 compiler")
|
||||
|
@ -123,7 +123,7 @@ done
|
||||
|
||||
: ${CC:=gcc}
|
||||
: ${CXX:=g++}
|
||||
: ${CXXFLAGS:=-std=c++11}
|
||||
: ${CXXFLAGS:=-std=c++17}
|
||||
|
||||
echo "CC=$CC" >>$build/PocoDoc.ini
|
||||
echo "CXX=$CXX" >>$build/PocoDoc.ini
|
||||
|
Loading…
x
Reference in New Issue
Block a user