Skip to content

Commit

Permalink
Use CMake option rather than env var
Browse files Browse the repository at this point in the history
To find non-standard check_clang_tidy.py, was previously using an
environment variable.  Switch to a CMake option instead, so that it's
not necessary to set the env var wherever you run the plugins tests.
  • Loading branch information
jbytheway committed Jun 19, 2019
1 parent 5c72b74 commit 41f4086
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ option(LOCALIZE "Support for language localizations. Also enable UTF support
option(LANGUAGES "Compile localization files for specified languages." "" )
option(DYNAMIC_LINKING "Use dynamic linking. Or use static to remove MinGW dependency instead." "ON")
option(CATA_CLANG_TIDY_PLUGIN "Build Cata's custom clang-tidy plugin" "OFF")
set(LLVM_INCLUDE_DIRS "" CACHE STRING "Paths to llvm and clang headers used for clang-tidy plugin")
set(CATA_CLANG_TIDY_INCLUDE_DIR "" CACHE STRING "Path to internal clang-tidy headers required for plugin (e.g. ClangTidy.h)")
set(CATA_CHECK_CLANG_TIDY "" CACHE STRING "Path to check_clang_tidy.py for plugin tests")
set(GIT_BINARY "" CACHE STRING "Git binary name or path.")
set(PREFIX "" CACHE STRING "Location of Data & GFX directories")

Expand Down
5 changes: 3 additions & 2 deletions tools/clang-tidy-plugin/test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ config.test_exec_root = os.path.join(

config.suffixes = ['.cpp']

check_clang_tidy = os.getenv('CHECK_CLANG_TIDY')
if not check_clang_tidy:
if config.cata_check_clang_tidy:
check_clang_tidy = config.cata_check_clang_tidy
else:
check_clang_tidy = os.path.join(
config.plugin_build_root, 'clang-tidy-plugin-support', 'bin',
'check_clang_tidy.py')
Expand Down
1 change: 1 addition & 0 deletions tools/clang-tidy-plugin/test/lit.site.cfg.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

config.plugin_build_root = "@CMAKE_CURRENT_BINARY_DIR@"
config.cata_check_clang_tidy = "@CATA_CHECK_CLANG_TIDY@"

lit_config.load_config(
config, os.path.join("@CMAKE_CURRENT_SOURCE_DIR@", "test", "lit.cfg"))

0 comments on commit 41f4086

Please sign in to comment.