CMake cannot find test if CMAKE_RUNTIME_OUTPUT_DIRECTORY is changed

前端 未结 3 1270
时光说笑
时光说笑 2021-02-07 03:57

I\'m building my project with CMake, and I\'m trying to create a bunch of test suites for each module. Apparently if I modify the variable CMAKE_RUNTIME_OUTPUT_DIRECTORY

3条回答
  •  天命终不由人
    2021-02-07 04:30

    You will also have this problem if your test command contains parameters and you quote them together with the executable name.

    So if you have something like this:

        add_test(NAME "name" COMMAND "testExe arg1 arg2 arg3")
    

    Instead do this:

        add_test(NAME "name" COMMAND "testExe" "arg1" "arg2" "arg3")
    

    Otherwise CMake will try to find a test executable name with spaces in it.

提交回复
热议问题