From 6e9af3c5dce22a0822f655b4d1ea05bac6f7232a Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Mon, 1 Dec 2014 10:25:40 +0000 Subject: Don't use env vars for configuration time options - As a general rule of thumb one shouldn't use environment variables for setting configuration options for CMake. The reason for this is we don't know when CMake will be executed and re-evaluate that variable. - e.g. If we run cmake a first time with a var set, and then run make on a second session (with no var) and cmake is called because a dependency changed, the option would be disabled - This commit removes the use of environment vars from src/nvim/CMakeLists.txt entirely - Removed SKIP_UNITTEST since it could only be used to remove a target at configuration time (and the target was optional anyway) - Turned SANITIZE into an option, clang-asan.sh now passes cmake -DSANITIZE=ON - Removed SKIP_EXEC since it was disabling a target at configuration time (not being used) --- src/nvim/CMakeLists.txt | 19 ++++++++----------- src/nvim/po/CMakeLists.txt | 3 +-- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 184bcc0548..b0618fc69a 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -94,8 +94,9 @@ 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(DEFINED ENV{SANITIZE}) + if(SANITIZE) message(STATUS "Enabling the sanitizers") add_definitions(-DEXITFREE) # is this necessary for LeakSanitizer? add_definitions(-fno-sanitize-recover -fno-omit-frame-pointer @@ -197,17 +198,13 @@ list(APPEND NVIM_LINK_LIBRARIES m ${CMAKE_THREAD_LIBS_INIT}) -if(NOT DEFINED ENV{SKIP_EXEC}) - add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES} - ${NEOVIM_HEADERS}) - target_link_libraries(nvim ${NVIM_LINK_LIBRARIES}) - install_helper(TARGETS nvim) -endif() +add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES} + ${NEOVIM_HEADERS}) +target_link_libraries(nvim ${NVIM_LINK_LIBRARIES}) +install_helper(TARGETS nvim) -if(NOT DEFINED ENV{SKIP_UNITTEST}) - add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES} +add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES} ${NEOVIM_HEADERS}) - target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES}) -endif() +target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES}) add_subdirectory(po) diff --git a/src/nvim/po/CMakeLists.txt b/src/nvim/po/CMakeLists.txt index 6a56e302e9..443f3c6595 100644 --- a/src/nvim/po/CMakeLists.txt +++ b/src/nvim/po/CMakeLists.txt @@ -2,8 +2,7 @@ find_package(Gettext) find_program(XGETTEXT_PRG xgettext) find_program(ICONV_PRG iconv) -if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG AND - NOT DEFINED ENV{SKIP_EXEC}) +if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG) set(ENV{OLD_PO_FILE_INPUT} yes) set(ENV{OLD_PO_FILE_OUTPUT} yes) -- cgit