Ver Fonte

xplat: fix sanitizer builds

Oguz Bastemur há 8 anos atrás
pai
commit
7d43794eb6
3 ficheiros alterados com 13 adições e 12 exclusões
  1. 12 7
      CMakeLists.txt
  2. 0 4
      pal/src/CMakeLists.txt
  3. 1 1
      pal/src/configure.cmake

+ 12 - 7
CMakeLists.txt

@@ -348,13 +348,6 @@ if(CLR_CMAKE_PLATFORM_XPLAT)
     if(CMAKE_BUILD_TYPE STREQUAL Release)
         add_compile_options(-fno-rtti)
     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)
@@ -479,6 +472,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

+ 0 - 4
pal/src/CMakeLists.txt

@@ -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)

+ 1 - 1
pal/src/configure.cmake

@@ -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)