Skip to content

Commit

Permalink
Merge pull request #382 from mmuetzel/pkg-config
Browse files Browse the repository at this point in the history
Don't generate .pc files for MSVC compatible tool chains.
  • Loading branch information
DrTimothyAldenDavis authored Sep 6, 2023
2 parents 0098782 + 1332e63 commit 0dd6e8f
Show file tree
Hide file tree
Showing 21 changed files with 617 additions and 572 deletions.
44 changes: 23 additions & 21 deletions AMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,28 +196,30 @@ install ( FILES
# create pkg-config file
#-------------------------------------------------------------------------------

set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
if ( NOT MSVC )
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
Config/AMD.pc.in
AMD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/AMD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )
configure_file (
Config/AMD.pc.in
AMD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/AMD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )

#-------------------------------------------------------------------------------
# Demo library and programs
Expand Down
44 changes: 23 additions & 21 deletions BTF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,28 +179,30 @@ install ( FILES
# create pkg-config file
#-------------------------------------------------------------------------------

set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
if ( NOT MSVC )
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
Config/BTF.pc.in
BTF.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/BTF.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )
configure_file (
Config/BTF.pc.in
BTF.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/BTF.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )

#-------------------------------------------------------------------------------
# report status
Expand Down
44 changes: 23 additions & 21 deletions CAMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,28 +181,30 @@ install ( FILES
# create pkg-config file
#-------------------------------------------------------------------------------

set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
if ( NOT MSVC )
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
Config/CAMD.pc.in
CAMD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CAMD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )
configure_file (
Config/CAMD.pc.in
CAMD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CAMD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )

#-------------------------------------------------------------------------------
# Demo library and programs
Expand Down
44 changes: 23 additions & 21 deletions CCOLAMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,30 @@ install ( FILES
# create pkg-config file
#-------------------------------------------------------------------------------

set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
if ( NOT MSVC )
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
Config/CCOLAMD.pc.in
CCOLAMD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CCOLAMD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )
configure_file (
Config/CCOLAMD.pc.in
CCOLAMD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CCOLAMD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )

#-------------------------------------------------------------------------------
# Demo library and programs
Expand Down
87 changes: 44 additions & 43 deletions CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,52 +557,53 @@ install ( FILES
# create pkg-config file
#-------------------------------------------------------------------------------

# This might be something like:
# /usr/lib/libgomp.so;/usr/lib/libpthread.a;m
# convert to -l flags for pkg-config, i.e.: "-lgomp -lpthread -lm"
set ( CHOLMOD_STATIC_LIBS_LIST ${CHOLMOD_STATIC_LIBS} )
set ( CHOLMOD_STATIC_LIBS "" )
foreach ( _lib ${CHOLMOD_STATIC_LIBS_LIST} )
string ( FIND ${_lib} "." _pos REVERSE )
if ( ${_pos} EQUAL "-1" )
set ( CHOLMOD_STATIC_LIBS "${CHOLMOD_STATIC_LIBS} -l${_lib}" )
continue ()
endif ( )
foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" )
set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" )
if ( ${_lib} MATCHES ${_regex} )
string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} )
if ( NOT "${_libname}" STREQUAL "" )
set ( CHOLMOD_STATIC_LIBS "${CHOLMOD_STATIC_LIBS} -l${_libname}" )
break ()
endif ( )
if ( NOT MSVC )
# This might be something like:
# /usr/lib/libgomp.so;/usr/lib/libpthread.a;m
# convert to -l flags for pkg-config, i.e.: "-lgomp -lpthread -lm"
set ( CHOLMOD_STATIC_LIBS_LIST ${CHOLMOD_STATIC_LIBS} )
set ( CHOLMOD_STATIC_LIBS "" )
foreach ( _lib ${CHOLMOD_STATIC_LIBS_LIST} )
string ( FIND ${_lib} "." _pos REVERSE )
if ( ${_pos} EQUAL "-1" )
set ( CHOLMOD_STATIC_LIBS "${CHOLMOD_STATIC_LIBS} -l${_lib}" )
continue ()
endif ( )
foreach ( _kind IN ITEMS "IMPORT" "SHARED" "STATIC" )
set ( _regex ".*\\/(lib)?([^\\.]*)(${CMAKE_${_kind}_LIBRARY_SUFFIX})" )
if ( ${_lib} MATCHES ${_regex} )
string ( REGEX REPLACE ${_regex} "\\2" _libname ${_lib} )
if ( NOT "${_libname}" STREQUAL "" )
set ( CHOLMOD_STATIC_LIBS "${CHOLMOD_STATIC_LIBS} -l${_libname}" )
break ()
endif ( )
endif ( )
endforeach ( )
endforeach ( )
endforeach ( )
message ( STATUS "CHOLMOD_STATIC_LIBS: ${CHOLMOD_STATIC_LIBS}" )

set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")

set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
Config/CHOLMOD.pc.in
CHOLMOD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CHOLMOD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )
configure_file (
Config/CHOLMOD.pc.in
CHOLMOD.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CHOLMOD.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )

#-------------------------------------------------------------------------------
# Demo library and programs
Expand Down
47 changes: 26 additions & 21 deletions CHOLMOD/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,26 +134,31 @@ install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/../CHOLMOD_CUDAConfigVersion.cmake
DESTINATION ${SUITESPARSE_LIBDIR}/cmake/CHOLMOD_CUDA )

#-------------------------------------------------------------------------------
# create pkg-config file
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
#-------------------------------------------------------------------------------

if ( NOT MSVC )
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
../Config/CHOLMOD_CUDA.pc.in
CHOLMOD_CUDA.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CHOLMOD_CUDA.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )
configure_file (
../Config/CHOLMOD_CUDA.pc.in
CHOLMOD_CUDA.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/CHOLMOD_CUDA.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
Loading

0 comments on commit 0dd6e8f

Please sign in to comment.