Skip to content
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

Cmake warning #37

Closed
vsoch opened this issue Jul 16, 2021 · 4 comments
Closed

Cmake warning #37

vsoch opened this issue Jul 16, 2021 · 4 comments

Comments

@vsoch
Copy link
Member

vsoch commented Jul 16, 2021

Just noticed a cmake warning that we have an un-used variable:

CMake Warning:
Manually-specified variables were not used by the project:

    symtabAPI_DIR


-- Build files have been written to: /Smeagle-0.0.0.2/build

Should be pretty easy to fix.

@hermantrym
Copy link

I think it is necessary to define the same macros as in the if and else if branches. Even if you don’t use another compiler than Visual Studio, gcc or clang today, it would be a shame to halt the compilation on another compiler just because you didn’t define the macros for it.

Or perhaps you don’t want your code to run on a compiler you don’t officially support. In any case, if this is what you want then a better option is to write somewhere else some specific macro-code to prevent the code from compile on non-supported compilers.

#if defined(_MSC_VER)
#define DISABLE_WARNING_PUSH __pragma(warning( push ))
#define DISABLE_WARNING_POP __pragma(warning( pop ))
#define DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber ))

#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER    DISABLE_WARNING(4100)
#define DISABLE_WARNING_UNREFERENCED_FUNCTION            DISABLE_WARNING(4505)
// other warnings you want to deactivate...

#elif defined(GNUC) || defined(clang)
#define DO_PRAGMA(X) _Pragma(#X)
#define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
#define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
#define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)

#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER    DISABLE_WARNING(-Wunused-parameter)
#define DISABLE_WARNING_UNREFERENCED_FUNCTION            DISABLE_WARNING(-Wunused-function)

// other warnings you want to deactivate...

#else
#define DISABLE_WARNING_PUSH
#define DISABLE_WARNING_POP
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER
#define DISABLE_WARNING_UNREFERENCED_FUNCTION
// other warnings you want to deactivate...

#endif

@vsoch
Copy link
Member Author

vsoch commented Jul 17, 2021

Hi! Who are you? And how are these macros related to removing an undefined symbol? Thanks!

@hainest
Copy link
Collaborator

hainest commented Jul 19, 2021

@hermantrym Smeagle uses Dyninst, and Dyninst doesn't work on 64-bit Windows. There's no need to support MSVC here.

@vsoch find_package(Foo) uses the variable Foo_DIR to start as a search directory. In the container, Dyninst is in the default system paths, so it doesn't need this. Dyninst's CMake system doesn't use symtabAPI_DIR, so CMake let's you know you have an unused variable.

@vsoch
Copy link
Member Author

vsoch commented Jul 19, 2021

Fixed with #38

@vsoch vsoch closed this as completed Jul 19, 2021
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

No branches or pull requests

3 participants