Following error occurs when building with MinGW 7.2.0 and Ninja on Windows:
cli/CMakeFiles/cli_objs.dir/filelister.cpp.obj: In function `MyIsDirectory':
cppcheck-1.84\build/../cli/filelister.cpp:49: undefined reference to `__imp_PathIsDirectoryA'
cli/CMakeFiles/cli_objs.dir/filelister.cpp.obj: In function `MyFileExists':
cppcheck-1.84\build/../cli/filelister.cpp:67: undefined reference to `__imp_PathFileExistsA'
collect2.exe: error: ld returned 1 exit status
This is the corresponding code in filelister.cpp:
#ifdef _WIN32
// snip
static BOOL MyIsDirectory(const std::string& path)
{
#ifdef __BORLANDC__
return (GetFileAttributes(path.c_str()) & FILE_ATTRIBUTE_DIRECTORY);
#else
// See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
return PathIsDirectoryA(path.c_str());
#endif
}
static BOOL MyFileExists(const std::string& path)
{
#ifdef __BORLANDC__
DWORD fa = GetFileAttributes(path.c_str());
BOOL result = FALSE;
if (fa != INVALID_FILE_ATTRIBUTES && !(fa & FILE_ATTRIBUTE_DIRECTORY))
result = TRUE;
#else
const BOOL result = PathFileExistsA(path.c_str());
#endif
return result;
}
The else blocks assume that Shlwapi.lib is available on Windows except with Borland,
so the patch set ensures that the library is linked on the same condition.
The source files for the class library "TinyXML" will only be included into
the build of the command line interface if the library "PCRE" was found before.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
The support for check rules will be automatically included in the generated
software if build settings were accordingly selected for PCRE.
https://sourceforge.net/apps/trac/cppcheck/ticket/2679
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Apparently not everybody wants to use QMake to build cppcheck. Which is
understandable if you only want to hack on/build lib and cli. Qt and QMake are
pretty lot to install for just that.
So lets start using CMake. It is widely used and is "just" build system and not
programming framework. CMake is also easy to use for building Qt software too
so it can replace QMake.
This first commit only builds lib and cli for Linux.