From f914748be0856aee2eef78ce8ceaa5b1b77e5c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Fri, 1 Dec 2023 13:31:15 +0100 Subject: [PATCH] CHOLMOD: Use `PRIVATE` scope dependencies also for static library. --- CHOLMOD/CMakeLists.txt | 36 +++++++++++++++++++++--------------- CHOLMOD/GPU/CMakeLists.txt | 2 +- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CHOLMOD/CMakeLists.txt b/CHOLMOD/CMakeLists.txt index 7ea4e246a..8b2ba6dfc 100644 --- a/CHOLMOD/CMakeLists.txt +++ b/CHOLMOD/CMakeLists.txt @@ -351,9 +351,13 @@ if ( BUILD_SHARED_LIBS ) endif ( ) if ( BUILD_STATIC_LIBS ) if ( TARGET SuiteSparse::SuiteSparseConfig_static ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::SuiteSparseConfig_static ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::SuiteSparseConfig_static ) + target_include_directories ( CHOLMOD_static PUBLIC + "$" ) else ( ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::SuiteSparseConfig ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::SuiteSparseConfig ) + target_include_directories ( CHOLMOD_static PUBLIC + "$" ) endif ( ) endif ( ) @@ -363,9 +367,9 @@ if ( BUILD_SHARED_LIBS ) endif ( ) if ( BUILD_STATIC_LIBS ) if ( TARGET SuiteSparse::AMD_static ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::AMD_static ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::AMD_static ) else ( ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::AMD ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::AMD ) endif ( ) endif ( ) @@ -375,9 +379,9 @@ if ( BUILD_SHARED_LIBS ) endif ( ) if ( BUILD_STATIC_LIBS ) if ( TARGET SuiteSparse::COLAMD_static ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::COLAMD_static ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::COLAMD_static ) else ( ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::COLAMD ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::COLAMD ) endif ( ) endif ( ) @@ -389,9 +393,9 @@ if ( NOT NCAMD ) if ( BUILD_STATIC_LIBS ) set ( CHOLMOD_STATIC_MODULES "${CHOLMOD_STATIC_MODULES} CAMD" ) if ( TARGET SuiteSparse::CAMD_static ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::CAMD_static ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::CAMD_static ) else ( ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::CAMD ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::CAMD ) endif ( ) endif ( ) @@ -401,9 +405,9 @@ if ( NOT NCAMD ) if ( BUILD_STATIC_LIBS ) set ( CHOLMOD_STATIC_MODULES "${CHOLMOD_STATIC_MODULES} CCOLAMD" ) if ( TARGET SuiteSparse::CCOLAMD_static ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::CCOLAMD_static ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::CCOLAMD_static ) else ( ) - target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::CCOLAMD ) + target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::CCOLAMD ) endif ( ) endif ( ) endif ( ) @@ -417,7 +421,7 @@ if ( OPENMP_C_FOUND ) target_link_libraries ( CHOLMOD PRIVATE OpenMP::OpenMP_C ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( CHOLMOD_static PUBLIC OpenMP::OpenMP_C ) + target_link_libraries ( CHOLMOD_static PRIVATE OpenMP::OpenMP_C ) list ( APPEND CHOLMOD_STATIC_LIBS ${OpenMP_C_LIBRARIES} ) endif ( ) else ( ) @@ -434,7 +438,7 @@ if ( NOT WIN32 ) endif ( ) if ( BUILD_STATIC_LIBS ) list ( APPEND CHOLMOD_STATIC_LIBS "m" ) - target_link_libraries ( CHOLMOD_static PUBLIC m ) + target_link_libraries ( CHOLMOD_static PRIVATE m ) endif ( ) endif ( ) list ( APPEND CHOLMOD_STATIC_LIBS "m" ) @@ -450,7 +454,7 @@ if ( NOT NSUPERNODAL ) endif ( ) if ( BUILD_STATIC_LIBS ) list ( APPEND CHOLMOD_STATIC_LIBS ${LAPACK_LIBRARIES} ) - target_link_libraries ( CHOLMOD_static PUBLIC ${LAPACK_LIBRARIES} ) + target_link_libraries ( CHOLMOD_static PRIVATE ${LAPACK_LIBRARIES} ) endif ( ) include_directories ( ${LAPACK_INCLUDE_DIR} ) @@ -463,7 +467,7 @@ if ( NOT NSUPERNODAL ) endif ( ) if ( BUILD_STATIC_LIBS ) list ( APPEND CHOLMOD_STATIC_LIBS ${BLAS_LIBRARIES} ) - target_link_libraries ( CHOLMOD_static PUBLIC ${BLAS_LIBRARIES} ) + target_link_libraries ( CHOLMOD_static PRIVATE ${BLAS_LIBRARIES} ) endif ( ) include_directories ( ${BLAS_INCLUDE_DIRS} ) endif ( ) @@ -490,7 +494,9 @@ if ( SUITESPARSE_CUDA ) $ ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( CHOLMOD_static PUBLIC CUDA::nvrtc CUDA::cudart_static CUDA::cublas ) + target_link_libraries ( CHOLMOD_static PRIVATE CUDA::nvrtc CUDA::cudart_static CUDA::cublas ) + target_include_directories ( CHOLMOD_static INTERFACE + $ ) endif ( ) set ( old_CMAKE_EXTRA_INCLUDE_FILES CMAKE_EXTRA_INCLUDE_FILES ) diff --git a/CHOLMOD/GPU/CMakeLists.txt b/CHOLMOD/GPU/CMakeLists.txt index f5bb0e655..6e6b03c36 100644 --- a/CHOLMOD/GPU/CMakeLists.txt +++ b/CHOLMOD/GPU/CMakeLists.txt @@ -70,6 +70,6 @@ if ( BUILD_SHARED_LIBS ) CUDA::nvrtc CUDA::cudart_static CUDA::cublas ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( CHOLMOD_static PUBLIC + target_link_libraries ( CHOLMOD_static PRIVATE CUDA::nvrtc CUDA::cudart_static CUDA::cublas ) endif ( )