cppcheck/cli
Olivier Croquette b05ae44edb Fix link error when building with MinGW about __imp_PathFileExistsA (#1310)
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.
2018-07-15 22:26:02 +02:00
..
CMakeLists.txt Fix link error when building with MinGW about __imp_PathFileExistsA (#1310) 2018-07-15 22:26:02 +02:00
cli.vcxproj also generate debug information when building for release. This makes (#1003) 2017-11-29 08:31:30 +01:00
cli.vcxproj.filters Fixed Visual Studio build after pathmatch.h/cpp was moved to lib, fixed compiler errors about getcwd 2016-10-02 15:48:03 +02:00
cmdlineparser.cpp Import BCB6 projects (#1245) 2018-05-20 18:19:20 +02:00
cmdlineparser.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
cppcheckexecutor.cpp Refactoring. Rename methods 2018-04-23 12:39:47 +02:00
cppcheckexecutor.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
filelister.cpp Improve constness 2018-04-04 21:02:13 +02:00
filelister.h Updated copyright year 2018-01-14 15:37:52 +01:00
main.cpp Set version to 1.84.99/1.85 dev 2018-06-25 21:03:43 +02:00
threadexecutor.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
threadexecutor.h Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
version.rc Update cli/version.rc 2012-10-15 11:28:08 -05:00