build: cmake: expose and use the path to iotune correctly

in 415c83fa, we introduced a regression which broke the build of
target of "package". because

- the IMPORT_LOCATION_<CONFIG> of the imported target of
  "Seastar::iotune" includes a literal `$<CONFIG>`
- we retrieve the property named "IMPORTED_LOCATION" from
  this target. but value of this property is empty.

so, when we copied this file, the "src" parameter passed to
`cmake -E copy` is actually an empty string.

in this change, we

- set the `IMPORTED_LOCATION_${CONFIG}` property with a
  correct path.
- retrieve the property with the right approach -- to use
  `TARGET_FILE` generator expression.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#21181
This commit is contained in:
Kefu Chai
2024-10-19 12:10:59 +08:00
committed by Botond Dénes
parent b5a1173880
commit 8355056453
2 changed files with 2 additions and 2 deletions

View File

@@ -110,6 +110,6 @@ if(NOT TARGET Seastar::iotune)
string (TOUPPER ${config} CONFIG)
set_property(TARGET Seastar::iotune
PROPERTY
IMPORTED_LOCATION_${CONFIG} ${CMAKE_BINARY_DIR}/$<CONFIG>/seastar/apps/iotune/iotune)
IMPORTED_LOCATION_${CONFIG} ${CMAKE_BINARY_DIR}/${config}/seastar/apps/iotune/iotune)
endforeach()
endif()

2
dist/CMakeLists.txt vendored
View File

@@ -46,7 +46,7 @@ add_stripped("${CMAKE_BINARY_DIR}/$<CONFIG>/scylla")
# app_iotune is located in seastar/apps/iotune
if(TARGET Seastar::iotune)
set(iotune_src "$<TARGET_PROPERTY:Seastar::iotune,IMPORTED_LOCATION>")
set(iotune_src "$<TARGET_FILE:Seastar::iotune>")
else()
set(iotune_src "$<TARGET_FILE:app_iotune>")
endif()