Skip to content

Commit

Permalink
Revert "Merge branch 'zlib-finder' into 'master'"
Browse files Browse the repository at this point in the history
This reverts merge request !1040
  • Loading branch information
certik committed Jul 10, 2021
1 parent a0cd896 commit e07d222
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ set(LFORTRAN_STATIC_BIN no CACHE BOOL "Build LFortran as a static binary")
set(WITH_LFORTRAN_BINARY_MODFILES YES
CACHE BOOL "Use binary modfiles")

#ZLIB
find_package(ZLIB REQUIRED)

# LLVM
set(WITH_LLVM no CACHE BOOL "Build with LLVM support")
if (WITH_LLVM)
Expand Down Expand Up @@ -108,11 +111,6 @@ if (WITH_LLVM)
set(HAVE_LFORTRAN_LLVM yes)
endif()

# Find ZLIB dependency if not already included by LLVM
if(NOT TARGET ZLIB::ZLIB)
find_package(ZLIB REQUIRED)
endif()

# XEUS (Fortran kernel)
set(WITH_XEUS no CACHE BOOL "Build with XEUS support")
if (WITH_XEUS)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindZLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ find_library(ZLIB_LIBRARY NAMES libz.a z)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ZLIB DEFAULT_MSG ZLIB_INCLUDE_DIR ZLIB_LIBRARY)

add_library(ZLIB::ZLIB INTERFACE IMPORTED)
set_property(TARGET ZLIB::ZLIB PROPERTY INTERFACE_INCLUDE_DIRECTORIES
add_library(p::zlib INTERFACE IMPORTED)
set_property(TARGET p::zlib PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${ZLIB_INCLUDE_DIR})
set_property(TARGET ZLIB::ZLIB PROPERTY INTERFACE_LINK_LIBRARIES
set_property(TARGET p::zlib PROPERTY INTERFACE_LINK_LIBRARIES
${ZLIB_LIBRARY})

message("ZLIB_INCLUDE_DIR: ${ZLIB_INCLUDE_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion src/lfortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (WITH_LLVM)
endif()
endif()
add_library(lfortran_lib ${SRC})
target_link_libraries(lfortran_lib lfortran_runtime_static ZLIB::ZLIB)
target_link_libraries(lfortran_lib lfortran_runtime_static p::zlib)
target_include_directories(lfortran_lib BEFORE PUBLIC ${lfortran_SOURCE_DIR}/src)
target_include_directories(lfortran_lib BEFORE PUBLIC ${lfortran_BINARY_DIR}/src)
if (WITH_XEUS)
Expand Down

0 comments on commit e07d222

Please sign in to comment.