Skip to content

Commit 02634b5

Browse files
authored
Add template for OpenBLASConfig.cmake
1 parent 0bea6bb commit 02634b5

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

cmake/OpenBLASConfig.cmake.in

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# OpenBLASConfig.cmake
2+
# --------------------
3+
#
4+
# OpenBLAS cmake module.
5+
# This module sets the following variables in your project::
6+
#
7+
# OpenBLAS_FOUND - true if OpenBLAS and all required components found on the system
8+
# OpenBLAS_VERSION - OpenBLAS version in format Major.Minor.Release
9+
# OpenBLAS_INCLUDE_DIRS - Directory where OpenBLAS header is located.
10+
# OpenBLAS_INCLUDE_DIR - same as DIRS
11+
# OpenBLAS_LIBRARIES - OpenBLAS library to link against.
12+
# OpenBLAS_LIBRARY - same as LIBRARIES
13+
#
14+
#
15+
# Available components::
16+
#
17+
## shared - search for only shared library
18+
## static - search for only static library
19+
# serial - search for unthreaded library
20+
# pthread - search for native pthread threaded library
21+
# openmp - search for OpenMP threaded library
22+
#
23+
#
24+
# Exported targets::
25+
#
26+
# If OpenBLAS is found, this module defines the following :prop_tgt:`IMPORTED`
27+
## target. Target is shared _or_ static, so, for both, use separate, not
28+
## overlapping, installations. ::
29+
#
30+
# OpenBLAS::OpenBLAS - the main OpenBLAS library #with header & defs attached.
31+
#
32+
#
33+
# Suggested usage::
34+
#
35+
# find_package(OpenBLAS)
36+
# find_package(OpenBLAS 0.2.20 EXACT CONFIG REQUIRED COMPONENTS pthread)
37+
#
38+
#
39+
# The following variables can be set to guide the search for this package::
40+
#
41+
# OpenBLAS_DIR - CMake variable, set to directory containing this Config file
42+
# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package
43+
# PATH - environment variable, set to bin directory of this package
44+
# CMAKE_DISABLE_FIND_PACKAGE_OpenBLAS - CMake variable, disables
45+
# find_package(OpenBLAS) when not REQUIRED, perhaps to force internal build
46+
47+
@PACKAGE_INIT@
48+
49+
set(PN OpenBLAS)
50+
51+
# need to check that the @USE_*@ evaluate to something cmake can perform boolean logic upon
52+
if(@USE_OPENMP@)
53+
set(${PN}_openmp_FOUND 1)
54+
elseif(@USE_THREAD@)
55+
set(${PN}_pthread_FOUND 1)
56+
else()
57+
set(${PN}_serial_FOUND 1)
58+
endif()
59+
60+
check_required_components(${PN})
61+
62+
#-----------------------------------------------------------------------------
63+
# Don't include targets if this file is being picked up by another
64+
# project which has already built this as a subproject
65+
#-----------------------------------------------------------------------------
66+
if(NOT TARGET ${PN}::OpenBLAS)
67+
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
68+
69+
get_property(_loc TARGET ${PN}::OpenBLAS PROPERTY LOCATION)
70+
set(${PN}_LIBRARY ${_loc})
71+
get_property(_ill TARGET ${PN}::OpenBLAS PROPERTY INTERFACE_LINK_LIBRARIES)
72+
set(${PN}_LIBRARIES ${_ill})
73+
74+
get_property(_id TARGET ${PN}::OpenBLAS PROPERTY INCLUDE_DIRECTORIES)
75+
set(${PN}_INCLUDE_DIR ${_id})
76+
get_property(_iid TARGET ${PN}::OpenBLAS PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
77+
set(${PN}_INCLUDE_DIRS ${_iid})
78+
endif()
79+

0 commit comments

Comments
 (0)