瀏覽代碼

Fix unclear error while accidentally sanitizing interface library

Interface libraries added since CMake 3.0 version have INTERFACE_SOURCES property instead of SOURCES so it leads to error which is unclear and prevents project from compiling. Warning would be enough it this case.
master
Andrey Dotsenko 7 年之前
父節點
當前提交
d093052a52
共有 1 個檔案被更改,包括 7 行新增0 行删除
  1. +7
    -0
      cmake/FindSanitizers.cmake

+ 7
- 0
cmake/FindSanitizers.cmake 查看文件

@@ -62,6 +62,13 @@ function(add_sanitizers ...)
foreach (TARGET ${ARGV})
# Check if this target will be compiled by exactly one compiler. Other-
# wise sanitizers can't be used and a warning should be printed once.
get_target_property(TARGET_TYPE ${TARGET} TYPE)
if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
"because it is an interface library and cannot be "
"compiled directly.")
return()
endif ()
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
if (NUM_COMPILERS GREATER 1)


Loading…
取消
儲存