Skip to content

Commit

Permalink
Fix CMakeLists.txt for cross compilation [McClure].
Browse files Browse the repository at this point in the history
  • Loading branch information
madler committed Jan 17, 2012
1 parent 2d55657 commit 509c1d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,25 @@ 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.]+)\".*"
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})

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
Expand Down

0 comments on commit 509c1d2

Please sign in to comment.