|
19 | 19 | # PCMSolver_PYMOD - path to PCMSolver python modules
|
20 | 20 | #
|
21 | 21 | #
|
22 |
| -# Available components: shared static exe |
23 |
| -# |
24 |
| -# :: |
25 |
| -# |
26 |
| -# shared - search for only shared library |
27 |
| -# static - search for only static library |
28 |
| -# exe - search for executable as well as library |
29 |
| -# |
30 |
| -# |
31 | 22 | # Exported targets:
|
32 | 23 | #
|
33 | 24 | # ::
|
|
43 | 34 | # ::
|
44 | 35 | #
|
45 | 36 | # find_package(PCMSolver)
|
46 |
| -# find_package(PCMSolver 1.1.7 CONFIG REQUIRED COMPONENTS shared) |
| 37 | +# find_package(PCMSolver 1.1.7 CONFIG REQUIRED) |
47 | 38 | #
|
48 | 39 | #
|
49 | 40 | # The following variables can be set to guide the search for this package:
|
|
58 | 49 |
|
59 | 50 | @PACKAGE_INIT@
|
60 | 51 |
|
61 |
| -set(PN PCMSolver) |
62 |
| -set (_valid_components |
63 |
| - static |
64 |
| - shared |
65 |
| - exe |
66 |
| -) |
67 |
| - |
68 |
| -# find includes |
69 |
| -unset(_temp_h CACHE) |
70 |
| -find_path(_temp_h |
71 |
| - NAMES PCMSolver/pcmsolver.h |
72 |
| - PATHS ${PACKAGE_PREFIX_DIR}/@INSTALL_INCLUDEDIR@ |
73 |
| - NO_DEFAULT_PATH) |
74 |
| -if(_temp_h) |
75 |
| - set(${PN}_INCLUDE_DIR "${_temp_h}") |
76 |
| - set(${PN}_INCLUDE_DIRS ${${PN}_INCLUDE_DIR}) |
77 |
| -else() |
78 |
| - set(${PN}_FOUND 0) |
79 |
| - if(NOT CMAKE_REQUIRED_QUIET) |
80 |
| - message(STATUS "${PN}Config missing component: header (${PN}: ${_temp_h})") |
81 |
| - endif() |
82 |
| -endif() |
83 |
| - |
84 |
| -# find executable |
85 |
| -list(FIND ${PN}_FIND_COMPONENTS "exe" _seek_exe) |
86 |
| -unset(_temp_exe CACHE) |
87 |
| -find_program(_temp_exe |
88 |
| - NAMES run_pcm |
89 |
| - PATHS ${PACKAGE_PREFIX_DIR}/@INSTALL_BINDIR@ |
90 |
| - NO_DEFAULT_PATH) |
91 |
| -if(_temp_exe) |
92 |
| - set(${PN}_EXECUTABLE "${_temp_exe}") |
93 |
| - if(_seek_exe GREATER -1) |
94 |
| - set(${PN}_exe_FOUND 1) |
95 |
| - endif() |
96 |
| -else() |
97 |
| - if(_seek_exe GREATER -1) |
98 |
| - if(NOT CMAKE_REQUIRED_QUIET) |
99 |
| - message(STATUS "${PN}Config missing component: executable (${PN}: ${_temp_exe})") |
100 |
| - endif() |
101 |
| - endif() |
102 |
| -endif() |
103 |
| - |
104 |
| -set(${PN}_LAUNCHER ${PACKAGE_PREFIX_DIR}/@INSTALL_BINDIR@/go_pcm.py) |
105 |
| - |
106 |
| -# find library: shared, static, or whichever |
107 |
| -set(_hold_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) |
108 |
| -list(FIND ${PN}_FIND_COMPONENTS "shared" _seek_shared) |
109 |
| -list(FIND ${PN}_FIND_COMPONENTS "static" _seek_static) |
110 |
| -if(_seek_shared GREATER -1) |
111 |
| - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) |
112 |
| -elseif(_seek_static GREATER -1) |
113 |
| - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) |
114 |
| -endif() |
115 |
| -unset(_temp CACHE) |
116 |
| -find_library(_temp |
117 |
| - NAMES pcm |
118 |
| - PATHS ${PACKAGE_PREFIX_DIR}/@INSTALL_LIBDIR@ |
119 |
| - NO_DEFAULT_PATH) |
120 |
| -if(_temp) |
121 |
| - set(${PN}_LIBRARY "${_temp}") |
122 |
| - if(_seek_shared GREATER -1) |
123 |
| - set(${PN}_shared_FOUND 1) |
124 |
| - elseif(_seek_static GREATER -1) |
125 |
| - set(${PN}_static_FOUND 1) |
126 |
| - endif() |
127 |
| -else() |
128 |
| - if(_seek_shared GREATER -1) |
129 |
| - if(NOT CMAKE_REQUIRED_QUIET) |
130 |
| - message(STATUS "${PN}Config missing component: shared library (${PN}: ${_temp})") |
131 |
| - endif() |
132 |
| - elseif(_seek_static GREATER -1) |
133 |
| - if(NOT CMAKE_REQUIRED_QUIET) |
134 |
| - message(STATUS "${PN}Config missing component: static library (${PN}: ${_temp})") |
135 |
| - endif() |
136 |
| - else() |
137 |
| - set(${PN}_FOUND 0) |
138 |
| - if(NOT CMAKE_REQUIRED_QUIET) |
139 |
| - message(STATUS "${PN}Config missing component: library (${PN}: ${_temp})") |
140 |
| - endif() |
141 |
| - endif() |
142 |
| -endif() |
143 |
| -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_hold_library_suffixes}) |
144 |
| -set(${PN}_LIBRARIES ${${PN}_LIBRARY}) |
145 |
| -set(${PN}_DEFINITIONS USING_${PN}) |
146 |
| -set(${PN}_PYMOD ${PACKAGE_PREFIX_DIR}/@INSTALL_LIBDIR@/@PYMOD_INSTALL_LIBDIR@) |
147 |
| - |
148 |
| -check_required_components(${PN}) |
| 52 | +include("${CMAKE_CURRENT_LIST_DIR}/PCMSolverTargets.cmake") |
| 53 | +check_required_components( |
| 54 | + "pcm" |
| 55 | + "run_pcm" |
| 56 | + ) |
149 | 57 |
|
150 |
| -#----------------------------------------------------------------------------- |
151 |
| -# Don't include targets if this file is being picked up by another |
152 |
| -# project which has already built this as a subproject |
153 |
| -#----------------------------------------------------------------------------- |
154 |
| -if(NOT TARGET ${PN}::pcm) |
155 |
| - get_filename_component(_fext ${${PN}_LIBRARY} EXT) |
156 |
| - #if(${_fext} STREQUAL ${CMAKE_SHARED_LIBRARY_SUFFIX}) |
157 |
| - # include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets-shared.cmake") |
158 |
| - #else() |
159 |
| - # include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets-static.cmake") |
160 |
| - #endif() |
161 |
| - include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake") |
| 58 | +# Set some useful variables |
| 59 | +set(PCMSolver_INCLUDE_DIR ${PACKAGE_PREFIX_DIR}/@INSTALL_INCLUDEDIR@) |
| 60 | +set(PCMSolver_INCLUDE_DIRS ${PCMSolver_INCLUDE_DIR}) |
| 61 | +set(PCMSolver_LIBRARY ${PACKAGE_PREFIX_DIR}/@INSTALL_LIBDIR@) |
| 62 | +set(PCMSolver_LIBRARIES ${PCMSolver_LIBRARY}) |
| 63 | +set(PCMSolver_DEFINITIONS USING_PCMSolver) |
| 64 | +set(PCMSolver_PYMOD ${PACKAGE_PREFIX_DIR}/@INSTALL_LIBDIR@/@PYMOD_INSTALL_LIBDIR@) |
| 65 | +set(PCMSolver_LAUNCHER ${PACKAGE_PREFIX_DIR}/@INSTALL_BINDIR@/go_pcm.py) |
| 66 | +set(PCMSolver_EXECUTABLE ${PACKAGE_PREFIX_DIR}/@INSTALL_BINDIR@/run_pcm) |
162 | 67 |
|
163 |
| - include(CMakeFindDependencyMacro) |
164 |
| - if(NOT TARGET ZLIB::ZLIB) |
165 |
| - find_dependency(ZLIB) |
166 |
| - endif() |
| 68 | +include(CMakeFindDependencyMacro) |
| 69 | +if(NOT TARGET ZLIB::ZLIB) |
| 70 | + find_dependency(ZLIB) |
167 | 71 | endif()
|
0 commit comments