Skip to content

Commit 2866d6e

Browse files
committed
use same target
1 parent 4e766d9 commit 2866d6e

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

cmake_modules/BuildUtils.cmake

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function(ADD_ICEBERG_LIB LIB_NAME)
127127
PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS})
128128

129129
install(TARGETS ${LIB_NAME}_shared
130-
EXPORT ${LIB_NAME}_targets
130+
EXPORT iceberg_targets
131131
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
132132
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
133133
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
@@ -176,21 +176,14 @@ function(ADD_ICEBERG_LIB LIB_NAME)
176176
endif()
177177

178178
install(TARGETS ${LIB_NAME}_static
179-
EXPORT ${LIB_NAME}_targets
179+
EXPORT iceberg_targets
180180
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
181181
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
182182
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
183183
INCLUDES
184184
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
185185
endif()
186186

187-
string(TOLOWER ${LIB_NAME} LIB_NAME_LOWER_CASE)
188-
string(REPLACE "_" "-" LIB_NAME_DASH_SEPARATED_LOWER_CASE ${LIB_NAME_LOWER_CASE})
189-
install(EXPORT ${LIB_NAME}_targets
190-
DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/Iceberg"
191-
NAMESPACE "Iceberg::"
192-
FILE "${LIB_NAME_DASH_SEPARATED_LOWER_CASE}-targets.cmake")
193-
194187
# Modify variable in calling scope
195188
if(ARG_OUTPUTS)
196189
set(${ARG_OUTPUTS}

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ write_basic_package_version_file(
2929
"${CMAKE_CURRENT_BINARY_DIR}/iceberg-config-version.cmake"
3030
COMPATIBILITY SameMajorVersion)
3131

32+
install(EXPORT iceberg_targets
33+
DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/Iceberg"
34+
NAMESPACE "Iceberg::"
35+
FILE "iceberg-targets.cmake")
36+
3237
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/iceberg-config.cmake"
3338
"${CMAKE_CURRENT_BINARY_DIR}/iceberg-config-version.cmake"
3439
DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/Iceberg")

src/config.cmake.in

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ macro(iceberg_find_dependencies dependencies)
5858
endmacro()
5959

6060
macro(iceberg_find_components components)
61-
file(GLOB_RECURSE _target_cmake_files "${CMAKE_CURRENT_LIST_DIR}/*-targets.cmake")
62-
foreach(_target_cmake_file ${_target_cmake_files})
63-
include(${_target_cmake_file})
64-
endforeach()
65-
6661
foreach(comp ${components})
6762
string(TOLOWER "${comp}" _comp_lower_case)
6863
if(TARGET "Iceberg::iceberg_${_comp_lower_case}_shared" OR
@@ -110,7 +105,9 @@ macro(iceberg_find_vendor_dependencies dependencies)
110105
endforeach()
111106
endmacro()
112107

113-
# Find components and include targets
108+
include("${CMAKE_CURRENT_LIST_DIR}/iceberg-targets.cmake")
109+
110+
# Find required components
114111
iceberg_find_components("${Iceberg_FIND_COMPONENTS}")
115112

116113
# Find system dependencies

0 commit comments

Comments
 (0)