Skip to content

Commit

Permalink
Merge pull request #509 from mmuetzel/cmake
Browse files Browse the repository at this point in the history
Install public headers also with static libraries.
  • Loading branch information
DrTimothyAldenDavis authored Nov 9, 2023
2 parents 3a0fffb + a4a78f8 commit 9a23fed
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 86 deletions.
6 changes: 3 additions & 3 deletions AMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ target_include_directories ( AMD
if ( NOT NSTATIC )
add_library ( AMD_static STATIC ${AMD_SOURCES} )
set_target_properties ( AMD_static PROPERTIES
VERSION ${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME amd
SOVERSION ${AMD_VERSION_MAJOR} )
PUBLIC_HEADER "Include/amd.h" )

if ( MSVC )
set_target_properties ( AMD_static PROPERTIES
Expand Down Expand Up @@ -159,7 +158,8 @@ install ( TARGETS AMD
if ( NOT NSTATIC )
install ( TARGETS AMD_static
EXPORT AMDTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
8 changes: 4 additions & 4 deletions BTF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ set_target_properties ( BTF PROPERTIES
C_STANDARD_REQUIRED ON
OUTPUT_NAME btf
SOVERSION ${BTF_VERSION_MAJOR}
PUBLIC_HEADER "Include/btf.h"
PUBLIC_HEADER "Include/btf.h"
WINDOWS_EXPORT_ALL_SYMBOLS ON)

target_include_directories ( BTF
Expand All @@ -93,11 +93,10 @@ if ( NOT NSTATIC )
add_library ( BTF_static STATIC ${BTF_SOURCES} )

set_target_properties ( BTF_static PROPERTIES
VERSION ${BTF_VERSION_MAJOR}.${BTF_VERSION_MINOR}.${BTF_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME btf
SOVERSION ${BTF_VERSION_MAJOR} )
PUBLIC_HEADER "Include/btf.h" )

if ( MSVC )
set_target_properties ( BTF_static PROPERTIES
Expand Down Expand Up @@ -146,7 +145,8 @@ install ( TARGETS BTF
if ( NOT NSTATIC )
install ( TARGETS BTF_static
EXPORT BTFTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
6 changes: 3 additions & 3 deletions CAMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,10 @@ if ( NOT NSTATIC )
add_library ( CAMD_static STATIC ${CAMD_SOURCES} )

set_target_properties ( CAMD_static PROPERTIES
VERSION ${CAMD_VERSION_MAJOR}.${CAMD_VERSION_MINOR}.${CAMD_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME camd
SOVERSION ${CAMD_VERSION_MAJOR} )
PUBLIC_HEADER "Include/camd.h" )

if ( MSVC )
set_target_properties ( CAMD_static PROPERTIES
Expand Down Expand Up @@ -152,7 +151,8 @@ install ( TARGETS CAMD
if ( NOT NSTATIC )
install ( TARGETS CAMD_static
EXPORT CAMDTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
6 changes: 3 additions & 3 deletions CCOLAMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ if ( NOT NSTATIC )
add_library ( CCOLAMD_static STATIC ${CCOLAMD_SOURCES} )

set_target_properties ( CCOLAMD_static PROPERTIES
VERSION ${CCOLAMD_VERSION_MAJOR}.${CCOLAMD_VERSION_MINOR}.${CCOLAMD_VERSION_SUB}
OUTPUT_NAME ccolamd
C_STANDARD 11
C_STANDARD_REQUIRED ON
SOVERSION ${CCOLAMD_VERSION_MAJOR} )
PUBLIC_HEADER "Include/ccolamd.h" )

if ( MSVC )
set_target_properties ( CCOLAMD_static PROPERTIES
Expand Down Expand Up @@ -149,7 +148,8 @@ install ( TARGETS CCOLAMD
if ( NOT NSTATIC )
install ( TARGETS CCOLAMD_static
EXPORT CCOLAMDTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
6 changes: 3 additions & 3 deletions CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,10 @@ if ( NOT NSTATIC )
add_library ( CHOLMOD_static STATIC ${CHOLMOD_SOURCES} )

set_target_properties ( CHOLMOD_static PROPERTIES
VERSION ${CHOLMOD_VERSION_MAJOR}.${CHOLMOD_VERSION_MINOR}.${CHOLMOD_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME cholmod
SOVERSION ${CHOLMOD_VERSION_MAJOR} )
PUBLIC_HEADER "Include/cholmod.h" )

if ( MSVC )
set_target_properties ( CHOLMOD_static PROPERTIES
Expand Down Expand Up @@ -519,7 +518,8 @@ install ( TARGETS CHOLMOD
if ( NOT NSTATIC )
install ( TARGETS CHOLMOD_static
EXPORT CHOLMODTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
7 changes: 3 additions & 4 deletions CHOLMOD/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ if ( NOT NSTATIC )
add_library ( CHOLMOD_CUDA_static STATIC ${CHOLMOD_CUDA_SOURCES} )

set_target_properties ( CHOLMOD_CUDA_static PROPERTIES
VERSION ${CHOLMOD_VERSION_MAJOR}.${CHOLMOD_VERSION_MINOR}.${CHOLMOD_VERSION_SUB}
CXX_STANDARD_REQUIRED ON
CXX_STANDARD 17
C_STANDARD_REQUIRED ON
C_STANDARD 11
OUTPUT_NAME cholmod_cuda
SOVERSION ${CHOLMOD_VERSION_MAJOR} )
OUTPUT_NAME cholmod_cuda )

if ( MSVC )
set_target_properties ( CHOLMOD_CUDA_static PROPERTIES
Expand Down Expand Up @@ -108,7 +106,8 @@ install ( TARGETS CHOLMOD_CUDA
if ( NOT NSTATIC )
install ( TARGETS CHOLMOD_CUDA_static
EXPORT CHOLMOD_CUDATargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )


Expand Down
6 changes: 3 additions & 3 deletions COLAMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ if ( NOT NSTATIC )
add_library ( COLAMD_static STATIC ${COLAMD_SOURCES} )

set_target_properties ( COLAMD_static PROPERTIES
VERSION ${COLAMD_VERSION_MAJOR}.${COLAMD_VERSION_MINOR}.${COLAMD_VERSION_SUB}
OUTPUT_NAME colamd
C_STANDARD 11
C_STANDARD_REQUIRED ON
SOVERSION ${COLAMD_VERSION_MAJOR} )
PUBLIC_HEADER "Include/colamd.h" )

if ( MSVC )
set_target_properties ( COLAMD_static PROPERTIES
Expand Down Expand Up @@ -149,7 +148,8 @@ install ( TARGETS COLAMD
if ( NOT NSTATIC )
install ( TARGETS COLAMD_static
EXPORT COLAMDTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
3 changes: 1 addition & 2 deletions CSparse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ if ( NOT NSTATIC )
add_library ( csparse_static STATIC ${CSPARSE_SOURCES} )

set_target_properties ( csparse_static PROPERTIES
VERSION ${CSPARSE_VERSION_MAJOR}.${CSPARSE_VERSION_MINOR}.${CSPARSE_VERSION_SUB}
OUTPUT_NAME csparse
C_STANDARD 11
C_STANDARD_REQUIRED ON
SOVERSION ${CSPARSE_VERSION_MAJOR} )
PUBLIC_HEADER "Include/cs.h" )

if ( MSVC )
set_target_properties ( csparse_static PROPERTIES
Expand Down
6 changes: 3 additions & 3 deletions CXSparse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ if ( NOT NSTATIC )
add_library ( CXSparse_static STATIC ${CXSPARSE_SOURCES} )

set_target_properties ( CXSparse_static PROPERTIES
VERSION ${CXSPARSE_VERSION_MAJOR}.${CXSPARSE_VERSION_MINOR}.${CXSPARSE_VERSION_SUB}
OUTPUT_NAME cxsparse
C_STANDARD 11
C_STANDARD_REQUIRED ON
SOVERSION ${CXSPARSE_VERSION_MAJOR} )
PUBLIC_HEADER "Include/cs.h" )

if ( MSVC )
set_target_properties ( CXSparse_static PROPERTIES
Expand Down Expand Up @@ -182,7 +181,8 @@ install ( TARGETS CXSparse
if ( NOT NSTATIC )
install ( TARGETS CXSparse_static
EXPORT CXSparseTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
8 changes: 4 additions & 4 deletions GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,10 @@ if ( NOT NSTATIC )
add_library ( GraphBLAS_static STATIC ${GRAPHBLAS_SOURCES} )

set_target_properties ( GraphBLAS_static PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
OUTPUT_NAME graphblas
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD 11
C_STANDARD_REQUIRED ON )
C_STANDARD_REQUIRED ON
PUBLIC_HEADER "Include/GraphBLAS.h" )

if ( MSVC )
set_target_properties ( GraphBLAS_static PROPERTIES
Expand Down Expand Up @@ -500,7 +499,8 @@ install ( TARGETS GraphBLAS
if ( NOT NSTATIC )
install ( TARGETS GraphBLAS_static
EXPORT GraphBLASTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
12 changes: 6 additions & 6 deletions KLU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,10 @@ if ( NOT NSTATIC )
add_library ( KLU_static STATIC ${KLU_SOURCES} )

set_target_properties ( KLU_static PROPERTIES
VERSION ${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME klu
SOVERSION ${KLU_VERSION_MAJOR} )
PUBLIC_HEADER "Include/klu.h" )

if ( MSVC )
set_target_properties ( KLU_static PROPERTIES
Expand Down Expand Up @@ -191,11 +190,10 @@ if ( NOT NCHOLMOD )
add_library ( KLU_CHOLMOD_static STATIC ${KLU_CHOLMOD_SOURCES} )

set_target_properties ( KLU_CHOLMOD_static PROPERTIES
VERSION ${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME klu_cholmod
SOVERSION ${KLU_VERSION_MAJOR} )
PUBLIC_HEADER "User/klu_cholmod.h" )

if ( MSVC )
set_target_properties ( KLU_CHOLMOD_static PROPERTIES
Expand Down Expand Up @@ -313,7 +311,8 @@ install ( TARGETS KLU
if ( NOT NSTATIC )
install ( TARGETS KLU_static
EXPORT KLUTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down Expand Up @@ -392,7 +391,8 @@ if ( NOT NCHOLMOD )
if ( NOT NSTATIC )
install ( TARGETS KLU_CHOLMOD_static
EXPORT KLU_CHOLMODTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
5 changes: 2 additions & 3 deletions LAGraph/experimental/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ target_compile_definitions ( LAGraphX PUBLIC LGX_DLL )
if ( NOT NSTATIC )
add_library ( LAGraphX_static STATIC ${LAGRAPHX_LIB_SOURCES} )
SET_TARGET_PROPERTIES ( LAGraphX_static PROPERTIES
VERSION ${LAGraph_VERSION_MAJOR}.${LAGraph_VERSION_MINOR}.${LAGraph_VERSION_SUB}
OUTPUT_NAME lagraphx
POSITION_INDEPENDENT_CODE OFF
SOVERSION ${LAGraph_VERSION_MAJOR}
C_STANDARD_REQUIRED ON
C_STANDARD 11 )
C_STANDARD 11
PUBLIC_HEADER "include/LAGraphX.h" )

if ( MSVC )
set_target_properties ( LAGraphX_static PROPERTIES
Expand Down
5 changes: 2 additions & 3 deletions LAGraph/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ target_compile_definitions ( LAGraph PUBLIC LG_DLL )
if ( NOT NSTATIC )
add_library ( LAGraph_static STATIC ${LAGRAPH_LIB_SOURCES} )
SET_TARGET_PROPERTIES ( LAGraph_static PROPERTIES
VERSION ${LAGraph_VERSION_MAJOR}.${LAGraph_VERSION_MINOR}.${LAGraph_VERSION_SUB}
OUTPUT_NAME lagraph
POSITION_INDEPENDENT_CODE OFF
SOVERSION ${LAGraph_VERSION_MAJOR}
C_STANDARD_REQUIRED ON
C_STANDARD 11 )
C_STANDARD 11
PUBLIC_HEADER "include/LAGraph.h" )

if ( MSVC )
set_target_properties ( LAGraph_static PROPERTIES
Expand Down
6 changes: 3 additions & 3 deletions LDL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ if ( NOT NSTATIC )
add_library ( LDL_static STATIC ${LDL_SOURCES} )

set_target_properties ( LDL_static PROPERTIES
VERSION ${LDL_VERSION_MAJOR}.${LDL_VERSION_MINOR}.${LDL_VERSION_SUB}
C_STANDARD 11
C_STANDARD_REQUIRED ON
OUTPUT_NAME ldl
SOVERSION ${LDL_VERSION_MAJOR} )
PUBLIC_HEADER "Include/ldl.h" )

if ( MSVC )
set_target_properties ( LDL_static PROPERTIES
Expand Down Expand Up @@ -158,7 +157,8 @@ install ( TARGETS LDL
if ( NOT NSTATIC )
install ( TARGETS LDL_static
EXPORT LDLTargets
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

# create (temporary) export target file during build
Expand Down
19 changes: 6 additions & 13 deletions Mongoose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ if ( NOT NSTATIC )
add_library ( Mongoose_static STATIC ${MONGOOSE_LIB_FILES} )
# set_property ( TARGET Mongoose_static PROPERTY POSITION_INDEPENDENT_CODE ON )
set_target_properties ( Mongoose_static PROPERTIES
OUTPUT_NAME mongoose )
OUTPUT_NAME mongoose
PUBLIC_HEADER "Include/Mongoose.hpp" )

if ( MSVC )
set_target_properties ( Mongoose_static PROPERTIES
Expand All @@ -224,8 +225,10 @@ endif ( )
add_library ( Mongoose SHARED ${MONGOOSE_LIB_FILES} )
set_property ( TARGET Mongoose PROPERTY POSITION_INDEPENDENT_CODE ON )
set_target_properties ( Mongoose PROPERTIES
OUTPUT_NAME mongoose
WINDOWS_EXPORT_ALL_SYMBOLS ON )
OUTPUT_NAME mongoose
SOVERSION ${Mongoose_VERSION_MAJOR}
PUBLIC_HEADER "Include/Mongoose.hpp"
WINDOWS_EXPORT_ALL_SYMBOLS ON )

target_include_directories ( Mongoose
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
Expand All @@ -235,16 +238,6 @@ target_link_libraries ( Mongoose PRIVATE SuiteSparse::SuiteSparseConfig )
target_include_directories ( Mongoose PUBLIC
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>" )

# if(CMAKE_MAJOR_VERSION GREATER 2)
# set_target_properties(Mongoose PROPERTIES VERSION ${PROJECT_VERSION})
# set_target_properties(Mongoose PROPERTIES SOVERSION ${Mongoose_VERSION_MAJOR})
# else()
set_target_properties ( Mongoose PROPERTIES
VERSION ${Mongoose_VERSION_MAJOR}.${Mongoose_VERSION_MINOR}.${Mongoose_VERSION_PATCH}
SOVERSION ${Mongoose_VERSION_MAJOR} )
# endif()

set_target_properties ( Mongoose PROPERTIES PUBLIC_HEADER Include/Mongoose.hpp )
target_include_directories ( Mongoose PRIVATE . )

#-------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions ParU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ if ( NOT NSTATIC )
add_library ( ParU_static STATIC ${PARU_SOURCES} )

set_target_properties ( ParU_static PROPERTIES
VERSION ${PARU_VERSION_MAJOR}.${PARU_VERSION_MINOR}.${PARU_VERSION_UPDATE}
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
OUTPUT_NAME paru
SOVERSION ${PARU_VERSION_MAJOR}
PUBLIC_HEADER "Include/ParU.hpp;Include/ParU_C.h;Include/ParU_definitions.h"
WINDOWS_EXPORT_ALL_SYMBOLS ON )

Expand Down
Loading

0 comments on commit 9a23fed

Please sign in to comment.