diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2014-12-01 23:18:34 +0000 |
---|---|---|
committer | Rui Abreu Ferreira <raf-ep@gmx.com> | 2014-12-02 14:36:47 +0000 |
commit | 823a7ae61a5907773a414aca94285519d7d8dabb (patch) | |
tree | 6dd6a6abb867ee26fb0531d6536e369759379bcd | |
parent | 6e9af3c5dce22a0822f655b4d1ea05bac6f7232a (diff) | |
download | rneovim-823a7ae61a5907773a414aca94285519d7d8dabb.tar.gz rneovim-823a7ae61a5907773a414aca94285519d7d8dabb.tar.bz2 rneovim-823a7ae61a5907773a414aca94285519d7d8dabb.zip |
Only use SANITIZE for nvim target
- Clang's Address Sanitizer options may cause problems when running
the unit tests, restrict the use of these options to the nvim target.
-rw-r--r-- | src/nvim/CMakeLists.txt | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index b0618fc69a..28f2b065fb 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -94,20 +94,6 @@ endforeach() set_source_files_properties( ${CONV_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion") -option(SANITIZE "Enable sanitizers when using Clang" OFF) -if(CMAKE_C_COMPILER_ID MATCHES "Clang") - if(SANITIZE) - message(STATUS "Enabling the sanitizers") - add_definitions(-DEXITFREE) # is this necessary for LeakSanitizer? - add_definitions(-fno-sanitize-recover -fno-omit-frame-pointer - -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined) - set(CMAKE_EXE_LINKER_FLAGS - "-fsanitize=address -fsanitize=undefined ${CMAKE_EXE_LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS - "-fsanitize=address -fsanitize=undefined ${CMAKE_SHARED_LINKER_FLAGS}") - endif() -endif() - get_directory_property(gen_cdefs COMPILE_DEFINITIONS) foreach(gen_cdef ${gen_cdefs}) set(gen_cflags "${gen_cflags} -D${gen_cdef}") @@ -203,6 +189,16 @@ add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES} target_link_libraries(nvim ${NVIM_LINK_LIBRARIES}) install_helper(TARGETS nvim) +option(SANITIZE "Enable sanitizers when using Clang" OFF) +if(CMAKE_C_COMPILER_ID MATCHES "Clang") + if(SANITIZE) + message(STATUS "Enabling the sanitizers") + set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ") + set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-sanitize-recover -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined ") + set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=address -fsanitize=undefined ") + endif() +endif() + add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES} ${NEOVIM_HEADERS}) target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES}) |