Working
This commit is contained in:
parent
0c66ff89b3
commit
9b8308eb4a
11 changed files with 121 additions and 0 deletions
13
libs/lib3/CMakeLists.txt
Normal file
13
libs/lib3/CMakeLists.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Defines an INTERFACE library target named 'lib3'.
|
||||
# - INTERFACE: This type of library does not compile any source files itself.
|
||||
# It is used purely to propagate usage requirements (like include directories)
|
||||
# to targets that link to it.
|
||||
add_library(lib3 INTERFACE)
|
||||
|
||||
# Specifies include directories that are part of lib3's interface.
|
||||
# - INTERFACE: Means that targets linking to lib3 (like cmake_tutorialApp or lib1) will
|
||||
# inherit this include path. This allows them to find lib3.h.
|
||||
target_include_directories(lib3 INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/inc
|
||||
)
|
||||
|
11
libs/lib3/inc/lib3.h
Normal file
11
libs/lib3/inc/lib3.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include <stdio.h> // Standard I/O header is needed here because printf is used within this header-only function.
|
||||
|
||||
// Declared as static to prevent multiple definition errors.
|
||||
// Since this is a header-only function, it will be included and compiled
|
||||
// into every translation unit that includes lib3.h. 'static' limits its
|
||||
// linkage to the current translation unit, preventing linker conflicts.
|
||||
static void lib3_function()
|
||||
{
|
||||
printf("This is a function from Header-Only Library 3.\n");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue