You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.4 KiB
38 lines
1.4 KiB
###########################################################################
|
|
#
|
|
# Copyright 2016 Realm Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
###########################################################################
|
|
|
|
option(SANITIZE_ADDRESS "build with ASan")
|
|
option(SANITIZE_THREAD "build with TSan")
|
|
option(SANITIZE_UNDEFINED "build with UBSan")
|
|
|
|
if(SANITIZE_ADDRESS)
|
|
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=address")
|
|
endif()
|
|
|
|
if(SANITIZE_THREAD)
|
|
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=thread")
|
|
endif()
|
|
|
|
if(SANITIZE_UNDEFINED)
|
|
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=undefined")
|
|
endif()
|
|
|
|
if(SANITIZE_ADDRESS OR SANITIZE_THREAD OR SANITIZE_UNDEFINED)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS} -fno-omit-frame-pointer")
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
|
|
endif()
|
|
|