-1

I am a newbie in CMake.

In my previous complie tools waf. it provide me a cpplint.py script that can check cpp source file's format, and make complie failed if the format is not good.

but i want to switch to Cmake. I googled this, but seems still cant make it work.

Can anyone tell me how to run cpplint.py when i make by cmake?

it will be of great help for me if you can list an example.

Thanks a lot

3
  • 1
    The first output of googling for "cmake cpplint" gives that question. Have you checked it? Commented Feb 7, 2021 at 15:53
  • @Tsyvarev thanks for attention, i read that answer, but still not work for me. i do as the first two answers, but cpplint doesnt work Commented Feb 8, 2021 at 0:18
  • Please, edit the question post and describe what exactly have you tried: the code and the behavior which contradicts to your expectations. Also, specify which CMake version do you use: e.g. variable CMAKE_CXX_CPPLINT appears only in CMake 3.8. Commented Feb 8, 2021 at 7:05

1 Answer 1

0

I recommend to not try to run the linter through cmake and to instead keep cmake purely for building. You could for example use a shell script to run both linter and build in one command:

#!/bin/sh

set -e   # makes script fail if any subprocess fails

python cpplint.py OPTIONS
cmake OPTIONS
cmake --build OPTIONS
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.