CMake - add_executable called with incorrect number of arguments

后端 未结 2 1317
忘了有多久
忘了有多久 2021-01-13 19:46

I am trying to organize a C++ project which starts to have a lot of files. I would like to create two executables which share some source file using Cmake. I have found an i

2条回答
  •  悲哀的现实
    2021-01-13 20:16

    You have to quote the variables.

    add_executable(test_mss "${Common_sources}" "${Mss_sources}")
    

    Otherwise for an empty variable, CMake replaces the variable by nothing and the number of arguments seems to be wrong.

    Similar problem: https://stackoverflow.com/a/39733128/2799037

提交回复
热议问题