-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
cmake_minimum_required(VERSION 3.16..3.24) | ||
project(our_project VERSION 0.0.1 | ||
DESCRIPTION "Our first project" | ||
LANGUAGES CXX) | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE) | ||
endif() | ||
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") | ||
|
||
add_library(cxx_setup INTERFACE) | ||
target_compile_options(cxx_setup INTERFACE -Wall -Wpedantic -Wextra) | ||
target_compile_features(cxx_setup INTERFACE cxx_std_17) | ||
target_include_directories(cxx_setup INTERFACE ${PROJECT_SOURCE_DIR}) | ||
|
||
add_library(foo foo.cpp) | ||
target_link_libraries(foo PUBLIC cxx_setup) | ||
add_executable(main main.cpp) | ||
target_link_libraries(main PRIVATE foo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "foo.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef LECTURES_CODE_STATIC_IN_CLASSES_FOO_HPP | ||
#define LECTURES_CODE_STATIC_IN_CLASSES_FOO_HPP | ||
|
||
struct Foo { | ||
const static int number = 42; | ||
}; | ||
|
||
#endif /* LECTURES_CODE_STATIC_IN_CLASSES_FOO_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <iostream> | ||
|
||
#include "foo.hpp" | ||
|
||
int main() { std::cout << "number: " << Foo::number << std::endl; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters