This repository has been archived by the owner on Apr 9, 2019. It is now read-only.
forked from ilyak/libefp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libefpConfig.cmake.in
145 lines (137 loc) · 4.54 KB
/
libefpConfig.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# libefpConfig.cmake
# ------------------
#
# LIBEFP cmake module.
# This module sets the following variables in your project:
#
# ::
#
# libefp_FOUND - true if libefp and all required components found on the system
# libefp_VERSION - liberp version in format Major.Minor.Release
# libefp_INCLUDE_DIRS - Directory where libefp header is located.
# libefp_INCLUDE_DIR - same as DIRS
# libefp_DEFINITIONS: Definitions necessary to use libefp, namely USING_libefp.
# libefp_LIBRARIES - libefp library to link against.
# libefp_LIBRARY - same as LIBRARIES
# libefp_FRAGLIB_DIRS - Directories (list) where EFP fragments are located
#
#
# Available components: shared static
#
# ::
#
# shared - search for only shared library
# static - search for only static library
# shallow - search for only fragment library where directory structure has been collapsed
#
#
# Exported targets:
#
# ::
#
# If libefp is found, this module defines the following :prop_tgt:`IMPORTED`
# target. Target is shared _or_ static, so, for both, use separate, not
# overlapping, installations. ::
#
# libefp::efp - the main libefp library with header & defs attached.
#
#
# Suggested usage:
#
# ::
#
# find_package(libefp)
# find_package(libefp 1.3.0 EXACT CONFIG REQUIRED COMPONENTS shared)
#
#
# The following variables can be set to guide the search for this package:
#
# ::
#
# libefp_DIR - CMake variable, set to directory containing this Config file
# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package
# PATH - environment variable, set to bin directory of this package
# CMAKE_DISABLE_FIND_PACKAGE_libefp - CMake variable, disables
# find_package(libefp) when not REQUIRED, perhaps to force internal build
@PACKAGE_INIT@
set(PN libefp)
set (_valid_components
static
shared
shallow
)
# find includes
unset(_temp_h CACHE)
find_path(_temp_h
NAMES efp.h
PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@
NO_DEFAULT_PATH)
if(_temp_h)
set(${PN}_INCLUDE_DIR "${_temp_h}")
set(${PN}_INCLUDE_DIRS ${${PN}_INCLUDE_DIR})
else()
set(${PN}_FOUND 0)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "${PN}Config missing component: header (${PN}: ${_temp_h})")
endif()
endif()
# find library: shared, static, or whichever
set(_hold_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
list(FIND ${PN}_FIND_COMPONENTS "shared" _seek_shared)
list(FIND ${PN}_FIND_COMPONENTS "static" _seek_static)
if(_seek_shared GREATER -1)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
elseif(_seek_static GREATER -1)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
unset(_temp CACHE)
find_library(_temp
NAMES efp
PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@
NO_DEFAULT_PATH)
if(_temp)
set(${PN}_LIBRARY "${_temp}")
if(_seek_shared GREATER -1)
set(${PN}_shared_FOUND 1)
elseif(_seek_static GREATER -1)
set(${PN}_static_FOUND 1)
endif()
else()
if(_seek_shared GREATER -1)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "${PN}Config missing component: shared library (${PN}: ${_temp})")
endif()
elseif(_seek_static GREATER -1)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "${PN}Config missing component: static library (${PN}: ${_temp})")
endif()
else()
set(${PN}_FOUND 0)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "${PN}Config missing component: library (${PN}: ${_temp})")
endif()
endif()
endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_hold_library_suffixes})
set(${PN}_LIBRARIES ${${PN}_LIBRARY})
# find fraglibs
list(FIND ${PN}_FIND_COMPONENTS "shallow" _seek_shallow)
string(REGEX REPLACE "([^;]+)" "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_DATADIR@/${PN}/\\1" ${PN}_FRAGLIB_DIRS "@FRAGLIB_DATADIRS@")
if(_seek_shallow GREATER -1)
list(LENGTH ${PN}_FRAGLIB_DIRS _temp_len)
if(_temp_len EQUAL 1)
set(${PN}_shallow_FOUND 1)
else()
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "${PN}Config missing component: shallow fraglib (${PN}: ${${PN}_FRAGLIB_DIRS})")
endif()
endif()
endif()
check_required_components(${PN})
#-----------------------------------------------------------------------------
# Don't include targets if this file is being picked up by another
# project which has already built this as a subproject
#-----------------------------------------------------------------------------
if(NOT TARGET ${PN}::efp)
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
endif()