刚接触cmake,遇到奇怪的现象,根据网上的例子编写简单的CmakeLists,同级目录只有一个文件main.c
PROJECT (HELLO)
SET(SRC_LIST main.c)
MESSAGE(STATUS "This is BINARY dir " ${HELLO_BINARY_DIR})
MESSAGE(STATUS "This is SOURCE dir "${HELLO_SOURCE_DIR})
MESSAGE(STATUS "This is SRC_LIST "${SRC_LIST})
ADD_EXECUTABLE(hello SRC_LIST)
运行cmake ./的时候报错
CMake Warning (dev) at CMakeLists.txt:4:
Syntax Warning in cmake code at column 37
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:5:
Syntax Warning in cmake code at column 35
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
-- This is BINARY dir /home/user/workspace/tmp/backup/cmake/t1
-- This is SOURCE dir /home/user/workspace/tmp/backup/cmake/t1
-- This is SRC_LIST main.c
-- Configuring done
CMake Error at CMakeLists.txt:6 (ADD_EXECUTABLE):
Cannot find source file:
SRC_LIST
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at CMakeLists.txt:6 (ADD_EXECUTABLE):
No SOURCES given to target: hello
CMake Generate step failed. Build files cannot be regenerated correctly.
ADD_EXECUTABLE时我把SRC_LIST换成main.c就通过了
各位老大,这是啥原因啊