Skip to content

Commit

Permalink
Add simple example for chapter2
Browse files Browse the repository at this point in the history
  • Loading branch information
bernedom committed Jun 23, 2024
1 parent e97ad91 commit 79457b8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chapter02/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()


add_subdirectory(simple_example)
add_subdirectory(component_interface)
add_subdirectory(component1)
add_subdirectory(component2)
Expand Down
19 changes: 19 additions & 0 deletions chapter02/simple_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# CMakeLists file for the Chapter 2 example illustrating how to create a simple executable
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.23)

# Define a CMake project
project(
ch2_simple_example
VERSION 1.0
DESCRIPTION "A simple C++ project to demonstrate basic CMake usage"
LANGUAGES CXX)

# Add an executable target named `chapter2_simple_example`
add_executable(chapter2_simple_example)
# Add sources to the target `chapter2_simple_example`
target_sources(chapter2_simple_example PRIVATE src/main.cpp)

6 changes: 6 additions & 0 deletions chapter02/simple_example/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>

int main(int, char **) {
std::cout << "Welcome to CMake Best Practices\n";
return 0;
}

0 comments on commit 79457b8

Please sign in to comment.