Skip to content

Commit 0be0e6f

Browse files
kongziiPeter Junghcho3
authored
Add pkgconfig to cmake (dmlc#5744)
* Add pkgconfig to cmake * Move xgboost.pc.in to cmake/ Co-authored-by: Peter Jung <[email protected]> Co-authored-by: Hyunsu Cho <[email protected]>
1 parent b77e3e3 commit 0be0e6f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ address, leak, undefined and thread.")
5757
## Plugins
5858
option(PLUGIN_LZ4 "Build lz4 plugin" OFF)
5959
option(PLUGIN_DENSE_PARSER "Build dense parser plugin" OFF)
60+
option(ADD_PKGCONFIG "Add xgboost.pc into system." ON)
6061

6162
#-- Checks for building XGBoost
6263
if (USE_DEBUG_OUTPUT AND (NOT (CMAKE_BUILD_TYPE MATCHES Debug)))
@@ -300,3 +301,12 @@ endif (GOOGLE_TEST)
300301
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
301302
# for issues caused by mixing of /MD and /MT flags
302303
msvc_use_static_runtime()
304+
305+
# Add xgboost.pc
306+
if (ADD_PKGCONFIG)
307+
configure_file(${xgboost_SOURCE_DIR}/cmake/xgboost.pc.in ${xgboost_BINARY_DIR}/xgboost.pc @ONLY)
308+
309+
install(
310+
FILES ${xgboost_BINARY_DIR}/xgboost.pc
311+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
312+
endif (ADD_PKGCONFIG)

cmake/xgboost.pc.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
version=@xgboost_VERSION@
3+
exec_prefix=${prefix}/bin
4+
libdir=${prefix}/lib
5+
includedir=${prefix}/include
6+
7+
Name: xgboost
8+
Description: XGBoost - Scalable and Flexible Gradient Boosting.
9+
Version: ${version}
10+
11+
Cflags: -I${includedir}
12+
Libs: -L${libdir} -lxgboost

0 commit comments

Comments
 (0)