CMake Practice 第三部分的示例代码的错误

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

PROJECT (HELLO)
SET(SRC_LIST     \color{red}{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 .” 命令后报错:

-- 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


CMake Error: CMake can not determine linker language for target: hello
CMake Error: Cannot determine link language for target "hello".

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

你可能感兴趣的:(cmake,cmake)