mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	use C++17 if available when configuring with cmake
This commit is contained in:
		
							parent
							
								
									e0cb26bd9e
								
							
						
					
					
						commit
						ed574f9d79
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -184,16 +184,16 @@ else()
 | 
			
		|||
  set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,--gc-sections" ) # -flto is added from above
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
# check for c++11 support
 | 
			
		||||
# check for c++17 & c++11 support
 | 
			
		||||
include(CheckCXXCompilerFlag)
 | 
			
		||||
CHECK_CXX_COMPILER_FLAG("-std=c++17" CXX17_SUPPORTED)
 | 
			
		||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX11_SUPPORTED)
 | 
			
		||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" CXX0X_SUPPORTED)
 | 
			
		||||
if (CXX11_SUPPORTED)
 | 
			
		||||
if (CXX17_SUPPORTED)
 | 
			
		||||
  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17" )
 | 
			
		||||
elseif (CXX11_SUPPORTED)
 | 
			
		||||
  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
 | 
			
		||||
elseif (CXX0X_SUPPORTED) # gcc 4.6
 | 
			
		||||
  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
 | 
			
		||||
elseif (NOT MSVC)
 | 
			
		||||
  message(SEND_ERROR "C++11 standard not seems to be supported by compiler. Too old version?")
 | 
			
		||||
else
 | 
			
		||||
  message(SEND_ERROR "C++17 nor C++11 standard not seems to be supported by compiler. Too old version?")
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue