|
1 |
| -# BITPITConfig.cmake - bitpit CMake configuration file for external projects. |
2 |
| -# ----------- |
3 |
| -# |
4 |
| -# This file is configured by bitpit and used by the UseBITPIT.cmake module |
5 |
| -# to load bitpit's settings for an external project. |
6 |
| - |
7 |
| -# Compute the installation prefix from this BITPITConfig.cmake file location. |
8 |
| -@BITPIT_INSTALL_PREFIX_CODE@ |
9 |
| - |
10 |
| -# If a different UseBITPIT.cmake was previoulsy loaded a reconfiguration |
11 |
| -# is needed |
12 |
| -if(NOT ("${BITPIT_INSTALL_PREFIX}/@BITPIT_INSTALL_CMAKEDIR@" STREQUAL BITPIT_INSTALL_CMAKEDIR_PREVIOUS)) |
13 |
| - set(BITPIT_RECONFIGURE 1) |
14 |
| - set(BITPIT_INSTALL_CMAKEDIR_PREVIOUS "${BITPIT_INSTALL_PREFIX}/@BITPIT_INSTALL_CMAKEDIR@" CACHE INTERNAL "Defines the previous bitpit CMake configuration file loaded") |
15 |
| -endif() |
16 |
| - |
17 |
| -# The C and C++ flags added by bitpit to the cmake-configured flags. |
18 |
| -SET(BITPIT_REQUIRED_C_FLAGS "") |
19 |
| -SET(BITPIT_REQUIRED_CXX_FLAGS "") |
20 |
| -SET(BITPIT_REQUIRED_EXE_LINKER_FLAGS "") |
21 |
| -SET(BITPIT_REQUIRED_SHARED_LINKER_FLAGS "") |
22 |
| -SET(BITPIT_REQUIRED_MODULE_LINKER_FLAGS "") |
23 |
| - |
24 |
| -# The bitpit version number |
25 |
| -SET(BITPIT_MAJOR_VERSION "@BITPIT_MAJOR_VERSION@") |
26 |
| -SET(BITPIT_MINOR_VERSION "@BITPIT_MINOR_VERSION@") |
27 |
| -SET(BITPIT_PATCH_VERSION "@BITPIT_PATCH_VERSION@") |
28 |
| -SET(BITPIT_VERSION "@BITPIT_VERSION@") |
29 |
| - |
30 |
| -# The location of the UseBITPIT.cmake file. |
31 |
| -SET(BITPIT_CMAKE_DIR "${BITPIT_INSTALL_PREFIX}/@BITPIT_INSTALL_CMAKEDIR@") |
32 |
| -SET(BITPIT_USE_FILE "${BITPIT_CMAKE_DIR}/UseBITPIT.cmake") |
33 |
| - |
34 |
| -# Flag for shared build |
35 |
| -SET(BITPIT_SHARED "@BUILD_SHARED_LIBS@") |
36 |
| - |
37 |
| -# Include macros for finding packages |
38 |
| -list(APPEND CMAKE_MODULE_PATH ${BITPIT_CMAKE_DIR}) |
39 |
| -include(LibFindMacros) |
40 |
| -include(FindPackageHandleStandardArgs) |
| 1 | +@PACKAGE_INIT@ |
41 | 2 |
|
42 | 3 | #-----------------------------------------------------------------------------
|
43 |
| -# Find bitpit libraries and headers |
| 4 | +# Modules |
44 | 5 | #-----------------------------------------------------------------------------
|
45 | 6 |
|
46 |
| -# Headers |
47 |
| -if(BITPIT_RECONFIGURE) |
48 |
| - unset(BITPIT_INCLUDE_DIR CACHE) |
49 |
| -endif() |
50 |
| - |
51 |
| -find_path( BITPIT_INCLUDE_DIR "@[email protected]" |
52 |
| - HINTS "${BITPIT_INSTALL_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@/") |
53 |
| - |
54 |
| -mark_as_advanced(BITPIT_INCLUDE_DIR) |
55 |
| - |
56 |
| -# Library |
57 |
| -if(BITPIT_RECONFIGURE) |
58 |
| - unset(BITPIT_LIBRARY_RELEASE CACHE) |
59 |
| - unset(BITPIT_LIBRARY_DEBUG CACHE) |
60 |
| -endif() |
61 |
| - |
62 |
| -find_library(BITPIT_LIBRARY_RELEASE |
63 |
| - NAMES @PROJECT_NAME@@BITPIT_RELEASE_POSTFIX@ @PROJECT_NAME@ |
64 |
| - HINTS "${BITPIT_INSTALL_PREFIX}/@CMAKE_INSTALL_LIBDIR@") |
65 |
| - |
66 |
| -find_library(BITPIT_LIBRARY_DEBUG |
67 |
| - NAMES @PROJECT_NAME@@BITPIT_DEBUG_POSTFIX@ @PROJECT_NAME@ |
68 |
| - HINTS "${BITPIT_INSTALL_PREFIX}/@CMAKE_INSTALL_LIBDIR@") |
69 |
| - |
70 |
| -mark_as_advanced(BITPIT_LIBRARY_RELEASE) |
71 |
| -mark_as_advanced(BITPIT_LIBRARY_DEBUG) |
72 |
| - |
73 |
| -# Choose good values for BITPIT_LIBRARY, BITPIT_LIBRARIES, |
74 |
| -# BITPIT_LIBRARY_DEBUG, and BITPIT_LIBRARY_RELEASE depending on what |
75 |
| -# has been found and set. If only BITPIT_LIBRARY_RELEASE is defined, |
76 |
| -# BITPIT_LIBRARY will be set to the release value, and |
77 |
| -# BITPIT_LIBRARY_DEBUG will be set to BITPIT_LIBRARY_DEBUG-NOTFOUND. |
78 |
| -# If only BITPIT_LIBRARY_DEBUG is defined, then BITPIT_LIBRARY will |
79 |
| -# take the debug value, and BITPIT_LIBRARY_RELEASE will be set to |
80 |
| -# BITPIT_LIBRARY_RELEASE-NOTFOUND. |
81 |
| -# |
82 |
| -# If the generator supports configuration types, then BITPIT_LIBRARY |
83 |
| -# and BITPIT_LIBRARIES will be set with debug and optimized flags |
84 |
| -# specifying the library to be used for the given configuration. If no |
85 |
| -# build type has been set or the generator in use does not support |
86 |
| -# configuration types, then BITPIT_LIBRARY and BITPIT_LIBRARIES will |
87 |
| -# take only the release value, or the debug value if the release one is |
88 |
| -# not set. |
89 |
| -if (BITPIT_LIBRARY_DEBUG AND BITPIT_LIBRARY_RELEASE AND |
90 |
| - NOT BITPIT_LIBRARY_DEBUG STREQUAL BITPIT_LIBRARY_RELEASE AND |
91 |
| - (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)) |
92 |
| - set( BITPIT_LIBRARY "" ) |
93 |
| - foreach( _libname IN LISTS BITPIT_LIBRARY_RELEASE ) |
94 |
| - list( APPEND BITPIT_LIBRARY optimized "${_libname}" ) |
95 |
| - endforeach() |
96 |
| - foreach( _libname IN LISTS BITPIT_LIBRARY_DEBUG ) |
97 |
| - list( APPEND BITPIT_LIBRARY debug "${_libname}" ) |
98 |
| - endforeach() |
99 |
| -elseif (BITPIT_LIBRARY_RELEASE) |
100 |
| - set (BITPIT_LIBRARY ${BITPIT_LIBRARY_RELEASE}) |
101 |
| -elseif (BITPIT_LIBRARY_DEBUG) |
102 |
| - set (BITPIT_LIBRARY ${BITPIT_LIBRARY_DEBUG}) |
103 |
| -else () |
104 |
| - set( BITPIT_LIBRARY "BITPIT_LIBRARY-NOTFOUND") |
105 |
| -endif () |
106 |
| - |
107 |
| -# bitpit Definitions |
108 |
| -set(BITPIT_DEFINITIONS "@BITPIT_INTERFACE_COMPILE_DEFINITIONS@") |
109 |
| - |
110 | 7 | # List of currently enabled bitpit modules
|
111 | 8 | set(BITPIT_ENABLED_MODULE_LIST "@BITPIT_ENABLED_MODULE_LIST@")
|
112 | 9 |
|
@@ -143,18 +40,24 @@ if(BITPIT_FIND_OPTIONAL_COMPONENTS)
|
143 | 40 | endforeach()
|
144 | 41 | endif()
|
145 | 42 |
|
146 |
| -# Unset the unneeded variables |
147 |
| -if(BITPIT_RECONFIGURE) |
148 |
| - unset(BITPIT_RECONFIGURE) |
149 |
| -endif() |
| 43 | +#----------------------------------------------------------------------------- |
| 44 | +# Location of UseBITPIT.cmake file. |
| 45 | +#----------------------------------------------------------------------------- |
| 46 | + |
| 47 | +SET(BITPIT_USE_FILE "@CMAKE_INSTALL_PREFIX@/@BITPIT_INSTALL_CMAKEDIR@/UseBITPIT.cmake") |
| 48 | + |
| 49 | +#----------------------------------------------------------------------------- |
| 50 | +# Programming languages |
| 51 | +#----------------------------------------------------------------------------- |
150 | 52 |
|
151 |
| -# Let libfind_process initialize the appropriate variables |
152 |
| -libfind_process(BITPIT) |
| 53 | +set(BITPIT_LANGUAGES "@BITPIT_LANGUAGES@") |
153 | 54 |
|
154 | 55 | #-----------------------------------------------------------------------------
|
155 | 56 | # Find bitpit external dependencies
|
156 | 57 | #-----------------------------------------------------------------------------
|
157 | 58 |
|
| 59 | +list(APPEND CMAKE_MODULE_PATH "@CMAKE_INSTALL_PREFIX@/@BITPIT_INSTALL_CMAKEDIR@") |
| 60 | + |
158 | 61 | # Set external dependencies information
|
159 | 62 | set(_EXTERNAL_DEPENDENCIES "@BITPIT_EXTERNAL_DEPENDENCIES@")
|
160 | 63 | set(_EXTERNAL_VARIABLES_LIBRARIES "@BITPIT_EXTERNAL_VARIABLES_LIBRARIES@")
|
@@ -199,29 +102,21 @@ foreach (VARIABLE_NAME IN LISTS _EXTERNAL_VARIABLES_INCLUDE_DIRS)
|
199 | 102 | endforeach ()
|
200 | 103 |
|
201 | 104 | #-----------------------------------------------------------------------------
|
202 |
| -# Set programming languages |
| 105 | +# Include targets |
203 | 106 | #-----------------------------------------------------------------------------
|
204 |
| -set(BITPIT_LANGUAGES "@BITPIT_LANGUAGES@") |
| 107 | +include ( "${CMAKE_CURRENT_LIST_DIR}/@BITPIT_CMAKE_TARGETS_FILE@" ) |
205 | 108 |
|
206 | 109 | #-----------------------------------------------------------------------------
|
207 |
| -# Create imported target |
| 110 | +# Backwards compatibility |
208 | 111 | #-----------------------------------------------------------------------------
|
209 |
| -if(BITPIT_SHARED) |
210 |
| - set(LIBRARY_TYPE SHARED) |
211 |
| -else() |
212 |
| - set(LIBRARY_TYPE STATIC) |
213 |
| -endif() |
214 | 112 |
|
215 |
| -if(NOT TARGET bitpit::bitpit) |
216 |
| - add_library(bitpit::bitpit ${LIBRARY_TYPE} IMPORTED GLOBAL) |
| 113 | +# Definitions |
| 114 | +get_target_property(BITPIT_DEFINITIONS @BITPIT_LIBRARY@::@BITPIT_LIBRARY@ INTERFACE_COMPILE_DEFINITIONS) |
217 | 115 |
|
218 |
| - set_target_properties(bitpit::bitpit |
219 |
| - PROPERTIES |
220 |
| - IMPORTED_LOCATION "${BITPIT_LIBRARY}" |
221 |
| - INTERFACE_INCLUDE_DIRECTORIES "${BITPIT_INCLUDE_DIRS}" |
222 |
| - INTERFACE_COMPILE_DEFINITIONS "${BITPIT_DEFINITIONS}") |
| 116 | +# Include directories |
| 117 | +get_target_property(BITPIT_INCLUDE_DIRS @BITPIT_LIBRARY@::@BITPIT_LIBRARY@ INTERFACE_INCLUDE_DIRECTORIES) |
223 | 118 |
|
224 |
| - # The property INTERFACE_LINK_LIBRARIES is set using target_link_libraries so that the debug |
225 |
| - # and optimized keywords work. |
226 |
| - target_link_libraries(bitpit::bitpit INTERFACE ${BITPIT_LIBRARIES}) |
227 |
| -endif() |
| 119 | +# Include libraries |
| 120 | +get_target_property(BITPIT_LIBRARY @BITPIT_LIBRARY@::@BITPIT_LIBRARY@ LOCATION) |
| 121 | +get_target_property(BITPIT_LINK_LIBRARIES @BITPIT_LIBRARY@::@BITPIT_LIBRARY@ INTERFACE_LINK_LIBRARIES) |
| 122 | +set(BITPIT_LIBRARIES "${BITPIT_LINK_LIBRARIES};${BITPIT_LIBRARY}") |
0 commit comments