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),
But a generic solution is not provided (or not documented clearly? ) вт, 31 июл. 2018 г. в 9:47, Roman Popov <ripo...@gmail.com>: > After day of googling I've found a solution that almost works for me. > > There is a CXX_CLANG_TIDY property that enables clang-tidy on a target. > https://cmake.org/cmake/help/v3.12/prop_tgt/LANG_CLANG_TIDY.html > But I can replace clang-tidy with my own Clang-based tool: > > set(CLANG_TIDY_EXE ${MY_CLANG_BASED_TOOL} ) > set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" " --my-additional-options") > > set_target_properties( > my_exe_target PROPERTIES > CXX_CLANG_TIDY "${DO_CLANG_TIDY}" > ) > > The only drawback is that my tool will be run together with my_exe_target > build. And I want to run it as a separate build target. > > https://stackoverflow.com/questions/51618307/how-to-run-clang-based-tool-as-a-separate-cmake-target > > > пн, 30 июл. 2018 г. в 0:12, Roman Popov <ripo...@gmail.com>: > >> Hi all, >> >> 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. >> >> I know there is CMAKE_EXPORT_COMPILE_COMMANDS but it is not >> taget-specific. >> >> There is a similar question on stackoverflow: >> https://stackoverflow.com/questions/35808209/get-full-c-compiler-command-line >> 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). >> >> Do you have any ideas? >> >> Thanks, >> Roman >> >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake