rdkit-targets.cmake now uses cmake package names for external libraries instead of absolute paths (#8552)

This commit is contained in:
Kevin Keating
2025-05-24 01:27:03 -04:00
committed by GitHub
parent f3cd17ba37
commit 2a6307b0aa
7 changed files with 23 additions and 78 deletions

View File

@@ -475,9 +475,10 @@ endif()
target_include_directories(rdkit_base INTERFACE
$<BUILD_INTERFACE:${RDKit_CodeDir}>
$<INSTALL_INTERFACE:${RDKit_HdrDir}>
${Boost_INCLUDE_DIRS}
)
target_link_libraries(rdkit_base INTERFACE ${BOOST_LIBRARIES})
# linking against Boost::boost will add Boost to the include directories without
# hard-coding Boost's path into the rdkit-targets.cmake that gets generated
target_link_libraries(rdkit_base INTERFACE ${BOOST_LIBRARIES} Boost::boost)
if(RDK_BUILD_PGSQL)

View File

@@ -8,13 +8,14 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
else(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC))
add_definitions(-DIN_COORDGEN)
endif(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC))
include_directories(${coordgen_INCLUDE_DIRS})
set(COORDGEN_LIB coordgen)
find_package(${COORDGEN_LIB} QUIET)
endif()
rdkit_library(Depictor
RDDepictor.cpp EmbeddedFrag.cpp DepictUtils.cpp Templates.cpp
LINK_LIBRARIES ${RDK_COORDGEN_LIBS} SmilesParse SubstructMatch MolTransforms GraphMol RDGeneral MolAlign)
LINK_LIBRARIES ${COORDGEN_LIB} SmilesParse SubstructMatch MolTransforms GraphMol RDGeneral MolAlign)
target_compile_definitions(Depictor PRIVATE RDKIT_DEPICTOR_BUILD)
rdkit_headers(DepictUtils.h

View File

@@ -1,6 +1,16 @@
if(RDK_BUILD_MAEPARSER_SUPPORT)
include_directories(${maeparser_INCLUDE_DIRS})
set(MAEPARSER_LIB maeparser)
set(maesupplier MaeMolSupplier.cpp MaeWriter.cpp)
if ("${RDK_MAEPARSER_LIBS}" STREQUAL "")
# if we're not building maeparser as part of the RDKit build), then find
# the imported package
find_package(ZLIB QUIET)
find_package(${MAEPARSER_LIB})
else()
# if we built maeparser as part of the RDKit build, then we need to use
# the headers from the source directory
include_directories(${maeparser_INCLUDE_DIRS})
endif()
endif()
rdkit_library(FileParsers
@@ -24,7 +34,7 @@ rdkit_library(FileParsers
MultithreadedMolSupplier.cpp
MultithreadedSmilesMolSupplier.cpp
MultithreadedSDMolSupplier.cpp
LINK_LIBRARIES GenericGroups Depictor SmilesParse ChemTransforms GraphMol SubstructMatch ${RDK_MAEPARSER_LIBS})
LINK_LIBRARIES GenericGroups Depictor SmilesParse ChemTransforms GraphMol SubstructMatch ${MAEPARSER_LIB})
target_compile_definitions(FileParsers PRIVATE RDKIT_FILEPARSERS_BUILD)
rdkit_headers(CDXMLParser.h

View File

@@ -1,35 +0,0 @@
# Try to find Schrodinger's CoorgGen libraries.
#
# Different version handling is not yet supported
#
# Once found, this will find and define the following variables:
#
# coordgen_INCLUDE_DIRS - CoordGen's includes directory
# coordgen_LIBRARIES - CoordGen's shared libraries
#
#
include(FindPackageHandleStandardArgs)
find_path(coordgen_INCLUDE_DIRS
NAMES "coordgen/sketcherMinimizer.h"
HINTS ${COORDGEN_DIR} ${coordgen_DIR}
PATH_SUFFIXES "include"
DOC "include path for coordgen"
)
message("-- coordgen include dir set as ${coordgen_INCLUDE_DIRS}")
find_library(coordgen_LIBRARIES
NAMES coordgen coordgenlibs
HINTS ${COORDGEN_DIR} ${coordgen_DIR}
PATH_SUFFIXES "lib"
DOC "libraries for coordgen"
)
message("-- coordgen libraries set as '${coordgen_LIBRARIES}'")
find_package_handle_standard_args(coordgen FOUND_VAR coordgen_FOUND
REQUIRED_VARS coordgen_INCLUDE_DIRS
coordgen_LIBRARIES)

View File

@@ -1,32 +0,0 @@
# Try to find Schrodinger's MAEParser libraries.
#
# Different version handling is not yet supported
#
# Once found, this will find and define the following variables:
#
# maeparser_INCLUDE_DIRS - maeparser's includes directory
# maeparser_LIBRARIES - maeparser's shared libraries
#
#
include(FindPackageHandleStandardArgs)
find_path(maeparser_INCLUDE_DIRS
NAMES "maeparser/Reader.hpp"
HINTS ${MAEPARSER_DIR} ${maeparser_DIR}
PATH_SUFFIXES "include"
DOC "include path for maeparser"
)
message("-- maeparser include dir set as '${maeparser_INCLUDE_DIRS}'")
find_library(maeparser_LIBRARIES
NAMES maeparser
HINTS ${MAEPARSER_DIR} ${maeparser_DIR}
PATH_SUFFIXES "lib"
DOC "libraries for maeparser"
)
message("-- maeparser libraries set as '${maeparser_LIBRARIES}'")
find_package_handle_standard_args(maeparser FOUND_VAR maeparser_FOUND
REQUIRED_VARS maeparser_INCLUDE_DIRS
maeparser_LIBRARIES)

View File

@@ -6,7 +6,7 @@ if(RDK_BUILD_MAEPARSER_SUPPORT OR RDK_BUILD_COORDGEN_SUPPORT)
add_definitions(-DIN_MAEPARSER)
endif()
find_package(maeparser MODULE QUIET)
find_package(maeparser QUIET)
if(MAEPARSER_FORCE_BUILD OR (NOT maeparser_FOUND))
if(NOT DEFINED MAEPARSER_DIR)
@@ -61,7 +61,7 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
add_definitions(-DIN_COORDGEN)
endif(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC))
find_package(coordgen MODULE QUIET)
find_package(coordgen QUIET)
if(COORDGEN_FORCE_BUILD OR (NOT coordgen_FOUND))
if(NOT DEFINED COORDGEN_DIR)
set(COORDGEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/coordgen")
@@ -110,7 +110,7 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
rdkit_test(testCoordGen test.cpp
LINK_LIBRARIES
"${RDK_COORDGEN_LIBS}" Depictor ChemTransforms
coordgen Depictor ChemTransforms
FileParsers SmilesParse SubstructMatch GraphMol
RDGeneral DataStructs RDGeneral RDGeometryLib
${RDKit_THREAD_LIBS})

View File

@@ -2,6 +2,6 @@ rdkit_python_extension(rdCoordGen
rdCoordGen.cpp
DEST Chem
LINK_LIBRARIES
${RDK_COORDGEN_LIBS} MolAlign SubstructMatch GraphMol DataStructs RDGeometryLib RDGeneral RDBoost)
coordgen MolAlign SubstructMatch GraphMol DataStructs RDGeometryLib RDGeneral RDBoost)
add_pytest(pyCoordGen
${CMAKE_CURRENT_SOURCE_DIR}/testCoordGen.py)