aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2014-12-01 10:25:40 +0000
committerRui Abreu Ferreira <raf-ep@gmx.com>2014-12-03 14:23:08 +0000
commit923d021c0f97740dfa35b3cb0d95f02987cdf4cc (patch)
tree84388477261a13e5bf612e30b58047b9aec39c1f
parentcb86eca91f9bdffe8b0214664169093d41902415 (diff)
downloadrneovim-923d021c0f97740dfa35b3cb0d95f02987cdf4cc.tar.gz
rneovim-923d021c0f97740dfa35b3cb0d95f02987cdf4cc.tar.bz2
rneovim-923d021c0f97740dfa35b3cb0d95f02987cdf4cc.zip
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)
-rw-r--r--.ci/clang-asan.sh4
-rw-r--r--src/nvim/CMakeLists.txt19
-rw-r--r--src/nvim/po/CMakeLists.txt3
3 files changed, 10 insertions, 16 deletions
diff --git a/.ci/clang-asan.sh b/.ci/clang-asan.sh
index b1909ea689..9cc2ad12ad 100644
--- a/.ci/clang-asan.sh
+++ b/.ci/clang-asan.sh
@@ -25,18 +25,16 @@ symbolizer=/usr/local/clang-$clang_version/bin/llvm-symbolizer
setup_prebuilt_deps x64
-export SANITIZE=1
export ASAN_SYMBOLIZER_PATH=$symbolizer
export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan"
export TSAN_OPTIONS="external_symbolizer_path=$symbolizer:log_path=$tmpdir/tsan"
-export SKIP_UNITTEST=1
export UBSAN_OPTIONS="log_path=$tmpdir/ubsan" # not sure if this works
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DUSE_GCOV=ON"
# Build and output version info.
-$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
+$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DSANITIZE=ON" nvim
build/bin/nvim --version
# Run functional tests.
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 2867857fb3..f97d007768 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
@@ -200,17 +201,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)