Skip to content

Commit

Permalink
build: use ${CMAKE_BINARY_DIR} when running 'cmake --build ..'
Browse files Browse the repository at this point in the history
this change is a follow-up of 338ba97.

before this change, ${CMAKE_CURRENT_BINARY_DIR} is used for
Seastar_BINARY_DIR. if Seastar is a top-level project, the values
of ${CMAKE_CURRENT_BINARY_DIR} and ${CMAKE_BINARY_DIR} are
identical. but if Seastar is embedded in a parent project,
${CMAKE_BINARY_DIR} would be somewhere like "bulid/seastar" where
"build" is the build directory of the parent project.
but we are still referencing the build directory with
${Seastar_BINARY_DIR} and issuing commands like

cmake --build ${Seastar_BINARY_DIR} --target ${target}

if this would fail as the build directory is not ${Seastar_BINARY_DIR}
anymore. if the cmake generator is make, the failure would look like:

> gmake: *** No rule to make target 'test_unit_abort_source_run'.  Stop.

if the cmake generator is ninja, the failure would look like:

> 1/95 Test  #1: Seastar.unit.abort_source .....................***Failed    0.02 sec
> ninja: error: loading 'build.ninja': No such file or directory

after this change, all occurrences of

cmake --build ${Seastar_BINARY_DIR}

are changed to

cmake --build ${CMAKE_BINARY_DIR}

this ensure that these commands can find the build directory
at the top level of the build tree.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
  • Loading branch information
tchaikov authored and avikivity committed Jan 9, 2023
1 parent 64ec338 commit bffcea1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/memcached/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ add_custom_target (app_memcached_test_memcached_run

add_test (
NAME Seastar.app.memcached.memcached
COMMAND ${CMAKE_COMMAND} --build ${Seastar_BINARY_DIR} --target app_memcached_test_memcached_run)
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target app_memcached_test_memcached_run)

set_tests_properties (Seastar.app.memcached.memcached
PROPERTIES
Expand Down Expand Up @@ -69,7 +69,7 @@ add_custom_target (app_memcached_test_ascii_run

add_test (
NAME Seastar.app.memcached.ascii
COMMAND ${CMAKE_COMMAND} --build ${Seastar_BINARY_DIR} --target app_memcached_test_ascii_run)
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target app_memcached_test_ascii_run)

set_tests_properties (Seastar.app.memcached.ascii
PROPERTIES
Expand Down

0 comments on commit bffcea1

Please sign in to comment.