-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
I have to compile zlib off my source tree an install the output into my project. I use this CMakeLists.txt for that:
# https://github.com/madler/zlib.git
# Tag 1.2.11
# mkdir build && cd build && cmake -G "MinGW Makefiles" ..
# cmake --build . -j8
# cmake --install .
set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Install in project folder" FORCE )
add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib/build )
On Windows10 (64bit) and MinGW compiler (TDM-GCC 9.2) and CMake 3.19.4 I get errors when build process reaches "example" and "minigzip". For both the "zlib.h" is missing.
When I change CMakeLists.txt of zlib:
#============================================================================
# Example binaries
#============================================================================
add_executable(example test/example.c)
target_link_libraries(example zlib)
# Bugfix (1 line):
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_test(example example)
add_executable(minigzip test/minigzip.c)
target_link_libraries(minigzip zlib)
if(HAVE_OFF64_T)
add_executable(example64 test/example.c)
target_link_libraries(example64 zlib)
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
add_test(example64 example64)
add_executable(minigzip64 test/minigzip.c)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()
All works fine.
Regards,
Andreas
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels