Skip to content

Commit

Permalink
Require c++17 to build
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 25, 2021
1 parent 58877e4 commit a54efae
Show file tree
Hide file tree
Showing 66 changed files with 220 additions and 9 deletions.
9 changes: 0 additions & 9 deletions CMakeLists.txt
Expand Up @@ -559,15 +559,6 @@ if (WITH_CORE)
set(ENABLE_MODELTEST FALSE CACHE BOOL "Enable QT ModelTest (not for production)")
endif()

#############################################################
# enable use of c++11 features where available
# full c++11 support in clang 3.3+: http://clang.llvm.org/cxx_status.html
# for Mac, this is probably Apple LLVM 4.2 (based on LLVM 3.2svn, in XCode 4.6+)
# or definitely Apple LLVM 5.0 (based on LLVM 3.3svn, in Xcode 5+):
# https://gist.github.com/yamaya/2924292

set(CMAKE_CXX_STANDARD 11)

#############################################################
# enable warnings

Expand Down
3 changes: 3 additions & 0 deletions src/3d/CMakeLists.txt
Expand Up @@ -191,6 +191,9 @@ set (QGIS_3D_RCCS shaders.qrc ../../resources/3d/textures/textures.qrc)

add_library(qgis_3d SHARED ${QGIS_3D_SRCS} ${QGIS_3D_HDRS} ${QGIS_3D_RCCS} ${QGIS_3D_PRIVATE_HDRS})

# require c++17
target_compile_features(qgis_3d PRIVATE cxx_std_17)

target_include_directories(qgis_3d SYSTEM PUBLIC
${QT5_3DEXTRA_INCLUDE_DIR}
)
Expand Down
3 changes: 3 additions & 0 deletions src/analysis/CMakeLists.txt
Expand Up @@ -443,6 +443,9 @@ endif()

add_library(qgis_analysis ${LIBRARY_TYPE} ${QGIS_ANALYSIS_SRCS} ${QGIS_ANALYSIS_HDRS})

# require c++17
target_compile_features(qgis_analysis PRIVATE cxx_std_17)

target_include_directories(qgis_analysis PUBLIC
${CMAKE_SOURCE_DIR}/src/analysis
${CMAKE_SOURCE_DIR}/src/analysis/georeferencing
Expand Down
9 changes: 9 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -442,14 +442,23 @@ endif()
#############
if (ANDROID)
add_library(${QGIS_APP_NAME} SHARED ${QGIS_APPMAIN_SRCS})

# require c++17
target_compile_features(${QGIS_APP_NAME} PRIVATE cxx_std_17)
else()
add_executable(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APPMAIN_SRCS})

# require c++17
target_compile_features(${QGIS_APP_NAME} PRIVATE cxx_std_17)
endif()

# Putting IMAGE_RCC_SRCS into qgis_app lib is causing problems when the lib is
# loaded (by plugin for example) in test unit (qgis_layoutpicturetest).
add_library(qgis_app SHARED ${QGIS_APP_SRCS})

# require c++17
target_compile_features(qgis_app PRIVATE cxx_std_17)

target_include_directories(qgis_app PUBLIC
${CMAKE_SOURCE_DIR}/external/nmea

Expand Down
3 changes: 3 additions & 0 deletions src/auth/basic/CMakeLists.txt
Expand Up @@ -18,6 +18,9 @@ QT5_WRAP_UI (AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})

add_library (basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})

# require c++17
target_compile_features(basicauthmethod PRIVATE cxx_std_17)

