Skip to content

cfg: add relative location of Cppcheck config location to search path #7532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andresailer
Copy link

We are installing cppcheck on a distributed filesystem (CVMFS) in various locations.

Since the cppcheck cfg files are installed into ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} it would be great if we could use the fact that the share folder is relative to the executable, so that we can relocate cppcheck easily.

Defining FILESDIR(_DEF) does not work for this, since we cannot change this after compilation, and we do not know a priory where the installation will be. We compile cppcheck once and install it on many locations.

Thanks!

@firewave
Copy link
Collaborator

Thanks for your contribution.

This is a rather arbitrary addition and needs to be handled differently. Off the top of my head I cannot think of one right now.

It also applies to all external files not just cfg.

I am still in the midst of cleaning up and aligning the lookup handling - I cannot remember if it stalled or if I got side-tracked by more pressing things.

@danmar
Copy link
Owner

danmar commented May 16, 2025

Two questions:

  • you CAN install cppcheck binary and all the datafiles in a installation folder.. I wonder if you don't install cppcheck in some standard /usr/bin etc folder anyway then why not install it all in a installation folder.
  • How about allowing that you configure a relative path for FILESDIR such as "../share/Cppcheck" ?

@firewave
Copy link
Collaborator

I have not thought much about this yet. I was thinking along indicating the prefix which is used during install.

And the suggested change is kinda of valid because it is what we use in the install. Maybe it should be dependent on FILESDIR and not be used by default.

I always get a very bad feeling when I see hard-coded path traversal in the code. IMO it should always be a fixed (not necessarily absolute path).

There might be some existing tickets which already have discussions in it - I have not checked yet.

@firewave
Copy link
Collaborator

FYI I am hesitant in adding anything to the file lookup because the existing behavior is neither consistent nor clearly defined right now.

@firewave
Copy link
Collaborator

I resumed work on the lookup cleanup and will be looking into this soon (hopefully).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants