mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 | 
						|
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
 | 
						|
    message(FATAL_ERROR "Clang 16+ required for building clio")
 | 
						|
  endif ()
 | 
						|
  set(is_clang TRUE)
 | 
						|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 | 
						|
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
 | 
						|
    message(FATAL_ERROR "AppleClang 15+ required for building clio")
 | 
						|
  endif ()
 | 
						|
  set(is_appleclang TRUE)
 | 
						|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 | 
						|
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12)
 | 
						|
    message(FATAL_ERROR "GCC 12+ required for building clio")
 | 
						|
  endif ()
 | 
						|
  set(is_gcc TRUE)
 | 
						|
else ()
 | 
						|
  message(FATAL_ERROR "Supported compilers: AppleClang 15+, Clang 16+, GCC 12+")
 | 
						|
endif ()
 | 
						|
 | 
						|
if (san)
 | 
						|
  string(TOLOWER ${san} san)
 | 
						|
  set(SAN_FLAG "-fsanitize=${san}")
 | 
						|
  set(SAN_LIB "")
 | 
						|
  if (is_gcc)
 | 
						|
    if (san STREQUAL "address")
 | 
						|
      set(SAN_LIB "asan")
 | 
						|
    elseif (san STREQUAL "thread")
 | 
						|
      set(SAN_LIB "tsan")
 | 
						|
    elseif (san STREQUAL "memory")
 | 
						|
      set(SAN_LIB "msan")
 | 
						|
    elseif (san STREQUAL "undefined")
 | 
						|
      set(SAN_LIB "ubsan")
 | 
						|
    endif ()
 | 
						|
  endif ()
 | 
						|
  set(_saved_CRL ${CMAKE_REQUIRED_LIBRARIES})
 | 
						|
  set(CMAKE_REQUIRED_LIBRARIES "${SAN_FLAG};${SAN_LIB}")
 | 
						|
  check_cxx_compiler_flag(${SAN_FLAG} COMPILER_SUPPORTS_SAN)
 | 
						|
  set(CMAKE_REQUIRED_LIBRARIES ${_saved_CRL})
 | 
						|
  if (NOT COMPILER_SUPPORTS_SAN)
 | 
						|
    message(FATAL_ERROR "${san} sanitizer does not seem to be supported by your compiler")
 | 
						|
  endif ()
 | 
						|
endif ()
 |