Austin Schuh | 1eb16d1 | 2015-09-06 17:21:56 -0700 | [diff] [blame^] | 1 | ## gflags CMake configuration file |
| 2 | |
| 3 | # library version information |
| 4 | set (@PACKAGE_NAME@_VERSION_STRING "@PACKAGE_VERSION@") |
| 5 | set (@PACKAGE_NAME@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@) |
| 6 | set (@PACKAGE_NAME@_VERSION_MINOR @PACKAGE_VERSION_MINOR@) |
| 7 | set (@PACKAGE_NAME@_VERSION_PATCH @PACKAGE_VERSION_PATCH@) |
| 8 | |
| 9 | # import targets |
| 10 | include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-export.cmake") |
| 11 | |
| 12 | # installation prefix |
| 13 | get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) |
| 14 | get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREFIX_REL2CONFIG_DIR@" ABSOLUTE) |
| 15 | |
| 16 | # include directory |
| 17 | # |
| 18 | # Newer versions of CMake set the INTERFACE_INCLUDE_DIRECTORIES property |
| 19 | # of the imported targets. It is hence not necessary to add this path |
| 20 | # manually to the include search path for targets which link to gflags. |
| 21 | set (@PACKAGE_NAME@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@") |
| 22 | |
| 23 | # default settings |
| 24 | if (NOT DEFINED @PACKAGE_NAME@_SHARED) |
| 25 | if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@_nothreads-static) |
| 26 | set (@PACKAGE_NAME@_SHARED FALSE) |
| 27 | else () |
| 28 | set (@PACKAGE_NAME@_SHARED TRUE) |
| 29 | endif () |
| 30 | endif () |
| 31 | if (NOT DEFINED @PACKAGE_NAME@_NOTHREADS) |
| 32 | if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@-shared) |
| 33 | set (@PACKAGE_NAME@_NOTHREADS FALSE) |
| 34 | else () |
| 35 | set (@PACKAGE_NAME@_NOTHREADS TRUE) |
| 36 | endif () |
| 37 | endif () |
| 38 | |
| 39 | # choose imported library target |
| 40 | if (NOT @PACKAGE_NAME@_TARGET) |
| 41 | if (@PACKAGE_NAME@_SHARED) |
| 42 | if (@PACKAGE_NAME@_NOTHREADS) |
| 43 | set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@_nothreads-shared) |
| 44 | else () |
| 45 | set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@-shared) |
| 46 | endif () |
| 47 | else () |
| 48 | if (@PACKAGE_NAME@_NOTHREADS) |
| 49 | set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@_nothreads-static) |
| 50 | else () |
| 51 | set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@-static) |
| 52 | endif () |
| 53 | endif () |
| 54 | endif () |
| 55 | if (NOT TARGET ${@PACKAGE_NAME@_TARGET}) |
| 56 | message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_NAME@_TARGET} library target!" |
| 57 | " Try a different combination of @PACKAGE_NAME@_SHARED and @PACKAGE_NAME@_NOTHREADS.") |
| 58 | endif () |
| 59 | |
| 60 | # add more convenient "@PACKAGE_NAME@" import target |
| 61 | if (NOT TARGET @PACKAGE_NAME@) |
| 62 | if (@PACKAGE_NAME@_SHARED) |
| 63 | add_library (@PACKAGE_NAME@ SHARED IMPORTED) |
| 64 | else () |
| 65 | add_library (@PACKAGE_NAME@ STATIC IMPORTED) |
| 66 | endif () |
| 67 | # INTERFACE_INCLUDE_DIRECTORIES |
| 68 | get_target_property (_@PACKAGE_NAME@_INCLUDES ${@PACKAGE_NAME@_TARGET} INTERFACE_INCLUDE_DIRECTORIES) |
| 69 | if (_@PACKAGE_NAME@_INCLUDES) |
| 70 | set_target_properties(@PACKAGE_NAME@ PROPERTIES |
| 71 | INTERFACE_INCLUDE_DIRECTORIES "${_@PACKAGE_NAME@_INCLUDES}" |
| 72 | ) |
| 73 | endif () |
| 74 | unset (_@PACKAGE_NAME@_INCLUDES) |
| 75 | # set configuration specific properties |
| 76 | get_target_property (_@PACKAGE_NAME@_CONFIGURATIONS ${@PACKAGE_NAME@_TARGET} IMPORTED_CONFIGURATIONS) |
| 77 | set_target_properties (@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_NAME@_CONFIGURATIONS}") |
| 78 | foreach (_@PACKAGE_NAME@_CONFIG IN LISTS _@PACKAGE_NAME@_CONFIGURATIONS) |
| 79 | # IMPORTED_LOCATION_<config> |
| 80 | get_target_property (_@PACKAGE_NAME@_LOCATION ${@PACKAGE_NAME@_TARGET} IMPORTED_LOCATION_${_@PACKAGE_NAME@_CONFIG}) |
| 81 | if (_@PACKAGE_NAME@_LOCATION) |
| 82 | set_target_properties(@PACKAGE_NAME@ PROPERTIES |
| 83 | IMPORTED_LOCATION_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_LOCATION}" |
| 84 | ) |
| 85 | endif () |
| 86 | unset (_@PACKAGE_NAME@_LOCATION) |
| 87 | # IMPORTED_LINK_INTERFACE_LANGUAGES_<config> (static) |
| 88 | get_target_property (_@PACKAGE_NAME@_LANGUAGES ${@PACKAGE_NAME@_TARGET} IMPORTED_LINK_INTERFACE_LANGUAGES_${_@PACKAGE_NAME@_CONFIG}) |
| 89 | if (_@PACKAGE_NAME@_LANGUAGES) |
| 90 | set_target_properties(@PACKAGE_NAME@ PROPERTIES |
| 91 | IMPORTED_LINK_INTERFACE_LANGUAGES_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_LANGUAGES}" |
| 92 | ) |
| 93 | endif () |
| 94 | unset (_@PACKAGE_NAME@_LANGUAGES) |
| 95 | # IMPORTED_SONAME_<config> (shared) |
| 96 | get_target_property (_@PACKAGE_NAME@_SONAME ${@PACKAGE_NAME@_TARGET} IMPORTED_SONAME_${_@PACKAGE_NAME@_CONFIG}) |
| 97 | if (_@PACKAGE_NAME@_SONAME) |
| 98 | set_target_properties(@PACKAGE_NAME@ PROPERTIES |
| 99 | IMPORTED_SONAME_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_SONAME}" |
| 100 | ) |
| 101 | endif () |
| 102 | unset (_@PACKAGE_NAME@_SONAME) |
| 103 | endforeach () |
| 104 | unset (_@PACKAGE_NAME@_CONFIGURATIONS) |
| 105 | endif () |
| 106 | |
| 107 | # alias for default import target to be compatible with older CMake package configurations |
| 108 | set (@PACKAGE_NAME@_LIBRARIES "${@PACKAGE_NAME@_TARGET}") |
| 109 | |
| 110 | # unset private variables |
| 111 | unset (_INSTALL_PREFIX) |