message: Fix tsan and asan under clang too
diff: @@ -43,7 +43,7 @@ if(REALM_ASAN)
  message(FATAL_ERROR
  "The Address Sanitizer is not yet supported on Visual Studio builds")
  else()
  - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointern -O1 -g")
  + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -O1 -g")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
  endif()
  endif()
  @@ -57,8 +57,13 @@ if(REALM_TSAN)
  message(FATAL_ERROR
  "The Thread Sanitizer is not yet supported on Visual Studio builds")
  else()
  - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -O2 -g -fPIE -pie")
  + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -O2 -g -fPIE")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
  + # According to the clang docs, if -fsanitize=thread is specified then compiling
  + # and linking with PIE is turned on automatically.
  + if (CMAKE_COMPILER_IS_GNUXX)
  + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
  + endif()
  endif()
  endif()
  