Skip to content

Commit

Permalink
Adding library
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislawfortonski committed Sep 28, 2021
1 parent f804cb3 commit a9be5d2
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions course/3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.12)

project(HelloWorldProject VERSION 1.0.0)

add_library(
HelloLibrary
hello-library.hpp
hello-library.cpp
)

add_executable(HelloApp main.cpp)

target_link_libraries(HelloApp PRIVATE HelloLibrary)
2 changes: 2 additions & 0 deletions course/3/build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
7 changes: 7 additions & 0 deletions course/3/hello-library.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "hello-library.hpp"
#include <iostream>

void HelloLibrary::showHello()
{
std::cout<<"Hello world"<<std::endl;
}
9 changes: 9 additions & 0 deletions course/3/hello-library.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef HELLO_LIBRARY_HPP
#define HELLO_LIBRARY_HPP 1

namespace HelloLibrary
{
void showHello();
}

#endif
8 changes: 8 additions & 0 deletions course/3/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include "hello-library.hpp"

int main()
{
HelloLibrary::showHello();
return 0;
}

0 comments on commit a9be5d2

Please sign in to comment.