gpt4 book ai didi

cmake - 如何在cmake中将引用的参数传递给add_test?

转载 作者:行者123 更新时间:2023-12-03 15:52:47 25 4
gpt4 key购买 nike

我正在尝试将参数从 cmake 传递给 gtest 测试套件:

add_test(NAME craft_test
COMMAND craft --gtest_output='xml:report.xml')

问题是这些参数被引号括起来传递,为什么?看起来是个bug,有什么好的方法可以避免吗?
$ ctest -V
UpdateCTestConfiguration from :/usr/local/src/craft/build-analyze/DartConfiguration.tcl
UpdateCTestConfiguration from :/usr/local/src/craft/build-analyze/DartConfiguration.tcl
Test project /usr/local/src/craft/build-analyze
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: craft_test

1: Test command: /usr/local/src/craft/build-analyze/craft "--gtest_output='xml:report.xml'"
1: Test timeout computed to be: 9.99988e+06
1: WARNING: unrecognized output format "'xml" ignored.
1: [==========] Running 1 test from 1 test case.
1: [----------] Global test environment set-up.
1: [----------] 1 test from best_answer_test
1: [ RUN ] best_answer_test.test_sample
1: [ OK ] best_answer_test.test_sample (0 ms)
1: [----------] 1 test from best_answer_test (0 ms total)
1:
1: [----------] Global test environment tear-down
1: [==========] 1 test from 1 test case ran. (0 ms total)
1: [ PASSED ] 1 test.
1/1 Test #1: craft_test ....................... Passed 0.00 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) = 0.00 sec

最佳答案

这里的问题不是 CMake 添加的引号;它是 'xml:report.xml' 中的单引号那些有过错。

你应该做:

add_test(NAME craft_test
COMMAND craft --gtest_output=xml:report.xml)

关于cmake - 如何在cmake中将引用的参数传递给add_test?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17264876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com