《CMake实践》第三部分的示例代码的错误
《CMake实践》的第三章,初试cmake - cmake的helloworld 中的
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})
ADD_EXECUTABLE(hello SRC_LIST)
最后一行有误,执行“cmake .” 命令后出错:
$ cmake .
statusThis is BINARY dir /home/jianbao/eclipseProjects/cc-07
statusThis is SOURCE dir /home/jianbao/eclipseProjects/cc-07
-- Configuring done
CMake Error at CMakeLists.txt:5 (ADD_EXECUTABLE):
Cannot find source file:SRC_LIST
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
解决方案:
将最后一行的 SRC_LIST 改为 ${SRC_LIST} 后,问题解决。