cmakecpplint

Passing cpplint command line attributes through make


I have a small cmake project. I added cpplint to compilation and it is working fine. I am adding a command line parameter to cpplint invocation.

find_program(CPPLINT_EXECUTABLE cpplint)

if(CPPLINT_EXECUTABLE)
    set(CMAKE_CXX_CPPLINT "${CPPLINT_EXECUTABLE} --quiet")
    set(CMAKE_CXX_CPPLINT_EXTENSIONS "*.cc; *.h")
 else()
    message(WARNING "cpplint not found.")
endif()

And it is failing. I am running cmake version 3.30.2

Error running '/usr/local/bin/cpplint --quiet': no such file or directory
make[2]: *** [src/CMakeFiles/libxdemo.dir/xdemo.cc.o] Error 1
make[1]: *** [src/CMakeFiles/libxdemo.dir/all] Error 2

Solution

  • Just

    set(CMAKE_CXX_CPPLINT ${CPPLINT_EXECUTABLE} --quiet)
    

    It's not one argument, it's a list.