Skip to content

Commit 0bea6bb

Browse files
authored
Create OpenBLASConfig.cmake from cmake as well
1 parent 0297b32 commit 0bea6bb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ option(BUILD_WITHOUT_LAPACK "Without LAPACK and LAPACKE (Only BLAS or CBLAS)" ON
2020
endif()
2121
option(BUILD_WITHOUT_CBLAS "Without CBLAS" OFF)
2222
option(DYNAMIC_ARCH "Build with DYNAMIC_ARCH" OFF)
23+
option(DYNAMIC_OLDER "Support older cpus with DYNAMIC_ARCH" OFF)
2324
option(BUILD_RELAPACK "Build with ReLAPACK (recursive LAPACK" OFF)
2425
#######
2526
if(BUILD_WITHOUT_LAPACK)
@@ -208,6 +209,7 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
208209

209210
# Install libraries
210211
install(TARGETS ${OpenBLAS_LIBNAME}
212+
EXPORT "OpenBLASTargets"
211213
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
212214
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
213215
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
@@ -267,3 +269,21 @@ if(PKG_CONFIG_FOUND)
267269
configure_file(${PROJECT_SOURCE_DIR}/cmake/openblas.pc.in ${PROJECT_BINARY_DIR}/openblas.pc @ONLY)
268270
install (FILES ${PROJECT_BINARY_DIR}/openblas.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
269271
endif()
272+
273+
274+
# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share".
275+
set(PN OpenBLAS)
276+
set(CMAKECONFIG_INSTALL_DIR "share/cmake/${PN}")
277+
configure_package_config_file(cmake/${PN}Config.cmake.in
278+
"${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake"
279+
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
280+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
281+
VERSION ${${PN}_VERSION}
282+
COMPATIBILITY AnyNewerVersion)
283+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake
284+
${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
285+
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
286+
install(EXPORT "${PN}Targets"
287+
NAMESPACE "${PN}::"
288+
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
289+

0 commit comments

Comments
 (0)