diff --git a/CMakeLists.txt b/CMakeLists.txt index bb78a8942..b31732844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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))) @@ -300,3 +301,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) diff --git a/cmake/xgboost.pc.in b/cmake/xgboost.pc.in new file mode 100644 index 000000000..f2e122656 --- /dev/null +++ b/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