target_link_libraries (basicauthmethod
qgis_core
qgis_gui
Expand Down
3 changes: 3 additions & 0 deletions src/auth/esritoken/CMakeLists.txt
Expand Up @@ -26,6 +26,9 @@ QT5_WRAP_UI (AUTH_ESRI_TOKEN_UIS_H ${AUTH_ESRI_TOKEN_UIS})

add_library (esritokenauthmethod MODULE ${AUTH_ESRI_TOKEN_SRCS} ${AUTH_ESRI_TOKEN_HDRS} ${AUTH_ESRI_TOKEN_UIS_H})

# require c++17
target_compile_features(esritokenauthmethod PRIVATE cxx_std_17)

target_link_libraries (esritokenauthmethod
qgis_core
qgis_gui
Expand Down
3 changes: 3 additions & 0 deletions src/auth/identcert/CMakeLists.txt
Expand Up @@ -30,6 +30,9 @@ QT5_WRAP_UI (AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})

add_library (identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})

# require c++17
target_compile_features(identcertauthmethod PRIVATE cxx_std_17)

target_link_libraries (identcertauthmethod
qgis_core
qgis_gui
Expand Down
4 changes: 4 additions & 0 deletions src/auth/oauth2/CMakeLists.txt
Expand Up @@ -118,6 +118,10 @@ add_library (oauth2authmethod_static STATIC
${OAUTH2_UIS_H}
)

# require c++17
target_compile_features(identcertauthmethod PRIVATE cxx_std_17)
target_compile_features(oauth2authmethod_static PRIVATE cxx_std_17)

# Common linked libs
set(OAUTH2_TARGET_LIBS ${QTKEYCHAIN_LIBRARY})

Expand Down
3 changes: 3 additions & 0 deletions src/auth/pkipaths/CMakeLists.txt
Expand Up @@ -30,6 +30,9 @@ QT5_WRAP_UI (AUTH_PKIPATHS_UIS_H ${AUTH_PKIPATHS_UIS})

add_library (pkipathsauthmethod MODULE ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H})

# require c++17
target_compile_features(pkipathsauthmethod PRIVATE cxx_std_17)

target_link_libraries (pkipathsauthmethod
qgis_core
qgis_gui
Expand Down
3 changes: 3 additions & 0 deletions src/auth/pkipkcs12/CMakeLists.txt
Expand Up @@ -30,6 +30,9 @@ QT5_WRAP_UI (AUTH_PKCS12_UIS_H ${AUTH_PKCS12_UIS})

add_library (pkcs12authmethod MODULE ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H})

# require c++17
target_compile_features(pkcs12authmethod PRIVATE cxx_std_17)

