title: clang-tidy can't find the target's public headers
body: <p>I have a cmake project on Windows which uses <code>JOM</code> as the generator and <code>MSVC 19</code> as the compiler. Now I'm trying to add <code>clang-tidy</code> checks to some of my targets in this project. Here is part of my code to enable clang-tidy:</p>
  <pre><code>    if ( CLANG_TIDY_EXE )
          set( _clang_tidy_checkable_headers_abs_path_list ${_tgt_cmn_ct_PUBLIC_INCLUDE_ABS_PATH_LIST} )
          list( APPEND _clang_tidy_checkable_headers_abs_path_list ${_tgt_cmn_ct_PRIVATE_INCLUDE_ABS_PATH_LIST} )
          #Don't check autogenerated headers
          list( FILTER _clang_tidy_checkable_headers_abs_path_list EXCLUDE REGEX &quot;generated/.+&quot; )
  
          #Clang-tidy is looking for just the header names!
          foreach ( path IN ITEMS ${_clang_tidy_checkable_headers_abs_path_list} )
              get_filename_component( FILE_NAME ${path} NAME )
              list( APPEND HEADERS ${FILE_NAME} )
          endforeach ()
  
          #Create a regex containing headers name
          set( HEADER_FILTER_REGEX &quot;&quot; )
          string( JOIN &quot;|&quot; HEADER_FILTER_REGEX ${HEADERS} )
          string( REPLACE &quot;.&quot;
              &quot;\\.&quot; HEADER_FILTER_REGEX
              ${HEADER_FILTER_REGEX} )
  
          string( PREPEND HEADER_FILTER_REGEX &quot;(&quot; )
          string( APPEND HEADER_FILTER_REGEX &quot;)&quot; )
  
          #--extra-arg=/EHsc is to get rid of the `clang-diagnostic-error` warning on Windows regarding disabled exceptions!
          set_target_properties(
              ${IN_TARGET_NAME} PROPERTIES
              CXX_CLANG_TIDY &quot;${DO_CLANG_TIDY};--header-filter=${HEADER_FILTER_REGEX};-p=${CMAKE_BINARY_DIR}/compile_commands.json;--extra-arg=/EHsc&quot;
          )
  </code></pre>
  <p>In the above code I basically created a regex out of the private and public headers that I would check by clang-tidy and passed it to the <code>--header-filter</code> argument. Also as you can see I've provided path to the <code>compile_commands.json</code> file as well. But I'm getting following error once I build a target with clang_tidy enabled:</p>
  <pre><code>error: 'project_x/common/loggerWrapper/loggerWrapper.hpp' file not found [clang-diagnostic-error]
  </code></pre>
  <p>Note that this <code>loggerWrapper.hpp</code> is actually one of the files I listed in the regex.
  The interesting point here is that the above solution works perfectly with <code>Ninja</code> but not with <code>JOM</code>.</p>
  <p>Any ideas what might be the problem?</p>