From 6ef5b553b15b15381b436089bcfa358c351ffb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 11 Sep 2023 21:01:31 +0200 Subject: [PATCH] Fix pkg-config files on platforms without import libraries. That is all but Windows. --- CHOLMOD/CMakeLists.txt | 6 +++++- GraphBLAS/CMakeLists.txt | 6 +++++- SPEX/CMakeLists.txt | 16 ++++++++++------ SPQR/CMakeLists.txt | 6 +++++- UMFPACK/CMakeLists.txt | 6 +++++- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHOLMOD/CMakeLists.txt b/CHOLMOD/CMakeLists.txt index 614f8eae7..7644a2c46 100644 --- a/CHOLMOD/CMakeLists.txt +++ b/CHOLMOD/CMakeLists.txt @@ -569,7 +569,11 @@ if ( NOT MSVC ) set ( CHOLMOD_STATIC_LIBS "${CHOLMOD_STATIC_LIBS} -l${_lib}" ) continue () endif ( ) - foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" ) + set ( _kinds "SHARED" "STATIC" ) + if ( WIN32 ) + list ( PREPEND _kinds "IMPORT" ) + endif ( ) + foreach ( _kind IN LISTS _kinds ) set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" ) if ( ${_lib} MATCHES ${_regex} ) string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} ) diff --git a/GraphBLAS/CMakeLists.txt b/GraphBLAS/CMakeLists.txt index 03f24d6e9..8a6b7ddcf 100644 --- a/GraphBLAS/CMakeLists.txt +++ b/GraphBLAS/CMakeLists.txt @@ -520,7 +520,11 @@ if ( NOT MSVC ) set ( GRAPHBLAS_STATIC_LIBS "${GRAPHBLAS_STATIC_LIBS} -l${_lib}" ) continue () endif ( ) - foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" ) + set ( _kinds "SHARED" "STATIC" ) + if ( WIN32 ) + list ( PREPEND _kinds "IMPORT" ) + endif ( ) + foreach ( _kind IN LISTS _kinds ) set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" ) if ( ${_lib} MATCHES ${_regex} ) string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} ) diff --git a/SPEX/CMakeLists.txt b/SPEX/CMakeLists.txt index 1f492b5c4..ddc57bc21 100644 --- a/SPEX/CMakeLists.txt +++ b/SPEX/CMakeLists.txt @@ -243,12 +243,16 @@ if ( NOT MSVC ) set ( SPEX_STATIC_LIBS_LIST ${SPEX_STATIC_LIBS} ) set ( SPEX_STATIC_LIBS "" ) foreach ( _lib ${SPEX_STATIC_LIBS_LIST} ) - string ( FIND ${_lib} "." _pos REVERSE ) - if ( ${_pos} EQUAL "-1" ) - set ( SPEX_STATIC_LIBS "${SPEX_STATIC_LIBS} -l${_lib}" ) - continue () - endif ( ) - foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" ) + string ( FIND ${_lib} "." _pos REVERSE ) + if ( ${_pos} EQUAL "-1" ) + set ( SPEX_STATIC_LIBS "${SPEX_STATIC_LIBS} -l${_lib}" ) + continue () + endif ( ) + set ( _kinds "SHARED" "STATIC" ) + if ( WIN32 ) + list ( PREPEND _kinds "IMPORT" ) + endif ( ) + foreach ( _kind IN LISTS _kinds ) set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" ) if ( ${_lib} MATCHES ${_regex} ) string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} ) diff --git a/SPQR/CMakeLists.txt b/SPQR/CMakeLists.txt index 6b2594ed5..2b4ee0812 100644 --- a/SPQR/CMakeLists.txt +++ b/SPQR/CMakeLists.txt @@ -355,7 +355,11 @@ if ( NOT MSVC ) set ( SPQR_STATIC_LIBS "${SPQR_STATIC_LIBS} -l${_lib}" ) continue () endif ( ) - foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" ) + set ( _kinds "SHARED" "STATIC" ) + if ( WIN32 ) + list ( PREPEND _kinds "IMPORT" ) + endif ( ) + foreach ( _kind IN LISTS _kinds ) set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" ) if ( ${_lib} MATCHES ${_regex} ) string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} ) diff --git a/UMFPACK/CMakeLists.txt b/UMFPACK/CMakeLists.txt index 0374ceae9..359822f05 100644 --- a/UMFPACK/CMakeLists.txt +++ b/UMFPACK/CMakeLists.txt @@ -329,7 +329,11 @@ if ( NOT MSVC ) set ( UMFPACK_STATIC_LIBS "${UMFPACK_STATIC_LIBS} -l${_lib}" ) continue () endif ( ) - foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" ) + set ( _kinds "SHARED" "STATIC" ) + if ( WIN32 ) + list ( PREPEND _kinds "IMPORT" ) + endif ( ) + foreach ( _kind IN LISTS _kinds ) set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" ) if ( ${_lib} MATCHES ${_regex} ) string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} )