子目录添加及安装至系统目录下
创建CMakeLists.txt,敲入
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(HelloWorld)
ADD_SUBDIRECTORY(src/hello)
INSTALL(PROGRAMS build/bin/hello DESTINATION /usr/local/bin/)
创建src,然后在src下创建hello
新建hello.cpp
#include <iostream>
int main(int argc,char** argv)
{
std::cout << "Hello World!" << std::endl;