Skip to content

Commit b7fe0d9

Browse files
committed
Use autogenerated import targets instead of FindSuiteSparse_config.cmake
1 parent 4b69fc1 commit b7fe0d9

File tree

19 files changed

+226
-230
lines changed

19 files changed

+226
-230
lines changed

AMD/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ endif ( )
5757
# find library dependencies
5858
#-------------------------------------------------------------------------------
5959

60-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
60+
find_package ( SuiteSparse_config 7.1.0
61+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
62+
if ( NOT TARGET suitesparseconfig )
63+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
64+
endif ( )
6165

6266
#-------------------------------------------------------------------------------
6367
# configure files
@@ -72,7 +76,7 @@ configure_file ( "Config/amd_version.tex.in" "${PROJECT_SOURCE_DIR}/Doc/amd_vers
7276
# include directories
7377
#-------------------------------------------------------------------------------
7478

75-
include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} )
79+
include_directories ( Source Include )
7680

7781
#-------------------------------------------------------------------------------
7882
# dynamic amd library properties
@@ -117,9 +121,14 @@ endif ( )
117121
#-------------------------------------------------------------------------------
118122

119123
# suitesparseconfig:
120-
target_link_libraries ( amd PRIVATE ${SUITESPARSE_CONFIG_LIBRARIES} )
124+
target_link_libraries ( amd PRIVATE suitesparseconfig )
125+
target_include_directories ( amd PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
121126
if ( NOT NSTATIC )
122-
target_link_libraries ( amd_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
127+
if ( TARGET suitesparseconfig_static )
128+
target_link_libraries ( amd_static PUBLIC suitesparseconfig_static )
129+
else ( )
130+
target_link_libraries ( amd_static PUBLIC suitesparseconfig )
131+
endif ( )
123132
endif ( )
124133

125134
# libm:

BTF/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ project ( btf
4444
# find library dependencies
4545
#-------------------------------------------------------------------------------
4646

47-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
47+
find_package ( SuiteSparse_config 7.1.0
48+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
49+
if ( NOT TARGET suitesparseconfig )
50+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
51+
endif ( )
4852

4953
#-------------------------------------------------------------------------------
5054
# configure files
@@ -57,7 +61,7 @@ configure_file ( "Config/btf.h.in" "${PROJECT_SOURCE_DIR}/Include/btf.h"
5761
# include directories
5862
#-------------------------------------------------------------------------------
5963

60-
include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} )
64+
include_directories ( Source Include )
6165

6266
#-------------------------------------------------------------------------------
6367
# dynamic btf library properties
@@ -100,9 +104,14 @@ endif ( )
100104
#-------------------------------------------------------------------------------
101105

102106
# suitesparseconfig:
103-
target_link_libraries ( btf PRIVATE ${SUITESPARSE_CONFIG_LIBRARIES} )
107+
target_link_libraries ( btf PRIVATE suitesparseconfig )
108+
target_include_directories ( btf PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
104109
if ( NOT NSTATIC )
105-
target_link_libraries ( btf_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
110+
if ( TARGET suitesparseconfig_static )
111+
target_link_libraries ( btf_static PUBLIC suitesparseconfig_static )
112+
else ( )
113+
target_link_libraries ( btf_static PUBLIC suitesparseconfig )
114+
endif ( )
106115
endif ( )
107116

108117
# libm:

CAMD/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ project ( camd
4343
# find library dependencies
4444
#-------------------------------------------------------------------------------
4545

46-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
46+
find_package ( SuiteSparse_config 7.1.0
47+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
48+
if ( NOT TARGET suitesparseconfig )
49+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
50+
endif ( )
4751

4852
#-------------------------------------------------------------------------------
4953
# configure files
@@ -60,7 +64,7 @@ configure_file ( "Config/camd_version.tex.in"
6064
# include directories
6165
#-------------------------------------------------------------------------------
6266

63-
include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} )
67+
include_directories ( Source Include )
6468

6569
#-------------------------------------------------------------------------------
6670
# dynamic camd library properties
@@ -102,9 +106,14 @@ endif ( )
102106
# add the library dependencies
103107
#-------------------------------------------------------------------------------
104108

105-
target_link_libraries ( camd PRIVATE ${SUITESPARSE_CONFIG_LIBRARY} )
109+
target_link_libraries ( camd PRIVATE suitesparseconfig )
110+
target_include_directories ( camd PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
106111
if ( NOT NSTATIC )
107-
target_link_libraries ( camd_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
112+
if ( TARGET suitesparseconfig_static )
113+
target_link_libraries ( camd_static PUBLIC suitesparseconfig_static )
114+
else ( )
115+
target_link_libraries ( camd_static PUBLIC suitesparseconfig )
116+
endif ( )
108117
endif ( )
109118

110119
# libm:

CCOLAMD/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ project ( ccolamd
4343
# find library dependencies
4444
#-------------------------------------------------------------------------------
4545

46-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
46+
find_package ( SuiteSparse_config 7.1.0
47+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
48+
if ( NOT TARGET suitesparseconfig )
49+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
50+
endif ( )
4751

4852
#-------------------------------------------------------------------------------
4953
# configure files
@@ -57,7 +61,7 @@ configure_file ( "Config/ccolamd.h.in"
5761
# include directories
5862
#-------------------------------------------------------------------------------
5963

60-
include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} )
64+
include_directories ( Source Include )
6165

6266
#-------------------------------------------------------------------------------
6367
# dynamic ccolamd library properties
@@ -99,9 +103,14 @@ endif ( )
99103
# add the library dependencies
100104
#-------------------------------------------------------------------------------
101105

102-
target_link_libraries ( ccolamd PRIVATE ${SUITESPARSE_CONFIG_LIBRARY} )
106+
target_link_libraries ( ccolamd PRIVATE suitesparseconfig )
107+
target_include_directories ( ccolamd PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
103108
if ( NOT NSTATIC )
104-
target_link_libraries ( ccolamd_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
109+
if ( TARGET suitesparseconfig_static )
110+
target_link_libraries ( ccolamd_static PUBLIC suitesparseconfig_static )
111+
else ( )
112+
target_link_libraries ( ccolamd_static PUBLIC suitesparseconfig )
113+
endif ( )
105114
endif ( )
106115

107116
# libm:

CHOLMOD/CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ else ( )
8080
find_package ( OpenMP )
8181
endif ( )
8282

83-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
83+
find_package ( SuiteSparse_config 7.1.0
84+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
85+
if ( NOT TARGET suitesparseconfig )
86+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
87+
endif ( )
8488
find_package ( COLAMD 3.0.4 REQUIRED )
8589
find_package ( AMD 3.0.4 REQUIRED )
8690

@@ -274,7 +278,7 @@ configure_file ( "Config/cholmod_version.tex.in"
274278
#-------------------------------------------------------------------------------
275279

276280
include_directories ( Check Cholesky Core MatrixOps Modify Partition
277-
Supernodal Include ${CMAKE_SOURCE_DIR} ${SUITESPARSE_CONFIG_INCLUDE_DIR}
281+
Supernodal Include ${CMAKE_SOURCE_DIR}
278282
${AMD_INCLUDE_DIR} ${COLAMD_INCLUDE_DIR} )
279283

280284
#-------------------------------------------------------------------------------
@@ -330,9 +334,14 @@ endif ( )
330334
#-------------------------------------------------------------------------------
331335

332336
# suitesparseconfig:
333-
target_link_libraries ( cholmod PRIVATE ${SUITESPARSE_CONFIG_LIBRARIES} )
337+
target_link_libraries ( cholmod PRIVATE suitesparseconfig )
338+
target_include_directories ( cholmod PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
334339
if ( NOT NSTATIC )
335-
target_link_libraries ( cholmod_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
340+
if ( TARGET suitesparseconfig_static )
341+
target_link_libraries ( cholmod_static PUBLIC suitesparseconfig_static )
342+
else ( )
343+
target_link_libraries ( cholmod_static PUBLIC suitesparseconfig )
344+
endif ( )
336345
endif ( )
337346

338347
# OpenMP:
@@ -469,8 +478,8 @@ if ( DEMO )
469478
endif ( )
470479

471480
# Libraries required for Demo programs
472-
target_link_libraries ( cholmod_demo PUBLIC cholmod ${CHOLMOD_CUDA} ${SUITESPARSE_CONFIG_LIBRARIES} )
473-
target_link_libraries ( cholmod_l_demo PUBLIC cholmod ${CHOLMOD_CUDA} ${SUITESPARSE_CONFIG_LIBRARIES} )
481+
target_link_libraries ( cholmod_demo PUBLIC cholmod ${CHOLMOD_CUDA} suitesparseconfig )
482+
target_link_libraries ( cholmod_l_demo PUBLIC cholmod ${CHOLMOD_CUDA} suitesparseconfig )
474483
target_link_libraries ( cholmod_simple PUBLIC cholmod ${CHOLMOD_CUDA} )
475484

476485
else ( )

COLAMD/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ project ( colamd
4343
# find library dependencies
4444
#-------------------------------------------------------------------------------
4545

46-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
46+
find_package ( SuiteSparse_config 7.1.0
47+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
48+
if ( NOT TARGET suitesparseconfig )
49+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
50+
endif ( )
4751

4852
#-------------------------------------------------------------------------------
4953
# configure files
@@ -57,7 +61,7 @@ configure_file ( "Config/colamd.h.in"
5761
# include directories
5862
#-------------------------------------------------------------------------------
5963

60-
include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} )
64+
include_directories ( Source Include )
6165

6266
#-------------------------------------------------------------------------------
6367
# dynamic colamd library properties
@@ -99,9 +103,14 @@ endif ( )
99103
# add the library dependencies
100104
#-------------------------------------------------------------------------------
101105

102-
target_link_libraries ( colamd PRIVATE ${SUITESPARSE_CONFIG_LIBRARY} )
106+
target_link_libraries ( colamd PRIVATE suitesparseconfig )
107+
target_include_directories ( colamd PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
103108
if ( NOT NSTATIC )
104-
target_link_libraries ( colamd_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
109+
if ( TARGET suitesparseconfig_static )
110+
target_link_libraries ( colamd_static PUBLIC suitesparseconfig_static )
111+
else ( )
112+
target_link_libraries ( colamd_static PUBLIC suitesparseconfig )
113+
endif ( )
105114
endif ( )
106115

107116
# libm:

CXSparse/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ project ( cxsparse
6464
# find library dependencies
6565
#-------------------------------------------------------------------------------
6666

67-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
67+
find_package ( SuiteSparse_config 7.1.0
68+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
69+
if ( NOT TARGET suitesparseconfig )
70+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
71+
endif ( )
6872

6973
#-------------------------------------------------------------------------------
7074
# Configure cs.h with version number
@@ -78,7 +82,7 @@ configure_file ( "Config/cs.h.in"
7882
# include directories
7983
#-------------------------------------------------------------------------------
8084

81-
include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} )
85+
include_directories ( Source Include )
8286

8387
#-------------------------------------------------------------------------------
8488
# dynamic cxsparse library properties
@@ -132,9 +136,14 @@ endif ( )
132136
# add the library dependencies
133137
#-------------------------------------------------------------------------------
134138

135-
target_link_libraries ( cxsparse PRIVATE ${SUITESPARSE_CONFIG_LIBRARY} )
139+
target_link_libraries ( cxsparse PRIVATE suitesparseconfig )
140+
target_include_directories ( cxsparse PUBLIC "$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES>" )
136141
if ( NOT NSTATIC )
137-
target_link_libraries ( cxsparse_static PUBLIC ${SUITESPARSE_CONFIG_LIBRARY} )
142+
if ( TARGET suitesparseconfig_static )
143+
target_link_libraries ( cxsparse_static PUBLIC suitesparseconfig_static )
144+
else ( )
145+
target_link_libraries ( cxsparse_static PUBLIC suitesparseconfig )
146+
endif ( )
138147
endif ( )
139148

140149
# libm:

GPUQREngine/CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ endif ( )
6262
#-------------------------------------------------------------------------------
6363

6464
# for the library itself
65-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
65+
find_package ( SuiteSparse_config 7.1.0
66+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
67+
if ( NOT TARGET suitesparseconfig )
68+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
69+
endif ( )
6670

6771
if ( SUITESPARSE_CUDA )
6872
find_package ( SuiteSparse_GPURuntime 2.0.4 REQUIRED )
@@ -116,8 +120,7 @@ endif ( )
116120

117121
set ( GPUQRENGINE_INCLUDES Include Include/Kernel
118122
Include/Kernel/Apply Include/Kernel/Assemble Include/Kernel/Factorize
119-
${CMAKE_SOURCE_DIR}/../SuiteSparse_GPURuntime/Include
120-
${SUITESPARSE_CONFIG_INCLUDE_DIR} )
123+
${CMAKE_SOURCE_DIR}/../SuiteSparse_GPURuntime/Include )
121124

122125
include_directories ( ${GPUQRENGINE_INCLUDES} ${CUDAToolkit_INCLUDE_DIRS} )
123126

@@ -136,8 +139,9 @@ set_target_properties ( gpuqrengine PROPERTIES
136139
WINDOWS_EXPORT_ALL_SYMBOLS ON )
137140

138141
target_include_directories ( gpuqrengine PUBLIC
139-
${CUDAToolkit_INCLUDE_DIRS}
140-
${GPUQRENGINE_INCLUDES} )
142+
${CUDAToolkit_INCLUDE_DIRS}
143+
${GPUQRENGINE_INCLUDES}
144+
$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES> )
141145

142146
if ( SUITESPARSE_CUDA )
143147
set_target_properties ( gpuqrengine PROPERTIES POSITION_INDEPENDENT_CODE ON )
@@ -166,8 +170,9 @@ if ( NOT NSTATIC )
166170
endif ( )
167171

168172
target_include_directories ( gpuqrengine_static PUBLIC
169-
${CUDAToolkit_INCLUDE_DIRS}
170-
${GPUQRENGINE_INCLUDES} )
173+
${CUDAToolkit_INCLUDE_DIRS}
174+
${GPUQRENGINE_INCLUDES}
175+
$<TARGET_PROPERTY:suitesparseconfig,INTERFACE_INCLUDE_DIRECTORIES> )
171176

172177
if ( SUITESPARSE_CUDA )
173178
set_target_properties ( gpuqrengine_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
@@ -216,7 +221,7 @@ if ( DEMO AND DEMO_OK )
216221
target_link_libraries ( gpuqrengine_demo PUBLIC gpuqrengine
217222
${CHOLMOD_LIBRARIES} ${AMD_LIBRARIES} ${COLAMD_LIBRARIES}
218223
${CAMD_LIBRARIES} ${CCOLAMD_LIBRARIES} ${CHOLMOD_CUDA}
219-
${SUITESPARSE_GPURUNTIME_LIBRARIES} ${SUITESPARSE_CONFIG_LIBRARIES} )
224+
${SUITESPARSE_GPURUNTIME_LIBRARIES} suitesparseconfig )
220225

221226
else ( )
222227

GraphBLAS/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,4 +503,3 @@ endif ( )
503503
#-------------------------------------------------------------------------------
504504

505505
include ( SuiteSparseReport )
506-

KLU/CMakeLists.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ project ( klu
5050
# find library dependencies
5151
#-------------------------------------------------------------------------------
5252

53-
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
53+
find_package ( SuiteSparse_config 7.1.0
54+
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
55+
if ( NOT TARGET suitesparseconfig )
56+
find_package ( SuiteSparse_config 7.1.0 REQUIRED )
57+
endif ( )
5458
find_package ( BTF 2.0.4 REQUIRED )
5559
find_package ( COLAMD 3.0.4 REQUIRED )
5660
find_package ( AMD 3.0.4 REQUIRED )
@@ -94,7 +98,7 @@ configure_file ( "Config/klu_version.tex.in"
9498
# include directories
9599
#-------------------------------------------------------------------------------
96100

97-
include_directories ( Source Include User ${SUITESPARSE_CONFIG_INCLUDE_DIR}
101+
include_directories ( Source Include User
98102
${AMD_INCLUDE_DIR} ${COLAMD_INCLUDE_DIR} ${BTF_INCLUDE_DIR} )
99103

100104
#-------------------------------------------------------------------------------
@@ -174,9 +178,13 @@ endif ( )
174178
#-------------------------------------------------------------------------------
175179

176180
# suitesparseconfig:
177-
target_link_libraries ( klu PRIVATE ${SUITESPARSE_CONFIG_LIBRARIES} )
181+
target_link_libraries ( klu PRIVATE suitesparseconfig )
178182
if ( NOT NSTATIC )
179-
target_link_libraries ( klu_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} )
183+
if ( TARGET suitesparseconfig_static )
184+
target_link_libraries ( klu_static PUBLIC suitesparseconfig_static )
185+
else ( )
186+
target_link_libraries ( klu_static PUBLIC suitesparseconfig )
187+
endif ( )
180188
endif ( )
181189

182190
# libm:

0 commit comments

Comments
 (0)