1 # - Find @CMAKE_PROJECT_NAME@ 2 libraries
2 # Find the specified @CMAKE_PROJECT_NAME@ 2 libraries and header files.
4 # Since @CMAKE_PROJECT_NAME@ consists of a number of libraries you need to specify which
5 # of those you want to use. To do so, pass a list of their names after
6 # the COMPONENTS argument to FIND_PACKAGE. A typical call looks like this:
7 # FIND_PACKAGE(@CMAKE_PROJECT_NAME@ REQUIRED COMPONENTS OSGBase OSGSystem OSGDrawable)
8 # OSG_OPTIONAL_COMPONENTS can be used to exclude optional components from
9 # the computation of @CMAKE_PROJECT_NAME@_FOUND
11 # This module specifies the following variables:
12 # @CMAKE_PROJECT_NAME@_INCLUDE_DIRS
13 # @CMAKE_PROJECT_NAME@_LIBRARIES
14 # @CMAKE_PROJECT_NAME@_LIBRARY_DIRS
16 # For each component COMP the capitalized name (e.g. OSGBASE, OSGSYSTEM):
17 # @CMAKE_PROJECT_NAME@_${COMP}_LIBRARY
18 # @CMAKE_PROJECT_NAME@_${COMP}_LIBRARY_RELEASE
19 # @CMAKE_PROJECT_NAME@_${COMP}_LIBRARY_DEBUG
21 # You can control where this module attempts to locate libraries and headers:
22 # you can use the following input variables:
23 # @CMAKE_PROJECT_NAME_UP@_ROOT root of an installed @CMAKE_PROJECT_NAME@ with include/OpenSG and lib below it
24 # @CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR header directory
25 # @CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR library directory
27 # @CMAKE_PROJECT_NAME@_DIR is what is automaticall added by cmake
28 IF(NOT @CMAKE_PROJECT_NAME_UP@_ROOT AND @CMAKE_PROJECT_NAME@_DIR)
29 SET(@CMAKE_PROJECT_NAME_UP@_ROOT ${@CMAKE_PROJECT_NAME@_DIR})
30 ENDIF(NOT @CMAKE_PROJECT_NAME_UP@_ROOT AND @CMAKE_PROJECT_NAME@_DIR)
32 IF(NOT OSG_FORCE_CACHE_UPDATE)
33 SET(__@CMAKE_PROJECT_NAME@_IN_CACHE TRUE)
34 IF(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
35 FOREACH(COMPONENT ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS})
36 STRING(TOUPPER ${COMPONENT} COMPONENT)
37 IF(NOT @CMAKE_PROJECT_NAME@_${COMPONENT}_FOUND)
38 SET(__@CMAKE_PROJECT_NAME@_IN_CACHE FALSE)
39 ENDIF(NOT @CMAKE_PROJECT_NAME@_${COMPONENT}_FOUND)
41 ELSE(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
42 SET(__@CMAKE_PROJECT_NAME@_IN_CACHE FALSE)
43 ENDIF(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
44 ENDIF(NOT OSG_FORCE_CACHE_UPDATE)
46 # The reason that we failed to find @CMAKE_PROJECT_NAME@. This will be set to a
47 # user-friendly message when we fail to find some necessary piece of
48 # @CMAKE_PROJECT_NAME@.
49 set(@CMAKE_PROJECT_NAME@_ERROR_REASON)
51 SET(__OSG_LIBDIR_SUFFIX "")
53 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
54 SET(__OSG_LIBDIR_SUFFIX "64")
57 ############################################
59 # Check the existence of the libraries.
61 ############################################
62 # This macro is directly taken from FindBoost.cmake that comes with the cmake
63 # distribution. It is NOT my work, only minor modifications have been made to
64 # remove references to boost.
65 #########################################################################
67 MACRO(__@CMAKE_PROJECT_NAME@_ADJUST_LIB_VARS basename component)
68 IF(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
70 IF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG AND @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE)
71 # if the generator supports configuration types then set
72 # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
73 IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
74 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY optimized ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE} debug ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG})
75 ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
76 # if there are no configuration types and CMAKE_BUILD_TYPE has no value
77 # then just use the release libraries
78 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE} )
79 ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
81 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARIES optimized ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE} debug ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG})
82 ENDIF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG AND @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE)
84 # if only the release version was found, set the debug variable also to the release version
85 IF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE AND NOT @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG)
86 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE})
87 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARIES ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE})
88 ENDIF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE AND NOT @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG)
90 # if only the debug version was found, set the release variable also to the debug version
91 IF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG AND NOT @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE)
92 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG})
93 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARIES ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG})
94 ENDIF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG AND NOT @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE)
96 IF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY)
97 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY ${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY} CACHE FILEPATH "The @CMAKE_PROJECT_NAME@ ${basename} library")
98 GET_FILENAME_COMPONENT(@CMAKE_PROJECT_NAME@_LIBRARY_DIRS "${@CMAKE_PROJECT_NAME@_${basename}_LIBRARY}" PATH)
99 SET(@CMAKE_PROJECT_NAME@_LIBRARY_DIRS ${@CMAKE_PROJECT_NAME@_LIBRARY_DIRS} CACHE FILEPATH "@CMAKE_PROJECT_NAME@ library directory")
100 SET(@CMAKE_PROJECT_NAME@_${basename}_FOUND ON CACHE INTERNAL "Whether the @CMAKE_PROJECT_NAME@ ${basename} library found")
101 ENDIF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY)
103 IF(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG OR @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUGOPT OR
104 @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE OR @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASENOOPT)
106 SET(@CMAKE_PROJECT_NAME@_${basename}_FOUND ON CACHE INTERNAL "Whether the @CMAKE_PROJECT_NAME@ ${basename} library found")
108 SET(@CMAKE_PROJECT_NAME@_${basename}_LIBRARY ${component})
111 ENDIF(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
113 # Make variables changeble to the advanced user
115 @CMAKE_PROJECT_NAME@_${basename}_LIBRARY
116 @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_RELEASE
117 @CMAKE_PROJECT_NAME@_${basename}_LIBRARY_DEBUG
119 ENDMACRO(__@CMAKE_PROJECT_NAME@_ADJUST_LIB_VARS)
122 FUNCTION(SETUP_OSG_LIB_TARGETS COMPONENT UPPERCOMPONENT)
124 ADD_LIBRARY(${COMPONENT} SHARED IMPORTED)
126 IF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE)
128 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR_OPT ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE}
132 SET(OSG_IMP_RELEASE IMPORTED_LOCATION_RELEASE ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE})
134 SET(OSG_IMP_RELEASE IMPORTED_IMPLIB_RELEASE ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE}
135 IMPORTED_LOCATION_RELEASE ${OSG_TMP_LIB_DIR_OPT})
138 ENDIF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE)
141 IF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT)
143 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR_OPT ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT}
147 SET(OSG_IMP_RELEASENOOPT IMPORTED_LOCATION_RELEASENOOPT ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT})
149 SET(OSG_IMP_RELEASENOOPT IMPORTED_IMPLIB_RELEASENOOPT ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT}
150 IMPORTED_LOCATION_RELEASENOOPT ${OSG_TMP_LIB_DIR_OPT})
153 ENDIF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT)
156 IF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG)
158 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR_DBG ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG}
162 SET(OSG_IMP_DEBUG IMPORTED_LOCATION_DEBUG ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG})
163 SET(OSG_IMP_DEBUG ${OSG_IMP_DEBUG} IMPORTED_LOCATION_DEBUGGV ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG})
165 SET(OSG_IMP_DEBUG IMPORTED_IMPLIB_DEBUG ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG}
166 IMPORTED_LOCATION_DEBUG ${OSG_TMP_LIB_DIR_DBG})
169 ENDIF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG)
172 IF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT)
174 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR_DBG ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT}
178 SET(OSG_IMP_DEBUGOPT IMPORTED_LOCATION_DEBUGOPT ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT})
179 SET(OSG_IMP_DEBUGOPT ${OSG_IMP_DEBUGOPT} IMPORTED_LOCATION_DEBUGOPTGV ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT})
181 SET(OSG_IMP_DEBUGOPT IMPORTED_IMPLIB_DEBUGOPT ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT}
182 IMPORTED_LOCATION_DEBUGOPT ${OSG_TMP_LIB_DIR_DBG})
185 ENDIF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT)
187 IF(OSG_IMP_RELEASE OR OSG_IMP_RELEASENOOPT OR OSG_IMP_DEBUG OR OSG_IMP_DEBUGOPT)
188 SET_TARGET_PROPERTIES(${COMPONENT} PROPERTIES
190 ${OSG_IMP_RELEASENOOPT}
192 ${OSG_IMP_DEBUGOPT} )
193 ENDIF(OSG_IMP_RELEASE OR OSG_IMP_RELEASENOOPT OR OSG_IMP_DEBUG OR OSG_IMP_DEBUGOPT)
195 ENDFUNCTION(SETUP_OSG_LIB_TARGETS)
197 #-------------------------------------------------------------------------------
200 IF(__@CMAKE_PROJECT_NAME@_IN_CACHE)
201 # values are already in the cache
203 SET(@CMAKE_PROJECT_NAME@_FOUND TRUE)
204 FOREACH(COMPONENT ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS})
205 STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
207 # avoid setting up componentes more than once - which is not
208 # allowed for import libraries
209 IF(NOT TARGET ${COMPONENT})
210 __@CMAKE_PROJECT_NAME@_ADJUST_LIB_VARS(${UPPERCOMPONENT} ${COMPONENT})
212 SET(@CMAKE_PROJECT_NAME@_LIBRARIES ${@CMAKE_PROJECT_NAME@_LIBRARIES} ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY})
213 SETUP_OSG_LIB_TARGETS(${COMPONENT} ${UPPERCOMPONENT})
214 ENDIF(NOT TARGET ${COMPONENT})
215 ENDFOREACH(COMPONENT)
217 SET(@CMAKE_PROJECT_NAME@_INCLUDE_DIRS "${@CMAKE_PROJECT_NAME@_INCLUDE_DIR}" "${@CMAKE_PROJECT_NAME@_INCLUDE_DIR}/OpenSG")
219 ELSE(__@CMAKE_PROJECT_NAME@_IN_CACHE)
220 # need to search for libs
222 SET(__@CMAKE_PROJECT_NAME@_INCLUDE_SEARCH_DIRS
225 "$ENV{ProgramFiles}/OpenSG"
229 SET(__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS
232 "$ENV{ProgramFiles}/OpenSG"
236 # handle input variable @CMAKE_PROJECT_NAME_UP@_ROOT
237 IF(@CMAKE_PROJECT_NAME_UP@_ROOT)
238 FILE(TO_CMAKE_PATH ${@CMAKE_PROJECT_NAME_UP@_ROOT} @CMAKE_PROJECT_NAME_UP@_ROOT)
239 SET(__@CMAKE_PROJECT_NAME@_INCLUDE_SEARCH_DIRS
240 ${@CMAKE_PROJECT_NAME_UP@_ROOT}/include
241 ${@CMAKE_PROJECT_NAME_UP@_ROOT}
242 ${__@CMAKE_PROJECT_NAME@_INCLUDE_SEARCH_DIRS})
244 SET(__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS
245 ${@CMAKE_PROJECT_NAME_UP@_ROOT}/lib
246 ${@CMAKE_PROJECT_NAME_UP@_ROOT}/stage/lib
247 ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS})
249 IF(__OSG_LIBDIR_SUFFIX)
250 SET(__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS
251 ${@CMAKE_PROJECT_NAME_UP@_ROOT}/lib${__OSG_LIBDIR_SUFFIX}
252 ${@CMAKE_PROJECT_NAME_UP@_ROOT}/stage/lib${__OSG_LIBDIR_SUFFIX}
253 ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS})
255 ENDIF(@CMAKE_PROJECT_NAME_UP@_ROOT)
257 # handle input variable @CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR
258 IF(@CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR)
259 FILE(TO_CMAKE_PATH ${@CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR} @CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR)
260 SET(__@CMAKE_PROJECT_NAME@_INCLUDE_SEARCH_DIRS
261 ${@CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR} ${__@CMAKE_PROJECT_NAME@_INCLUDE_SEARCH_DIRS})
262 ENDIF(@CMAKE_PROJECT_NAME_UP@_INCLUDE_DIR)
264 # handle input variable @CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR
265 IF(@CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR)
266 FILE(TO_CMAKE_PATH ${@CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR} @CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR)
267 SET(__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS
268 ${@CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR} ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS})
269 ENDIF(@CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR)
272 IF(NOT @CMAKE_PROJECT_NAME@_INCLUDE_DIR)
273 # try to find include dirrectory by searching for @CMAKE_PROJECT_NAME_SHORT@Configured.h
275 FIND_PATH(@CMAKE_PROJECT_NAME@_INCLUDE_DIR
276 NAMES OpenSG/@CMAKE_PROJECT_NAME_SHORT@Configured.h
277 HINTS ${__@CMAKE_PROJECT_NAME@_INCLUDE_SEARCH_DIRS})
278 ENDIF(NOT @CMAKE_PROJECT_NAME@_INCLUDE_DIR)
280 # ------------------------------------------------------------------------
281 # Begin finding OpenSG libraries
282 # ------------------------------------------------------------------------
283 FOREACH(COMPONENT ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS})
284 STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
285 SET(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY "@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
286 SET(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE "@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
287 SET(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG "@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
290 SET(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT "@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT-NOTFOUND" )
291 SET(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT "@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT-NOTFOUND")
294 FIND_LIBRARY(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASE
296 HINTS ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS}
297 PATH_SUFFIXES "release" "rel" "opt" "relwithdbg"
301 FIND_LIBRARY(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG
302 NAMES "${COMPONENT}D"
303 HINTS ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS}
304 PATH_SUFFIXES "debug" "dbg" "debugopt"
307 FIND_LIBRARY(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_RELEASENOOPT
308 NAMES "${COMPONENT}RN"
309 HINTS ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS}
310 PATH_SUFFIXES "relnoopt"
313 FIND_LIBRARY(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUGOPT
314 NAMES "${COMPONENT}DO"
315 HINTS ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS}
316 PATH_SUFFIXES "debugopt"
319 FIND_LIBRARY(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY_DEBUG
321 HINTS ${__@CMAKE_PROJECT_NAME@_LIBRARIES_SEARCH_DIRS}
322 PATH_SUFFIXES "debug" "dbg"
326 __@CMAKE_PROJECT_NAME@_ADJUST_LIB_VARS(${UPPERCOMPONENT} ${COMPONENT})
328 ENDFOREACH(COMPONENT)
329 # ------------------------------------------------------------------------
330 # End finding @CMAKE_PROJECT_NAME@ libraries
331 # ------------------------------------------------------------------------
333 SET(@CMAKE_PROJECT_NAME@_INCLUDE_DIRS "${@CMAKE_PROJECT_NAME@_INCLUDE_DIR}" "${@CMAKE_PROJECT_NAME@_INCLUDE_DIR}/OpenSG")
335 SET(@CMAKE_PROJECT_NAME@_FOUND FALSE)
337 IF(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
338 SET(@CMAKE_PROJECT_NAME@_FOUND TRUE)
340 # check if all requested components were found
341 SET(__@CMAKE_PROJECT_NAME@_CHECKED_COMPONENT FALSE)
342 SET(__@CMAKE_PROJECT_NAME@_MISSING_COMPONENTS)
344 FOREACH(_COMPONENT ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS})
345 STRING(TOUPPER ${_COMPONENT} COMPONENT)
346 SET(__@CMAKE_PROJECT_NAME@_CHECKED_COMPONENT TRUE)
348 IF(NOT @CMAKE_PROJECT_NAME@_${COMPONENT}_FOUND)
349 STRING(TOLOWER ${COMPONENT} COMPONENT)
350 LIST(APPEND __@CMAKE_PROJECT_NAME@_MISSING_COMPONENTS ${COMPONENT})
352 LIST(FIND OSG_OPTIONAL_COMPONENTS ${_COMPONENT} _CMP_OPTIONAL)
354 IF(_CMP_OPTIONAL EQUAL -1)
355 SET(@CMAKE_PROJECT_NAME@_FOUND FALSE)
357 ENDIF(NOT @CMAKE_PROJECT_NAME@_${COMPONENT}_FOUND)
358 ENDFOREACH(_COMPONENT)
360 IF(__@CMAKE_PROJECT_NAME@_MISSING_COMPONENTS)
361 # We were unable to find some libraries, so generate a sensible
362 # error message that lists the libraries we were unable to find.
363 SET(@CMAKE_PROJECT_NAME@_ERROR_REASON
364 "${@CMAKE_PROJECT_NAME@_ERROR_REASON}\nThe following @CMAKE_PROJECT_NAME@ libraries could not be found:\n")
365 FOREACH(COMPONENT ${__@CMAKE_PROJECT_NAME@_MISSING_COMPONENTS})
366 SET(@CMAKE_PROJECT_NAME@_ERROR_REASON
367 "${@CMAKE_PROJECT_NAME@_ERROR_REASON} ${COMPONENT}\n")
368 ENDFOREACH(COMPONENT)
370 LIST(LENGTH @CMAKE_PROJECT_NAME@_FIND_COMPONENTS __@CMAKE_PROJECT_NAME@_NUM_COMPONENTS_WANTED)
371 LIST(LENGTH __@CMAKE_PROJECT_NAME@_MISSING_COMPONENTS __@CMAKE_PROJECT_NAME@_NUM_MISSING_COMPONENTS)
372 IF(${__@CMAKE_PROJECT_NAME@_NUM_COMPONENTS_WANTED} EQUAL ${__@CMAKE_PROJECT_NAME@_NUM_MISSING_COMPONENTS})
373 SET(@CMAKE_PROJECT_NAME@_ERROR_REASON
374 "${@CMAKE_PROJECT_NAME@_ERROR_REASON}No @CMAKE_PROJECT_NAME@ libraries were found. You may need to set @CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR to the directory containing @CMAKE_PROJECT_NAME@ libraries or @CMAKE_PROJECT_NAME_UP@_ROOT to the location of @CMAKE_PROJECT_NAME@.")
375 ELSE(${__@CMAKE_PROJECT_NAME@_NUM_COMPONENTS_WANTED} EQUAL ${__@CMAKE_PROJECT_NAME@_NUM_MISSING_COMPONENTS})
376 SET(@CMAKE_PROJECT_NAME@_ERROR_REASON
377 "${@CMAKE_PROJECT_NAME@_ERROR_REASON}Some (but not all) of the required @CMAKE_PROJECT_NAME@ libraries were found. You may need to install these additional @CMAKE_PROJECT_NAME@ libraries. Alternatively, set @CMAKE_PROJECT_NAME_UP@_LIBRARY_DIR to the directory containing @CMAKE_PROJECT_NAME@ libraries or @CMAKE_PROJECT_NAME_UP@_ROOT to the location of @CMAKE_PROJECT_NAME@.")
378 ENDIF(${__@CMAKE_PROJECT_NAME@_NUM_COMPONENTS_WANTED} EQUAL ${__@CMAKE_PROJECT_NAME@_NUM_MISSING_COMPONENTS})
379 ENDIF(__@CMAKE_PROJECT_NAME@_MISSING_COMPONENTS)
381 ENDIF(@CMAKE_PROJECT_NAME@_INCLUDE_DIR)
383 IF(@CMAKE_PROJECT_NAME@_FOUND)
384 IF(NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY)
385 MESSAGE(STATUS "@CMAKE_PROJECT_NAME@ found.")
386 ENDIF(NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY)
388 IF (NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY)
389 MESSAGE(STATUS "Found the following @CMAKE_PROJECT_NAME@ libraries:")
390 ENDIF(NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY)
392 FOREACH(COMPONENT ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS})
393 STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
394 IF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_FOUND)
395 IF(NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY)
396 MESSAGE(STATUS " ${COMPONENT}")
397 ENDIF(NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY)
399 SETUP_OSG_LIB_TARGETS(${COMPONENT} ${UPPERCOMPONENT})
401 SET(@CMAKE_PROJECT_NAME@_LIBRARIES ${@CMAKE_PROJECT_NAME@_LIBRARIES} ${@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_LIBRARY})
402 ENDIF(@CMAKE_PROJECT_NAME@_${UPPERCOMPONENT}_FOUND)
403 ENDFOREACH(COMPONENT)
405 ELSE(@CMAKE_PROJECT_NAME@_FOUND)
406 IF(@CMAKE_PROJECT_NAME@_FIND_REQUIRED)
407 MESSAGE(SEND_ERROR "Unable to find the requested @CMAKE_PROJECT_NAME@ libraries.\n${@CMAKE_PROJECT_NAME@_ERROR_REASON}")
408 ENDIF(@CMAKE_PROJECT_NAME@_FIND_REQUIRED)
409 ENDIF(@CMAKE_PROJECT_NAME@_FOUND)
411 ENDIF(__@CMAKE_PROJECT_NAME@_IN_CACHE)