《CMake实践》第三部分的示例代码的错误

《CMake实践》的第三章,初试cmake - cmake的helloworld
中的

PROJECT (HELLO)
SET(SRC_LIST main.c)
MESSAGE(STATUS"This is BINARYdir" ${HELLO_BINARY_DIR})
MESSAGE(STATUS"This is SOURCEdir"${HELLO_SOURCE_DIR})
ADD_EXECUTABLE(hello SRC_LIST)

最后一行有误,执行cmake .命令后出错:
STATUS"This is BINARYdir"D:/study/cmake
STATUS"This is SOURCEdir"D:/study/cmake
-- 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


-- Build files have been written to: D:/study/cmake


将最后一行的 SRC_LIST改后 ${SRC_LIST}后,问题解决。

猜你喜欢

转载自icbm.iteye.com/blog/1956792