diff --git a/build.bat b/build.bat index e78daecad..d85cf694b 100644 --- a/build.bat +++ b/build.bat @@ -200,10 +200,8 @@ cmake --build %build_dir% --config %build_config% --target install if errorlevel 1 goto error if "%build_test%" == "ON" ( - pushd %build_dir% - ctest --output-on-failure + ctest --test-dir %build_dir% -C %build_config% --output-on-failure if errorlevel 1 goto error - popd ) echo. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 80fb5ddd8..62c4c1d64 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,5 +13,6 @@ endif(BUILD_SHARED_LIBS) file(GLOB test_data_files ${PROJECT_SOURCE_DIR}/data/test/*.yaml) file(COPY ${test_data_files} DESTINATION ${EXECUTABLE_OUTPUT_PATH}) -set(rime_test_executable ${EXECUTABLE_OUTPUT_PATH}/rime_test${ext}) -add_test(rime_test ${rime_test_executable}) +add_test(NAME rime_test + COMMAND rime_test + WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})