我刚刚开始使用CMake.我成功地建立了最小的Hello,World!C++应用程序可能适用于Windows 7上的Visual Studio 2012,但我有一个最后一个唠叨的事情,这是不太正确,我无法弄清楚为什么:(
我的文件夹结构是:
[cmakeTest]
- [build]
- [source]
- [helloWorld]
- main.cpp
- CMakeLists.txt
- CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)
我的main.cpp文件只是:
#include <iostream>
int main()
{
std::cout << "Hello World!";
}
Run Code Online (Sandbox Code Playgroud)
source/CMakeLists.txt 是:
cmake_minimum_required (VERSION 3.0.1)
# Specifies project name for Visual Studio solution.
# Visual Studio projects will be made for each CMake target specified
project(cmakeTesting)
# Set the install directory
set(CMAKE_INSTALL_PREFIX ${cmakeTesting_BINARY_DIR}/bin)
# Generate organiser projects
# Creates "CMakePredefinedTargets" folder with INSTALL and ZERO_CHECK
set_property(GLOBAL PROPERTY …Run Code Online (Sandbox Code Playgroud)