Skip to content

Commit

Permalink
[1.8>1.9] [MERGE #4601 @obastemur] xplat: fix sanitizer builds
Browse files Browse the repository at this point in the history
Merge pull request #4601 from obastemur:fix_bash_san
  • Loading branch information
obastemur committed Jan 26, 2018
2 parents 483cea6 + cc9e197 commit 9653b07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,6 @@ if(CLR_CMAKE_PLATFORM_XPLAT)
add_compile_options(-fno-rtti)
endif()
endif()

# Clang -fsanitize.
if (CLANG_SANITIZE_SH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${CLANG_SANITIZE_SH}")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsanitize=${CLANG_SANITIZE_SH}")
unset(CLANG_SANITIZE_SH CACHE) # don't cache
endif()
endif(CLR_CMAKE_PLATFORM_XPLAT)

if (ENABLE_FULL_LTO_SH OR ENABLE_THIN_LTO_SH)
Expand Down Expand Up @@ -484,6 +477,18 @@ if(ICU_INCLUDE_PATH)
endif()
endif()

# detect features
include_directories(SYSTEM /usr/local/include)
include(pal/src/configure.cmake)

# this should be after `detect feature` to not to affect feature detection
# Clang -fsanitize.
if (CLANG_SANITIZE_SH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${CLANG_SANITIZE_SH}")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsanitize=${CLANG_SANITIZE_SH}")
unset(CLANG_SANITIZE_SH CACHE) # don't cache
endif()

add_subdirectory (pal)

# build the rest with NO_PAL_MINMAX and PAL_STDCPP_COMPAT
Expand Down
4 changes: 0 additions & 4 deletions pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
cmake_minimum_required(VERSION 3.2)

include_directories(SYSTEM /usr/local/include)

include(configure.cmake)

project(chakrapal)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
Expand Down
2 changes: 1 addition & 1 deletion pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1041,4 +1041,4 @@ else() # ANDROID
set(ZH_TW_LOCALE_NAME zh_TW_LOCALE_NOT_FOUND)
set(HAS_FTRUNCATE_LENGTH_ISSUE 0)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pal/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/pal/src/config.h)

0 comments on commit 9653b07

Please sign in to comment.