Skip to content

Commit d2f7937

Browse files
committed
#2397: fmt: fix a bunch of cmake trying to fix installation problems
1 parent ca89500 commit d2f7937

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

cmake/trace_only_functions.cmake

+5-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function(create_trace_only_target)
140140

141141
install(
142142
TARGETS ${VT_TRACE_LIB}
143-
EXPORT ${VT_TRACE_TARGETS}
143+
EXPORT ${VT_TRACE_LIB}
144144
CONFIGURATIONS ${build_type_list}
145145
LIBRARY DESTINATION lib
146146
ARCHIVE DESTINATION lib
@@ -149,15 +149,18 @@ function(create_trace_only_target)
149149
)
150150

151151
install(
152-
EXPORT ${VT_TRACE_TARGETS}
152+
EXPORT ${VT_TRACE_LIB}
153153
DESTINATION cmake
154154
NAMESPACE vt::
155155
FILE "vt-traceTargets.cmake"
156156
CONFIGURATIONS ${build_type_list}
157157
)
158158

159+
install(TARGETS ${FMT_LIBRARY} EXPORT ${VT_TRACE_LIB})
160+
159161
export(
160162
TARGETS ${VT_TRACE_LIB}
163+
${FMT_LIBRARY}
161164
FILE "vt-traceTargets.cmake"
162165
NAMESPACE vt::
163166
)

lib/fmt/CMakeLists.txt

+22-8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ function(enable_module target)
3636
endif ()
3737
endfunction()
3838

39+
function(join_paths joined_path first_path_segment)
40+
set(temp_path "${first_path_segment}")
41+
foreach(current_segment IN LISTS ARGN)
42+
if(NOT ("${current_segment}" STREQUAL ""))
43+
if(IS_ABSOLUTE "${current_segment}")
44+
set(temp_path "${current_segment}")
45+
else()
46+
set(temp_path "${temp_path}/${current_segment}")
47+
endif()
48+
endif()
49+
endforeach()
50+
set(${joined_path} "${temp_path}" PARENT_SCOPE)
51+
endfunction()
52+
3953
set(FMT_USE_CMAKE_MODULES FALSE)
4054
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.28 AND
4155
CMAKE_GENERATOR STREQUAL "Ninja")
@@ -72,7 +86,7 @@ option(FMT_WERROR "Halt the compilation with an error on compiler warnings."
7286
OFF)
7387

7488
# Options that control generation of various targets.
75-
option(FMT_INSTALL "Generate the install target." OFF)
89+
option(FMT_INSTALL "Generate the install target." ON)
7690
option(FMT_OS "Include OS-specific APIs." OFF)
7791
option(FMT_MODULE "Build a module instead of a traditional library." OFF)
7892
option(FMT_SYSTEM_HEADERS "Expose headers with marking them as system." OFF)
@@ -168,7 +182,7 @@ endif ()
168182
function(add_headers VAR)
169183
set(headers ${${VAR}})
170184
foreach (header ${ARGN})
171-
set(headers ${headers} include/fmt-vt/${header})
185+
set(headers ${headers} ${CMAKE_CURRENT_SOURCE_DIR}/include/fmt-vt/${header})
172186
endforeach()
173187
set(${VAR} ${headers} PARENT_SCOPE)
174188
endfunction()
@@ -364,13 +378,13 @@ if (FMT_INSTALL)
364378
VERSION ${FMT_VERSION}
365379
COMPATIBILITY AnyNewerVersion)
366380

367-
# join_paths(libdir_for_pc_file "\${exec_prefix}" "${FMT_LIB_DIR}")
368-
# join_paths(includedir_for_pc_file "\${prefix}" "${FMT_INC_DIR}")
381+
join_paths(libdir_for_pc_file "\${exec_prefix}" "${FMT_LIB_DIR}")
382+
join_paths(includedir_for_pc_file "\${prefix}" "${FMT_INC_DIR}")
369383

370-
# configure_file(
371-
# "${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in"
372-
# "${pkgconfig}"
373-
# @ONLY)
384+
configure_file(
385+
"${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in"
386+
"${pkgconfig}"
387+
@ONLY)
374388
configure_package_config_file(
375389
${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in
376390
${project_config}

0 commit comments

Comments
 (0)