Skip to content

Commit

Permalink
Add pkgconfig to cmake (#5744) (#5748)
Browse files Browse the repository at this point in the history
* Add pkgconfig to cmake

* Move xgboost.pc.in to cmake/

Co-authored-by: Peter Jung <peter@jung.ninja>
Co-authored-by: Peter Jung <peter.jung@heureka.cz>
Co-authored-by: Hyunsu Cho <chohyu01@cs.washington.edu>
  • Loading branch information
3 people committed Jun 2, 2020
1 parent 8467880 commit f9b246f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Expand Up @@ -57,6 +57,7 @@ address, leak, undefined and thread.")
## Plugins
option(PLUGIN_LZ4 "Build lz4 plugin" OFF)
option(PLUGIN_DENSE_PARSER "Build dense parser plugin" OFF)
option(ADD_PKGCONFIG "Add xgboost.pc into system." ON)

#-- Checks for building XGBoost
if (USE_DEBUG_OUTPUT AND (NOT (CMAKE_BUILD_TYPE MATCHES Debug)))
Expand Down Expand Up @@ -274,3 +275,12 @@ endif (GOOGLE_TEST)
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
# for issues caused by mixing of /MD and /MT flags
msvc_use_static_runtime()

# Add xgboost.pc
if (ADD_PKGCONFIG)
configure_file(${xgboost_SOURCE_DIR}/cmake/xgboost.pc.in ${xgboost_BINARY_DIR}/xgboost.pc @ONLY)

install(
FILES ${xgboost_BINARY_DIR}/xgboost.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif (ADD_PKGCONFIG)
12 changes: 12 additions & 0 deletions cmake/xgboost.pc.in
@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
version=@xgboost_VERSION@
exec_prefix=${prefix}/bin
libdir=${prefix}/lib
includedir=${prefix}/include

Name: xgboost
Description: XGBoost - Scalable and Flexible Gradient Boosting.
Version: ${version}

Cflags: -I${includedir}
Libs: -L${libdir} -lxgboost

0 comments on commit f9b246f

Please sign in to comment.