Skip to content

Commit aab1d38

Browse files
committed
cmake: hello world example
1 parent 1b53436 commit aab1d38

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

cmake/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Good examples: <https://github.com/ttroy50/cmake-examples>
44

5+
1. [hello](hello/)
56
1. [multi_executable](multi_executable/)
67
1. [multi_file](multi_file/)
78
1. [multi_file_recursive](multi_file_recursive/)

cmake/hello/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
project(ProjectName)
3+
add_executable(main main.c)

cmake/hello/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
4+
int main(void) {
5+
puts(__FILE__);
6+
return EXIT_SUCCESS;
7+
}

cmake/multi_file/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
cmake_minimum_required(VERSION _3.0)
1+
project(ProjectName)
2+
cmake_minimum_required(VERSION 3.0)
23
file(GLOB SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c")
34
add_executable(main ${SOURCES})

0 commit comments

Comments
 (0)