aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt58
1 files changed, 47 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 359a9f5180..fecfea8cdf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,8 +12,25 @@ list(APPEND NEOVIM_SOURCES "${PROJECT_BINARY_DIR}/config/auto/pathdef.c")
file( GLOB OS_SOURCES os/*.c )
-add_executable (nvim ${NEOVIM_SOURCES} ${OS_SOURCES})
-add_library (nvim-test MODULE ${NEOVIM_SOURCES} ${OS_SOURCES})
+if(CMAKE_C_COMPILER_ID MATCHES "Clang")
+ if(DEFINED ENV{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()
+
+if(NOT DEFINED ENV{SKIP_EXEC})
+ add_executable (nvim ${NEOVIM_SOURCES} ${OS_SOURCES})
+endif()
+if(NOT DEFINED ENV{SKIP_UNITTEST})
+ add_library (nvim-test MODULE ${NEOVIM_SOURCES} ${OS_SOURCES})
+endif()
# The libraries we link against for nvim
set(NVIM_LINK_LIBRARIES m ${LibUV_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
@@ -28,27 +45,46 @@ if (LibIntl_FOUND)
list(APPEND NVIM_LINK_LIBRARIES ${LibIntl_LIBRARY})
endif()
-target_link_libraries (nvim ${NVIM_LINK_LIBRARIES})
-target_link_libraries (nvim-test ${NVIM_LINK_LIBRARIES})
+if(NOT DEFINED ENV{SKIP_EXEC})
+ target_link_libraries (nvim ${NVIM_LINK_LIBRARIES})
+endif()
+if(NOT DEFINED ENV{SKIP_UNITTEST})
+ target_link_libraries (nvim-test ${NVIM_LINK_LIBRARIES})
+endif()
include(CheckLibraryExists)
check_library_exists(termcap tgetent "" HAVE_LIBTERMCAP)
if (HAVE_LIBTERMCAP)
- target_link_libraries(nvim termcap)
- target_link_libraries(nvim-test termcap)
+
+ if(NOT DEFINED ENV{SKIP_EXEC})
+ target_link_libraries(nvim termcap)
+ endif()
+ if(NOT DEFINED ENV{SKIP_UNITTEST})
+ target_link_libraries(nvim-test termcap)
+ endif()
else()
check_library_exists(curses tgetent "" HAVE_LIBCURSES)
if (HAVE_LIBCURSES)
- target_link_libraries(nvim curses)
- target_link_libraries(nvim-test curses)
+ if(NOT DEFINED ENV{SKIP_EXEC})
+ target_link_libraries(nvim curses)
+ endif()
+ if(NOT DEFINED ENV{SKIP_UNITTEST})
+ target_link_libraries(nvim-test curses)
+ endif()
else()
find_package(Curses REQUIRED)
- target_link_libraries(nvim ${CURSES_LIBRARIES})
- target_link_libraries(nvim-test ${CURSES_LIBRARIES})
+ if(NOT DEFINED ENV{SKIP_EXEC})
+ target_link_libraries(nvim ${CURSES_LIBRARIES})
+ endif()
+ if(DEFINED ENV{SKIP_UNITTEST})
+ target_link_libraries(nvim-test ${CURSES_LIBRARIES})
+ endif()
endif()
endif()
include_directories ("${PROJECT_SOURCE_DIR}/src/proto")
-install(TARGETS nvim RUNTIME DESTINATION bin)
+if(NOT DEFINED ENV{SKIP_EXEC})
+ install(TARGETS nvim RUNTIME DESTINATION bin)
+endif()