]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix CMakeLists.txt for cross compilation [McClure].
authorMark Adler <madler@alumni.caltech.edu>
Tue, 17 Jan 2012 01:39:54 +0000 (17:39 -0800)
committerMark Adler <madler@alumni.caltech.edu>
Tue, 17 Jan 2012 02:51:23 +0000 (18:51 -0800)
CMakeLists.txt

index ee25365ca85d126d80f548dbe3219d85c194a27b..0a56ff6f2992150e55f77366fa8af1bf95c3837b 100644 (file)
@@ -110,9 +110,14 @@ set(ZLIB_SRCS
     trees.c
     uncompr.c
     zutil.c
-    win32/zlib1.rc
 )
 
+if(NOT MINGW)
+    set(ZLIB_SRCS ${ZLIB_SRCS}
+        win32/zlib1.rc # If present will override custom build rule below.
+    )
+endif()
+
 # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
 file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
 string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9A-Za-z.]+)\".*"
@@ -120,6 +125,10 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9A-Za-z.]+)\".*"
 
 if(MINGW)
     # This gets us DLL resource information when compiling on MinGW.
+    if(NOT CMAKE_RC_COMPILER)
+        SET(CMAKE_RC_COMPILER windres.exe)
+    endif()
+
     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
                        COMMAND ${CMAKE_RC_COMPILER}
                             -D GCC_WINDRES