target_link_libraries (pkcs12authmethod
qgis_core
qgis_gui
Expand Down
3 changes: 3 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -1727,6 +1727,9 @@ set(IMAGE_RCCS ../../images/images.qrc)
# qgis_core library
add_library(qgis_core ${LIBRARY_TYPE} ${QGIS_CORE_SRCS} ${QGIS_CORE_HDRS} ${QGIS_CORE_PRIVATE_HDRS} ${IMAGE_RCCS})

# require c++17
target_compile_features(qgis_core PRIVATE cxx_std_17)

target_include_directories(qgis_core SYSTEM PUBLIC
${QT_INCLUDE_DIR}
${PROJ_INCLUDE_DIR}
Expand Down
2 changes: 2 additions & 0 deletions src/crashhandler/CMakeLists.txt
Expand Up @@ -21,6 +21,8 @@ add_executable(qgiscrashhandler WIN32
${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
)

target_compile_features(qgiscrashhandler PRIVATE cxx_std_17)

target_link_libraries(qgiscrashhandler
${Qt5Core_LIBRARIES}
${Qt5Gui_LIBRARIES}
Expand Down
1 change: 1 addition & 0 deletions src/crssync/CMakeLists.txt
@@ -1,4 +1,5 @@
add_executable(crssync main.cpp)
target_compile_features(crssync PRIVATE cxx_std_17)

target_link_libraries(crssync
qgis_core
Expand Down
3 changes: 3 additions & 0 deletions src/customwidgets/CMakeLists.txt
Expand Up @@ -106,6 +106,9 @@ QT5_WRAP_CPP(QGIS_CUSTOMWIDGETS_MOC_SRCS ${QGIS_CUSTOMWIDGETS_MOC_HDRS})

add_library(qgis_customwidgets SHARED ${QGIS_CUSTOMWIDGETS_SRCS} ${QGIS_CUSTOMWIDGETS_MOC_SRCS} ${QGIS_CUSTOMWIDGETS_MOC_HDRS})

# require c++17
target_compile_features(qgis_customwidgets PRIVATE cxx_std_17)

set_target_properties(qgis_customwidgets PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
Expand Down
3 changes: 3 additions & 0 deletions src/gui/CMakeLists.txt
Expand Up @@ -1363,6 +1363,9 @@ add_library(qgis_gui SHARED
${QGIS_GUI_SRCS} ${QGIS_GUI_HDRS} ${QGIS_GUI_PRIVATE_HDRS}
)

# require c++17
target_compile_features(qgis_gui PRIVATE cxx_std_17)

target_include_directories(qgis_gui SYSTEM PUBLIC
${QWT_INCLUDE_DIR}
${QSCINTILLA_INCLUDE_DIR}
Expand Down
3 changes: 3 additions & 0 deletions src/native/CMakeLists.txt
Expand Up @@ -88,6 +88,9 @@ endif()
add_library(qgis_native SHARED ${QGIS_NATIVE_SRCS} ${QGIS_NATIVE_HDRS})
set_property(TARGET qgis_native PROPERTY POSITION_INDEPENDENT_CODE ON)

# require c++17
target_compile_features(qgis_native PRIVATE cxx_std_17)

target_include_directories(qgis_native PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/geometry_checker/CMakeLists.txt
Expand Up @@ -34,6 +34,9 @@ QT5_WRAP_UI (geometrychecker_UIS_H ${geometrychecker_UIS})

add_library (geometrycheckerplugin MODULE ${geometrychecker_HDRS} ${geometrychecker_SRCS} ${geometrychecker_RCC_SRCS} ${geometrychecker_UIS_H})

# require c++17
target_compile_features(geometrycheckerplugin PRIVATE cxx_std_17)

include_directories(
${CMAKE_SOURCE_DIR}/src/plugins

Expand Down
3 changes: 3 additions & 0 deletions src/plugins/gps_importer/CMakeLists.txt
Expand Up @@ -24,6 +24,9 @@ QT5_WRAP_UI (GPS_UIS_H ${GPS_UIS})

add_library (gpsimporterplugin MODULE ${GPS_SRCS} ${GPS_RCCS} ${GPS_UIS_H})

# require c++17
target_compile_features(gpsimporterplugin PRIVATE cxx_std_17)

include_directories(
${CMAKE_SOURCE_DIR}/src/plugins

Expand Down
3 changes: 3 additions & 0 deletions src/plugins/offline_editing/CMakeLists.txt
Expand Up @@ -26,6 +26,9 @@ add_library (offlineeditingplugin MODULE
${offline_editing_plugin_UIS_H}
)

# require c++17
target_compile_features(offlineeditingplugin PRIVATE cxx_std_17)

target_link_libraries(offlineeditingplugin
qgis_core
qgis_gui
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/topology/CMakeLists.txt
Expand Up @@ -25,6 +25,9 @@ QT5_WRAP_UI (topol_UIS_H ${topol_UIS})

add_library (topolplugin MODULE ${topol_SRCS} ${topol_RCCS} ${topol_UIS_H})

# require c++17
target_compile_features(topolplugin PRIVATE cxx_std_17)

include_directories(SYSTEM
${GEOS_INCLUDE_DIR}
)
Expand Down
3 changes: 3 additions & 0 deletions src/process/CMakeLists.txt
Expand Up @@ -18,6 +18,9 @@ endif()

add_executable (qgis_process MACOSX_BUNDLE ${QGIS_PROCESS_SRCS})

# require c++17
target_compile_features(qgis_process PRIVATE cxx_std_17)

include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
Expand Down
7 changes: 7 additions & 0 deletions src/providers/arcgisrest/CMakeLists.txt
Expand Up @@ -30,6 +30,10 @@ endif()
add_library (arcgisfeatureserverprovider_a STATIC ${AFS_SRCS})
add_library(arcgisfeatureserverprovider MODULE ${AFS_SRCS})

# require c++17
target_compile_features(arcgisfeatureserverprovider_a PRIVATE cxx_std_17)
target_compile_features(arcgisfeatureserverprovider PRIVATE cxx_std_17)

target_link_libraries(arcgisfeatureserverprovider
qgis_core
${QCA_LIBRARY}
Expand Down Expand Up @@ -63,6 +67,9 @@ set (AMS_SRCS

add_library(arcgismapserverprovider MODULE ${AMS_SRCS})

# require c++17
target_compile_features(arcgismapserverprovider PRIVATE cxx_std_17)

target_link_libraries(arcgismapserverprovider
qgis_core
${QCA_LIBRARY}
Expand Down
3 changes: 3 additions & 0 deletions src/providers/db2/CMakeLists.txt
Expand Up @@ -41,6 +41,9 @@ include_directories(

add_library (db2provider MODULE ${DB2_SRCS} ${DB2_HDRS})

# require c++17
target_compile_features(db2provider PRIVATE cxx_std_17)

target_link_libraries (db2provider
qgis_core
${Qt5Sql_LIBRARIES}
Expand Down
3 changes: 3 additions & 0 deletions src/providers/delimitedtext/CMakeLists.txt
Expand Up @@ -25,6 +25,9 @@ include_directories(

add_library(delimitedtextprovider MODULE ${DTEXT_SRCS})

# require c++17
target_compile_features(delimitedtextprovider PRIVATE cxx_std_17)

target_link_libraries(delimitedtextprovider
qgis_core
)
Expand Down
3 changes: 3 additions & 0 deletions src/providers/geonode/CMakeLists.txt
Expand Up @@ -23,6 +23,9 @@ include_directories(

add_library(geonodeprovider MODULE ${GEONODE_SRCS})

# require c++17
target_compile_features(geonodeprovider PRIVATE cxx_std_17)

target_link_libraries(geonodeprovider
qgis_core
)
Expand Down
3 changes: 3 additions & 0 deletions src/providers/gpx/CMakeLists.txt
Expand Up @@ -19,6 +19,9 @@ include_directories (SYSTEM

add_library(gpxprovider MODULE ${GPX_SRCS})

# require c++17
target_compile_features(gpxprovider PRIVATE cxx_std_17)

target_link_libraries(gpxprovider
${EXPAT_LIBRARY}
qgis_core
Expand Down
14 changes: 14 additions & 0 deletions src/providers/grass/CMakeLists.txt
Expand Up @@ -71,6 +71,9 @@ macro(ADD_GRASSLIB GRASS_BUILD_VERSION)
${GRASS_LIBRARY_UIS_H}
)

# require c++17
target_compile_features(qgisgrass${GRASS_BUILD_VERSION} PRIVATE cxx_std_17)

if(GRASS_OFF_T_SIZE)
set(GRASS_OFF_T_SIZE_DEF "\"-DGRASS_OFF_T_SIZE=${GRASS_OFF_T_SIZE}\"")
else()
Expand Down Expand Up @@ -155,6 +158,10 @@ macro(ADD_GRASSLIB GRASS_BUILD_VERSION)
#
set (GRASS_VECTOR_PROVIDER_SRCS ../qgsgrassprovidermodule.cpp)
add_library(grassprovider${GRASS_BUILD_VERSION} MODULE ${GRASS_VECTOR_PROVIDER_SRCS})

# require c++17
target_compile_features(grassprovider${GRASS_BUILD_VERSION} PRIVATE cxx_std_17)

set_target_properties(grassprovider${GRASS_BUILD_VERSION} PROPERTIES
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
)
Expand All @@ -176,6 +183,10 @@ macro(ADD_GRASSLIB GRASS_BUILD_VERSION)
../qgsgrassrasterprovidermodule.cpp
)
add_library(grassrasterprovider${GRASS_BUILD_VERSION} MODULE ${GRASS_RASTER_PROVIDER_SRCS})

# require c++17
target_compile_features(grassrasterprovider${GRASS_BUILD_VERSION} PRIVATE cxx_std_17)

set_target_properties(grassrasterprovider${GRASS_BUILD_VERSION} PROPERTIES
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
)
Expand Down Expand Up @@ -766,6 +777,9 @@ if(WITH_GRASS_DIRECT)
endif()
add_library(${FAKE_LIB_GRASS_GIS} MODULE qgsgrassgislib.cpp qgsgrassgislibfunctions.cpp )

# require c++17
target_compile_features(${FAKE_LIB_GRASS_GIS} PRIVATE cxx_std_17)

# GRASS_LIBRARY_gis is path to the GRASS library used for compilation, it is the same
# on runtime on Linux and Mac but on Windows with OSGEO4W the GRASS may be installed
# in different directory
Expand Down
4 changes: 4 additions & 0 deletions src/providers/hana/CMakeLists.txt
Expand Up @@ -77,6 +77,10 @@ INCLUDE_DIRECTORIES (SYSTEM
ADD_LIBRARY(hanaprovider MODULE ${HANA_SRCS} ${HANA_HDRS})
ADD_LIBRARY(hanaprovider_a STATIC ${HANA_SRCS} ${HANA_HDRS})

# require c++17
target_compile_features(hanaprovider PRIVATE cxx_std_17)
target_compile_features(hanaprovider_a PRIVATE cxx_std_17)

TARGET_COMPILE_DEFINITIONS(hanaprovider PUBLIC ODBC_STATIC)
TARGET_COMPILE_DEFINITIONS(hanaprovider_a PUBLIC ODBC_STATIC)

Expand Down
3 changes: 3 additions & 0 deletions src/providers/mdal/CMakeLists.txt
Expand Up @@ -175,6 +175,9 @@ include_directories (

add_library (mdalprovider MODULE ${MDAL_SRCS} ${MDAL_LIB_SRCS} ${MDAL_LIB_HDRS})

# require c++17
target_compile_features(mdalprovider PRIVATE cxx_std_17)

target_link_libraries (mdalprovider
qgis_core
${MDAL_LIBRARY}
Expand Down
3 changes: 3 additions & 0 deletions src/providers/mssql/CMakeLists.txt
Expand Up @@ -34,6 +34,9 @@ include_directories(

add_library(mssqlprovider MODULE ${MSSQL_SRCS} ${MSSQL_HDRS})

# require c++17
target_compile_features(mssqlprovider PRIVATE cxx_std_17)

target_link_libraries(mssqlprovider
qgis_core
${Qt5Sql_LIBRARIES}
Expand Down
3 changes: 3 additions & 0 deletions src/providers/oracle/CMakeLists.txt
Expand Up @@ -49,6 +49,9 @@ endif()

add_library (oracleprovider MODULE ${ORACLE_SRCS} ${ORACLE_HDRS})

# require c++17
target_compile_features(oracleprovider PRIVATE cxx_std_17)

target_link_libraries (oracleprovider
qgis_core
${Qt5Sql_LIBRARIES}
Expand Down
3 changes: 3 additions & 0 deletions src/providers/ows/CMakeLists.txt
Expand Up @@ -12,6 +12,9 @@ include_directories(SYSTEM

add_library (owsprovider MODULE ${OWS_SRCS})

# require c++17
target_compile_features(owsprovider PRIVATE cxx_std_17)

target_link_libraries (owsprovider
qgis_core
)
Expand Down

0 comments on commit a54efae

Please sign in to comment.