title: error: unable to handle compilation, expected exactly one compiler job in '' [clang-diagnostic-error]
body: <p>Build fails without much helpful information after I've added this into my CmakeLists.txt to enable clang-tidy checks:</p>
  <pre><code>if(ENABLE_CLANG_TIDY)
    find_program(CLANGTIDY clang-tidy)
    if(CLANGTIDY)
      set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
      set(CMAKE_CXX_CLANG_TIDY &quot;${CLANGTIDY};-extra-arg=-Wno-unknown-warning-option;-header-filter=${CMAKE_SOURCE_DIR}/src/*;&quot;)
    else()
      message(SEND_ERROR &quot;clang-tidy requested but executable not found&quot;)
    endif()
  endif()
  </code></pre>
  <p>but then, when I call <code>cmake -DENABLE_CLANG_TIDY=ON .. &amp;&amp; make</code> the build process stops on 2% with minimum explanations of what is wrong. Here is the most meaningful parts of it:</p>
  <pre><code>make[2]: Leaving directory '/path/to/module/build'
  make  -f src/CMakeFiles/module.dir/build.make src/CMakeFiles/module.dir/build
  make[2]: Entering directory '/path/to/module/build'
  [  2%] Building CXX object src/CMakeFiles/module.dir/api/base_controller.cpp.o
  cd /path/to/module/build/src &amp;&amp; ccache /usr/local/bin/cmake -E __run_co_compile --tidy=&quot;/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-header-filter=/path/to/module/src/*;-p=/path/to/module/src;;--extra-arg-before=--driver-mode=g++&quot; --source=/path/to/module/src/api/base_controller.cpp -- /usr/lib64/ccache/c++  -I/path/to/module/src -I/home/vagrant/.conan/data/catch2/2.11.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -DFAST_LOCK -D__CPU_x86_64 -DPKG_MALLOC -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC -DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS -DMALLOC_STATS -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT  -D_GNU_SOURCE -DCUSTOM_LOG_FMT -fPIC -Wall -Werror -Wextra -Wno-write-strings -Wno-format -g -Wextra -Wno-error=class-memaccess -Wno-error=implicit-fallthrough -O3 -DNDEBUG  -D_GLIBCXX_USE_CXX11_ABI=1 -o CMakeFiles/module.dir/api/base_controller.cpp.o -c /path/to/module/src/api/base_controller.cpp
  error: unable to handle compilation, expected exactly one compiler job in '' [clang-diagnostic-error]
  Error while processing some/path/src/.
  5481 warnings and 1 error generated.
  Error while processing some/path/src/api/file.cpp.
  Suppressed 5481 warnings (5403 in non-user code, 78 with check filters).
  Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
  Found compiler error(s).
  </code></pre>
  <p>Some notes:</p>
  <ol>
  <li>Without <code>ENABLE_CLANG_TIDY</code> flag, the project compiles just fine</li>
  <li>I've fixed errors that <code>clang-tidy</code> was reporting</li>
  </ol>