From e53fd06a680352b424b41d4a97ebee15b16f3ee4 Mon Sep 17 00:00:00 2001 From: Alfie King Date: Wed, 23 Oct 2024 11:06:49 +0100 Subject: [PATCH] added cmake again :| --- .gitignore | 3 ++- CMakeLists.txt | 6 ++++++ README.md | 7 +++---- 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 8b04cd9..a877eb5 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,5 @@ *.app # Build files -build/ \ No newline at end of file +build/ +.vscode/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e841582 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.5) +find_program(CMAKE_C_COMPILER NAMES $ENV{CC} gcc PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} g++ PATHS ENV PATH NO_DEFAULT_PATH) +project(owo) +add_executable(owo src/main.cpp) +target_link_libraries(owo) diff --git a/README.md b/README.md index 2596cdf..8b7330e 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,11 @@ $ ./owo -o output.txt "Hello, world!" ``` ## Building -to build the program, you will need a c++ compiler. I have no idea what im doing with cmake so this uses a very basic make file that is made to build the linux and windows binaries. -If you are on windows, good luck. I have no clue how to setup g++ on windows. I would recommend using WSL or a VM. If you are on linux, you can build the program with the following commands -(assuming you have g++ installed): ```bash +$ cmake . -B build +$ cd build && make $ make -$ build/owo "Hello, world!" +$ ./owo "Hello, world!" hewwo, wowld! ```