@@ -98,49 +98,56 @@ if(WIN32 AND MSVC)
9898 set (CMAKE_CXX_FLAGS "" )
9999endif ()
100100
101- #-----------------------------------------------------------------------------
102- #-----------------------------------------------------------------------------
103- # C/C++ Compiler requirements
104- #-----------------------------------------------------------------------------
105- #-----------------------------------------------------------------------------
101+ #---------------------------------------------
102+ # Boost
103+ #---------------------------------------------
106104
107105find_package (Boost ${BOOST_MINIMUM_VERSION} REQUIRED )
108106if (NOT Boost_VERSION_MACRO)
109107 set (Boost_VERSION_MACRO ${Boost_VERSION} )
110108endif ()
111109set (BOOST_VERSION "${Boost_MAJOR_VERSION} .${Boost_MINOR_VERSION} .${Boost_SUBMINOR_VERSION} " )
110+ add_definitions (-DBOOST_ALLOW_DEPRECATED_HEADERS )
112111
113- include (CheckCCompilerFlag )
114- include (CheckCXXCompilerFlag )
115- if (BOOST_VERSION VERSION_LESS "1.75.0" )
116- CHECK_CXX_COMPILER_FLAG ("-std=c++11" COMPILER_SUPPORTS_CXX11 )
117- if (COMPILER_SUPPORTS_CXX11)
118- set (CMAKE_CXX_STANDARD 11)
119- set (CMAKE_CXX_STANDARD_REQUIRED ON )
120- set (CMAKE_CXX_EXTENSIONS OFF )
112+ include_directories (SYSTEM ${Boost_INCLUDE_DIRS} )
113+
114+ #---------------------------------------------
115+ # Clang tidy
116+ #---------------------------------------------
117+
118+ option (USE_CLANG_TIDY "Use clang-tidy." OFF )
119+
120+ if (USE_CLANG_TIDY)
121+ find_program (CLANG_TIDY_COMMAND NAMES clang-tidy NO_CACHE )
122+ if (CLANG_TIDY_COMMAND)
123+ set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND} ;--config-file=${CMAKE_SOURCE_DIR} /.clang-tidy" )
121124 else ()
122- CHECK_CXX_COMPILER_FLAG ("-std=c++0x" COMPILER_SUPPORTS_CXX0X )
123- if (COMPILER_SUPPORTS_CXX0X)
124- add_compile_options ("-std=c++0x" )
125- message (STATUS "Using -std=c++0x." )
126- else ()
127- message (WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++0x or C++11 flags support.
128- Using: callback compiler's standard" )
129- endif ()
125+ message (WARNING "Set to use clang_tidy, but not found." )
130126 endif ()
131- else ()
132- set (CMAKE_CXX_STANDARD 14)
133127endif ()
134128
135- add_definitions (-DBOOST_ALLOW_DEPRECATED_HEADERS )
129+ #-----------------------------------------------------------------------------
130+ # C/C++ Compiler requirements
131+ #-----------------------------------------------------------------------------
132+
133+ include (CheckCCompilerFlag )
134+ include (CheckCXXCompilerFlag )
135+
136+ set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard version to use (minimum requirement is c++17)" )
137+
136138set (COMPILER_VERSION "${CMAKE_CXX_COMPILER_ID} -${CMAKE_CXX_COMPILER_VERSION} " )
137139
140+ #-----------------------------------------------------------------------------
141+ # C++ language version and compilation flags
142+ #-----------------------------------------------------------------------------
143+ message (STATUS "pgRouting: Require C++${CMAKE_CXX_STANDARD} " )
144+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
145+ set (CMAKE_CXX_EXTENSIONS OFF )
138146
139147#---------------------------------------------
140148# Windows compiler flags
141149#---------------------------------------------
142150
143-
144151if (WIN32 AND NOT MSVC )
145152 set (OS_BUILD $ENV{OS_BUILD} )
146153 if (NOT OS_BUILD)
@@ -169,23 +176,11 @@ if(WIN32 AND MSVC)
169176 -EHsc )
170177endif ()
171178
172- #-----------------------------------------------------------------------------
173- #-----------------------------------------------------------------------------
174179#-----------------------------------------------------------------------------
175180# Finding prerequisites
176181#-----------------------------------------------------------------------------
177- #-----------------------------------------------------------------------------
178- #-----------------------------------------------------------------------------
179182
180- #---------------------------------------------
181- #---------------------------------------------
182- # Perl
183- #---------------------------------------------
184- #---------------------------------------------
185- include (FindPerl )
186- if (NOT PERL_EXECUTABLE)
187- message (FATAL_ERROR "perl NOT FOUND - Please check your Perl installation." )
188- endif ()
183+ find_package (Perl REQUIRED )
189184
190185#---------------------------------------------
191186#---------------------------------------------
@@ -224,16 +219,6 @@ endif()
224219add_definitions (-DPGSQL_VERSION=${PGSQL_VERSION} )
225220message (STATUS "PGSQL_VERSION=${PGSQL_VERSION} " )
226221
227-
228- #---------------------------------------------
229- #---------------------------------------------
230- # Boost
231- #---------------------------------------------
232- #---------------------------------------------
233-
234- include_directories (SYSTEM ${Boost_INCLUDE_DIRS} )
235-
236-
237222#---------------------------------------------
238223if (PROJECT_DEBUG)
239224 message (STATUS "PERL_VERSION_STRING = ${PERL_VERSION_STRING} " )
0 commit comments