cmake-lint icon indicating copy to clipboard operation
cmake-lint copied to clipboard

Fix for issue 26: Default to CMakeLists.txt in current directory

Open shanebishop opened this issue 5 years ago • 5 comments

shanebishop avatar Jun 01 '19 00:06 shanebishop

The patch looks ok. I wonder though if this is good behavior in cases a project has split the build logic into multiple smaller .cmake files. The explicit command means when a file is not checked, it's the fault of the user. If we provide logic, it would become our fault.

Did you consider this case, and consider to also scanning for .cmake files?

tkruse avatar Jun 01 '19 09:06 tkruse

@tkruse There are a couple things to consider:

  • Would we want to recursively search every subdirectory of the directory cmakelint is invoked in for all files matching CMakeLists.txt and *.cmake?
  • How ought we to differentiate between .cmake files that are generated by cmake itself, and .cmake files that are user-defined? It would be undesirable for users to be given warnings for .cmake files that were autogenerated by cmake.

shanebishop avatar Jun 01 '19 14:06 shanebishop

I don't know myself. If the command is to try and guess the intention of a user who does not specify the file, we can only make reasonable assumptions and decide whether to be more bold or more conservative in including files. I don't work with cmake enough to have any strong opinion on these questions, I am fine with merging the lines as they are now, just wanted to mention this possibility.

tkruse avatar Jun 01 '19 15:06 tkruse

I think this is probably a reasonable default for now.

shanebishop avatar Jun 01 '19 15:06 shanebishop

copied to https://github.com/cmake-lint/cmake-lint/pull/2

tkruse avatar Jun 08 '19 09:06 tkruse