Enable building git2.rc resource script with GCC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 481707c..2aea589 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -278,10 +278,12 @@ list(SORT SRC_H)
# On Windows use specific platform sources
if(WIN32 AND NOT CYGWIN)
- if(MSVC)
- SET(WIN_RC "win32/git2.rc")
+ if(NOT MSVC)
+ ADD_DEFINITIONS(-DGCC_WINDRES)
endif()
+ SET(WIN_RC "win32/git2.rc")
+
file(GLOB SRC_OS win32/*.c win32/*.h)
list(SORT SRC_OS)
elseif(AMIGA)
diff --git a/src/win32/git2.rc b/src/win32/git2.rc
index 3571bc6..1379379 100644
--- a/src/win32/git2.rc
+++ b/src/win32/git2.rc
@@ -9,7 +9,18 @@
# define LIBGIT2_COMMENTS "For more information visit http://libgit2.github.com/"
#endif
+#ifdef GCC_WINDRES
+# define STRINGIZE(x) #x
+# define STRINGIZE_(x) STRINGIZE(x)
+#else
+# define STRINGIZE_(x) x
+#endif
+
+#ifdef GCC_WINDRES
+VS_VERSION_INFO VERSIONINFO
+#else
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
+#endif
FILEVERSION LIBGIT2_VER_MAJOR,LIBGIT2_VER_MINOR,LIBGIT2_VER_REVISION,LIBGIT2_VER_PATCH
PRODUCTVERSION LIBGIT2_VER_MAJOR,LIBGIT2_VER_MINOR,LIBGIT2_VER_REVISION,LIBGIT2_VER_PATCH
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
@@ -29,9 +40,9 @@ BEGIN
BEGIN
VALUE "FileDescription", "libgit2 - the Git linkable library\0"
VALUE "FileVersion", LIBGIT2_VERSION "\0"
- VALUE "InternalName", LIBGIT2_FILENAME ".dll\0"
+ VALUE "InternalName", STRINGIZE_(LIBGIT2_FILENAME) ".dll\0"
VALUE "LegalCopyright", "Copyright (C) the libgit2 contributors. All rights reserved.\0"
- VALUE "OriginalFilename", LIBGIT2_FILENAME ".dll\0"
+ VALUE "OriginalFilename", STRINGIZE_(LIBGIT2_FILENAME) ".dll\0"
VALUE "ProductName", "libgit2\0"
VALUE "ProductVersion", LIBGIT2_VERSION "\0"
VALUE "Comments", LIBGIT2_COMMENTS "\0"