Skip to content

Commit

Permalink
Add PRIVATE argument to target_link_libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoEAF committed Nov 9, 2020
1 parent f8766a9 commit 3dd45dd
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,20 @@ if(USE_SWIG)
endif(USE_SWIG)

if(USE_MPI)
TARGET_LINK_LIBRARIES(lightgbm ${MPI_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm ${MPI_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(lightgbm PRIVATE ${MPI_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE ${MPI_CXX_LIBRARIES})
endif(USE_MPI)

if(USE_OPENMP)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
TARGET_LINK_LIBRARIES(lightgbm OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(_lightgbm OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(lightgbm PRIVATE OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE OpenMP::OpenMP_CXX)
endif()
endif(USE_OPENMP)

if(USE_GPU)
TARGET_LINK_LIBRARIES(lightgbm ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(lightgbm PRIVATE ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
endif(USE_GPU)

if(__INTEGRATE_OPENCL)
Expand All @@ -419,34 +419,36 @@ if(USE_CUDA)
set_target_properties(lightgbm PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
TARGET_LINK_LIBRARIES(
lightgbm
PRIVATE
${histograms}
)
set_target_properties(_lightgbm PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
TARGET_LINK_LIBRARIES(
_lightgbm
PRIVATE
${histograms}
)
endif(USE_CUDA)

if(USE_HDFS)
TARGET_LINK_LIBRARIES(lightgbm ${HDFS_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm ${HDFS_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(lightgbm PRIVATE ${HDFS_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE ${HDFS_CXX_LIBRARIES})
endif(USE_HDFS)

if(WIN32)
if(MINGW OR CYGWIN)
TARGET_LINK_LIBRARIES(lightgbm Ws2_32)
TARGET_LINK_LIBRARIES(_lightgbm Ws2_32)
TARGET_LINK_LIBRARIES(lightgbm IPHLPAPI)
TARGET_LINK_LIBRARIES(_lightgbm IPHLPAPI)
TARGET_LINK_LIBRARIES(lightgbm PRIVATE Ws2_32)
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE Ws2_32)
TARGET_LINK_LIBRARIES(lightgbm PRIVATE IPHLPAPI)
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE IPHLPAPI)
endif(MINGW OR CYGWIN)
endif(WIN32)

if(__BUILD_FOR_R)
if(MSVC)
TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_MSVC_CORE_LIBRARY})
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE ${LIBR_MSVC_CORE_LIBRARY})
else()
TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_CORE_LIBRARY})
TARGET_LINK_LIBRARIES(_lightgbm PRIVATE ${LIBR_CORE_LIBRARY})
endif(MSVC)
endif(__BUILD_FOR_R)

Expand Down

0 comments on commit 3dd45dd

Please sign in to comment.