<div dir="ltr">In general I don't understand why CMake provides a separate integration for each tool (<LANG>_CLANG_TIDY <LANG>_COMPILER_LAUNCHER <LANG>_CPPCHECK <LANG>_CPPLINT <LANG>_INCLUDE_WHAT_YOU_USE),<div><br></div><div>But a generic solution is not provided (or not documented clearly? )</div></div><br><div class="gmail_quote"><div dir="ltr">вт, 31 июл. 2018 г. в 9:47, Roman Popov <<a href="mailto:ripopov@gmail.com">ripopov@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">After day of googling I've found a solution that almost works for me. <div><br></div><div>There is a CXX_CLANG_TIDY property that enables clang-tidy on a target. <a href="https://cmake.org/cmake/help/v3.12/prop_tgt/LANG_CLANG_TIDY.html" target="_blank">https://cmake.org/cmake/help/v3.12/prop_tgt/LANG_CLANG_TIDY.html</a></div><div>But I can replace clang-tidy with my own Clang-based tool:</div><div><br></div><div><div>set(CLANG_TIDY_EXE ${MY_CLANG_BASED_TOOL} )</div><div>set(DO_CLANG_TIDY "${<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">CLANG_TIDY_EXE</span>}" " --my-additional-options")</div><div><br></div><div>set_target_properties(<br></div><div> my_exe_target PROPERTIES</div><div> CXX_CLANG_TIDY "${DO_CLANG_TIDY}"</div><div>)</div></div><div><br></div><div>The only drawback is that my tool will be run together with <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">my_exe_target build. And I want to run it as a separate build target. </span></div><div><a href="https://stackoverflow.com/questions/51618307/how-to-run-clang-based-tool-as-a-separate-cmake-target" target="_blank">https://stackoverflow.com/questions/51618307/how-to-run-clang-based-tool-as-a-separate-cmake-target</a></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">пн, 30 июл. 2018 г. в 0:12, Roman Popov <<a href="mailto:ripopov@gmail.com" target="_blank">ripopov@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>How can I get a full compiler command line for a given target in CMakeLists project? I want to run Clang-based tool on some targets (using CTest), and it requires same options as used during compilation. </div><div><br></div><div>I know there is CMAKE_EXPORT_COMPILE_COMMANDS but it is not taget-specific.</div><div><br></div><div>There is a similar question on stackoverflow: <a href="https://stackoverflow.com/questions/35808209/get-full-c-compiler-command-line" target="_blank">https://stackoverflow.com/questions/35808209/get-full-c-compiler-command-line</a></div><div>Here author suggets to use get_target_property on a target. I've tried this, but it does not work when some properties are inherited from libraries (for example include paths).</div><div><br></div><div>Do you have any ideas?</div><div><br></div><div>Thanks,</div><div>Roman</div></div>
</blockquote></div>
</blockquote></div>