Skip to content

Instantly share code, notes, and snippets.

@dsonck92
Created November 12, 2019 21:58
Show Gist options
  • Save dsonck92/ef396dc80941128454cc74e8a41ba9a4 to your computer and use it in GitHub Desktop.
Save dsonck92/ef396dc80941128454cc74e8a41ba9a4 to your computer and use it in GitHub Desktop.
mkdir build
pushd build
cmake ..
cmake --build .
popd
cmake_minimum_required(VERSION 3.15) # Define the minimum CMake version, can go lower
project(helloworld) # Your project name
add_executable(${PROJECT_NAME}) # Define an executable target, same name as project
target_sources(${PROJECT_NAME} # Modern way of adding sources, add it to the executable named above
PRIVATE # All "internal" code which will not be used by other external programs
main.cpp) # The actual file list
#include <iostream>
int main(int argc, char* argv[]) {
std::cout << "Hello World" << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment