Skip to content

Commit

Permalink
Merge pull request #560 from mmuetzel/cholmod
Browse files Browse the repository at this point in the history
CHOLMOD: Use `PRIVATE` scope dependencies also for static library.
  • Loading branch information
DrTimothyAldenDavis authored Dec 1, 2023
2 parents c051663 + f914748 commit 5d41165
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
36 changes: 21 additions & 15 deletions CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig_static,INTERFACE_INCLUDE_DIRECTORIES>" )
else ( )
target_link_libraries ( CHOLMOD_static PUBLIC SuiteSparse::SuiteSparseConfig )
target_link_libraries ( CHOLMOD_static PRIVATE SuiteSparse::SuiteSparseConfig )
target_include_directories ( CHOLMOD_static PUBLIC
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>" )
endif ( )
endif ( )

Expand All @@ -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 ( )

Expand All @@ -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 ( )

Expand All @@ -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 ( )

Expand All @@ -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 ( )
Expand All @@ -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 ( )
Expand All @@ -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" )
Expand All @@ -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} )

Expand All @@ -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 ( )
Expand All @@ -490,7 +494,9 @@ if ( SUITESPARSE_CUDA )
$<TARGET_PROPERTY:CUDA::cublas,INTERFACE_INCLUDE_DIRECTORIES> )
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
$<TARGET_PROPERTY:CUDA::cublas,INTERFACE_INCLUDE_DIRECTORIES> )
endif ( )

set ( old_CMAKE_EXTRA_INCLUDE_FILES CMAKE_EXTRA_INCLUDE_FILES )
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ( )

0 comments on commit 5d41165

Please sign in to comment.