mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
merge in Riccardo Vianello's changes to make it easier to build c++ programs using the RDKit with cmake
This commit is contained in:
@@ -39,6 +39,7 @@ set(RDKit_ExternalDir "${CMAKE_SOURCE_DIR}/External")
|
||||
if(RDK_INSTALL_INTREE)
|
||||
set(RDKit_BinDir "${CMAKE_SOURCE_DIR}/bin")
|
||||
set(RDKit_LibDir "${CMAKE_SOURCE_DIR}/lib")
|
||||
set(RDKit_HdrDir "Code") # used in rdkit-config.cmake, path prefix not needed.
|
||||
else(RDK_INSTALL_INTREE)
|
||||
set(RDKit_BinDir "bin")
|
||||
set(RDKit_LibDir "lib${LIB_SUFFIX}")
|
||||
@@ -53,6 +54,21 @@ endif(RDK_BUILD_SWIG_WRAPPERS)
|
||||
|
||||
# defines macros: rdkit_python_extension, rdkit_test
|
||||
include(RDKitUtils)
|
||||
install(EXPORT ${RDKit_EXPORTED_TARGETS} DESTINATION ${RDKit_LibDir})
|
||||
|
||||
# create and install package configuration and version files
|
||||
configure_file (
|
||||
${RDKit_SOURCE_DIR}/rdkit-config.cmake.in
|
||||
${RDKit_BINARY_DIR}/rdkit-config.cmake @ONLY)
|
||||
|
||||
configure_file (
|
||||
${RDKit_SOURCE_DIR}/rdkit-config-version.cmake.in
|
||||
${RDKit_BINARY_DIR}/rdkit-config-version.cmake @ONLY)
|
||||
|
||||
install(FILES
|
||||
${RDKit_BINARY_DIR}/rdkit-config.cmake
|
||||
${RDKit_BINARY_DIR}/rdkit-config-version.cmake
|
||||
DESTINATION ${RDKit_LibDir})
|
||||
|
||||
# extra boost versions
|
||||
if(MSVC)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
add_library(hc STATIC hc.c hcdriver.c)
|
||||
# add_library(hc STATIC hc.c hcdriver.c)
|
||||
rdkit_library(hc hc.c hcdriver.c)
|
||||
|
||||
rdkit_python_extension(Clustering Clustering.cpp
|
||||
DEST ML/Cluster
|
||||
|
||||
@@ -13,6 +13,8 @@ else(RDKit_Revision)
|
||||
set(RDKit_VERSION "${RDKit_VERSION}.0")
|
||||
endif(RDKit_Revision)
|
||||
|
||||
set(RDKit_EXPORTED_TARGETS rdkit-targets)
|
||||
|
||||
macro(rdkit_library)
|
||||
PARSE_ARGUMENTS(RDKLIB
|
||||
"LINK_LIBRARIES;DEST"
|
||||
@@ -22,7 +24,7 @@ macro(rdkit_library)
|
||||
CDR(RDKLIB_SOURCES ${RDKLIB_DEFAULT_ARGS})
|
||||
if(MSVC)
|
||||
add_library(${RDKLIB_NAME} ${RDKLIB_SOURCES})
|
||||
INSTALL(TARGETS ${RDKLIB_NAME}
|
||||
INSTALL(TARGETS ${RDKLIB_NAME} EXPORT ${RDKit_EXPORTED_TARGETS}
|
||||
DESTINATION ${RDKit_LibDir}/${RDKLIB_DEST}
|
||||
COMPONENT dev )
|
||||
else(MSVC)
|
||||
@@ -31,12 +33,12 @@ macro(rdkit_library)
|
||||
# boundaries. As of now (June 2010), this doesn't work
|
||||
# with g++ unless libraries are shared.
|
||||
add_library(${RDKLIB_NAME} SHARED ${RDKLIB_SOURCES})
|
||||
INSTALL(TARGETS ${RDKLIB_NAME}
|
||||
INSTALL(TARGETS ${RDKLIB_NAME} EXPORT ${RDKit_EXPORTED_TARGETS}
|
||||
DESTINATION ${RDKit_LibDir}/${RDKLIB_DEST}
|
||||
COMPONENT runtime )
|
||||
add_library(${RDKLIB_NAME}_static ${RDKLIB_SOURCES})
|
||||
if(RDK_INSTALL_STATIC_LIBS)
|
||||
INSTALL(TARGETS ${RDKLIB_NAME}_static
|
||||
INSTALL(TARGETS ${RDKLIB_NAME}_static EXPORT ${RDKit_EXPORTED_TARGETS}
|
||||
DESTINATION ${RDKit_LibDir}/${RDKLIB_DEST}
|
||||
COMPONENT dev )
|
||||
endif(RDK_INSTALL_STATIC_LIBS)
|
||||
|
||||
7
rdkit-config-version.cmake.in
Normal file
7
rdkit-config-version.cmake.in
Normal file
@@ -0,0 +1,7 @@
|
||||
set (PACKAGE_VERSION "@RDKit_VERSION@")
|
||||
if (NOT "${PACKAGE_FIND_VERSION}" VERSION_GREATER "@RDKit_VERSION@")
|
||||
set (PACKAGE_VERSION_COMPATIBLE 1) # assuming backward compatible
|
||||
if ("$PACKAGE_FIND_VERSION}" VERSION_EQUAL "@RDKit_VERSION@")
|
||||
set (PACKAGE_VERSION_EXACT 1) # matches exactly
|
||||
endif ()
|
||||
endif ()
|
||||
9
rdkit-config.cmake.in
Normal file
9
rdkit-config.cmake.in
Normal file
@@ -0,0 +1,9 @@
|
||||
# Compute installation prefix relative to this file
|
||||
get_filename_component (_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component (_prefix "${_dir}/.." ABSOLUTE)
|
||||
|
||||
# Import the targets
|
||||
include ("${_prefix}/lib@LIB_SUFFIX@/@RDKit_EXPORTED_TARGETS@.cmake")
|
||||
|
||||
# Report other info
|
||||
set (RDKit_INCLUDE_DIRS "${_prefix}/@RDKit_HdrDir@")
|
||||
Reference in New Issue
Block a user