《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} 后,问题解决。  

 

相关文章:

  • 2021-07-14
  • 1970-01-01
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-07-15
  • 2021-05-08
  • 2023-03-20
相关资源
相似解决方案