Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit a35218d

Browse files
ansasakicryptomilk
authored andcommitted
cmake: Fix target to make sure copy runs in the end
The target created to copy the file must be the one make dist is depending on. Otherwise it will not copy the generated files to the desired path. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> (cherry picked from commit 2aeee51)
1 parent 4d8e2cd commit a35218d

1 file changed

Lines changed: 30 additions & 17 deletions

File tree

cmake/Modules/FindABIMap.cmake

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ function(get_file_list _TARGET_NAME)
300300
ABSOLUTE)
301301

302302
add_custom_target(
303-
${_TARGET_NAME} ALL
303+
${_TARGET_NAME}_int ALL
304304
COMMAND ${CMAKE_COMMAND}
305305
-DOUTPUT_PATH="${_get_files_list_OUTPUT_PATH}"
306306
-DDIRECTORIES="${_get_files_list_DIRECTORIES}"
@@ -310,21 +310,25 @@ function(get_file_list _TARGET_NAME)
310310
"Searching for files"
311311
)
312312

313-
set_target_properties(${_TARGET_NAME}
314-
PROPERTIES LIST_FILE ${_FILES_LIST_OUTPUT_PATH}
315-
)
316-
317313
if (DEFINED _get_files_list_COPY_TO)
318314
# Copy the generated file back to the COPY_TO
319-
add_custom_target(copy_${_TARGET_NAME} ALL
315+
add_custom_target(${_TARGET_NAME} ALL
320316
COMMAND
321317
${CMAKE_COMMAND} -E copy_if_different
322318
${_FILES_LIST_OUTPUT_PATH} ${_get_files_list_COPY_TO}
323-
DEPENDS ${_TARGET_NAME}
319+
DEPENDS ${_TARGET_NAME}_int
324320
COMMENT "Copying ${_TARGET_NAME} to ${_get_files_list_COPY_TO}"
325321
)
322+
else()
323+
add_custom_target(${_TARGET_NAME} ALL
324+
DEPENDS ${_TARGET_NAME}_int
325+
)
326326
endif()
327327

328+
set_target_properties(${_TARGET_NAME}
329+
PROPERTIES LIST_FILE ${_FILES_LIST_OUTPUT_PATH}
330+
)
331+
328332
endfunction()
329333

330334
function(extract_symbols _TARGET_NAME)
@@ -363,7 +367,7 @@ function(extract_symbols _TARGET_NAME)
363367
)
364368

365369
add_custom_target(
366-
${_TARGET_NAME} ALL
370+
${_TARGET_NAME}_int ALL
367371
COMMAND ${CMAKE_COMMAND}
368372
-DOUTPUT_PATH="${_SYMBOLS_OUTPUT_PATH}"
369373
-DHEADERS_LIST_FILE="${_HEADERS_LIST_FILE}"
@@ -373,20 +377,25 @@ function(extract_symbols _TARGET_NAME)
373377
COMMENT "Extracting symbols from headers"
374378
)
375379

376-
set_target_properties(${_TARGET_NAME}
377-
PROPERTIES LIST_FILE ${_SYMBOLS_OUTPUT_PATH}
378-
)
379-
380380
if (DEFINED _extract_symbols_COPY_TO)
381381
# Copy the generated file back to the COPY_TO
382-
add_custom_target(copy_${_TARGET_NAME} ALL
382+
add_custom_target(${_TARGET_NAME} ALL
383383
COMMAND
384384
${CMAKE_COMMAND} -E copy_if_different
385385
${_SYMBOLS_OUTPUT_PATH} ${_extract_symbols_COPY_TO}
386-
DEPENDS "${_TARGET_NAME}"
386+
DEPENDS ${_TARGET_NAME}_int
387387
COMMENT "Copying ${_TARGET_NAME} to ${_extract_symbols_COPY_TO}"
388388
)
389+
else()
390+
add_custom_target(${_TARGET_NAME} ALL
391+
DEPENDS ${_TARGET_NAME}_int
392+
)
389393
endif()
394+
395+
set_target_properties(${_TARGET_NAME}
396+
PROPERTIES LIST_FILE ${_SYMBOLS_OUTPUT_PATH}
397+
)
398+
390399
endfunction()
391400

392401
function(generate_map_file _TARGET_NAME)
@@ -437,7 +446,7 @@ function(generate_map_file _TARGET_NAME)
437446
)
438447

439448
add_custom_target(
440-
${_TARGET_NAME} ALL
449+
${_TARGET_NAME}_int ALL
441450
COMMAND ${CMAKE_COMMAND}
442451
-DABIMAP_EXECUTABLE=${ABIMAP_EXECUTABLE}
443452
-DSYMBOLS="${_SYMBOLS_FILE}"
@@ -460,13 +469,17 @@ function(generate_map_file _TARGET_NAME)
460469

461470
if (DEFINED _generate_map_file_COPY_TO)
462471
# Copy the generated map back to the COPY_TO
463-
add_custom_target(copy_${_TARGET_NAME} ALL
472+
add_custom_target(${_TARGET_NAME} ALL
464473
COMMAND
465474
${CMAKE_COMMAND} -E copy_if_different ${_MAP_OUTPUT_PATH}
466475
${_generate_map_file_COPY_TO}
467-
DEPENDS ${_TARGET_NAME}
476+
DEPENDS ${_TARGET_NAME}_int
468477
COMMENT "Copying ${_MAP_OUTPUT_PATH} to ${_generate_map_file_COPY_TO}"
469478
)
479+
else()
480+
add_custom_target(${_TARGET_NAME} ALL
481+
DEPENDS ${_TARGET_NAME}_int
482+
)
470483
endif()
471484
endfunction()
472485

0 commit comments

Comments
 (0)