Get zlib-free linking working on windows (#2729)

* fix zlib linking?

* this builds for me on windows. Does it work on azure devops?
This commit is contained in:
Greg Landrum
2019-10-24 13:36:24 +02:00
committed by GitHub
parent 6cfc8f36a7
commit b62de7b03e
2 changed files with 21 additions and 15 deletions

View File

@@ -14,7 +14,7 @@ if (WIN32)
endif()
else()
if(Boost_USE_STATIC_LIBS)
# when we're doing static linkage of boost, at least on windows, we need
# when we're doing static linkage of boost
# to also link against zlib (due to iostreams)
find_package(ZLIB)
set(zlib_lib ${ZLIB_LIBRARIES})

View File

@@ -10,6 +10,25 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
add_definitions(-DIN_COORDGEN)
endif(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC))
find_package(Boost 1.56.0 COMPONENTS system iostreams REQUIRED)
set (link_iostreams ${Boost_LIBRARIES})
if (NOT Boost_USE_STATIC_LIBS)
add_definitions("-DBOOST_IOSTREAMS_DYN_LINK")
endif()
if (WIN32)
set( T_LIBS ${Boost_LIBRARIES})
find_package(Boost 1.58.0 COMPONENTS zlib)
set( Boost_LIBRARIES ${T_LIBS} ${Boost_LIBRARIES})
else()
if(Boost_USE_STATIC_LIBS)
# when we're doing static linkage of boost
# to also link against zlib (due to iostreams)
find_package(ZLIB)
endif()
endif()
find_package(maeparser MODULE)
if(MAEPARSER_FORCE_BUILD OR (NOT maeparser_FOUND))
@@ -36,16 +55,6 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
CACHE STRING "MaeParser Include Dir" FORCE)
file(GLOB MAESOURCES "${MAEPARSER_DIR}/*.cpp")
find_package(Boost 1.56.0 COMPONENTS system iostreams REQUIRED)
set (link_iostreams ${Boost_LIBRARIES})
if (NOT Boost_USE_STATIC_LIBS)
add_definitions("-DBOOST_IOSTREAMS_DYN_LINK")
endif()
# when we're doing static linkage of boost, at least on windows, we need
# to also link against zlib (due to iostreams)
find_package(ZLIB)
rdkit_library(maeparser ${MAESOURCES} LINK_LIBRARIES ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} SHARED)
install(TARGETS maeparser DESTINATION ${RDKit_LibDir})
set(maeparser_LIBRARIES maeparser ${ZLIB_LIBRARIES})
@@ -76,9 +85,6 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
set(coordgen_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
CACHE STRING "CoordGen Include File" FORCE)
file(GLOB CGSOURCES "${COORDGEN_DIR}/*.cpp")
# when we're doing static linkage of boost, at least on windows, we need
# to also link against zlib (due to iostreams)
find_package(ZLIB)
rdkit_library(coordgen ${CGSOURCES} SHARED LINK_LIBRARIES ${maeparser_LIBRARIES})
install(TARGETS coordgen DESTINATION ${RDKit_LibDir})
set(coordgen_LIBRARIES coordgen)
@@ -93,7 +99,7 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
DESTINATION ${RDKit_ShareDir}/Data
COMPONENT data)
set(RDK_COORDGEN_LIBS MolAlign ${coordgen_LIBRARIES} ${maeparser_LIBRARIES}
set(RDK_COORDGEN_LIBS MolAlign ${coordgen_LIBRARIES} ${maeparser_LIBRARIES} ${Boost_LIBRARIES}
CACHE STRING "the external libraries" FORCE)
rdkit_headers(CoordGen.h DEST GraphMol)