Skip to content

Commit

Permalink
Update CMake to expose lib as PUBLIC/PRIVATE and not INTERFACE
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Sep 3, 2024
1 parent 1f95386 commit b786494
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Develop

- Rework library CMake with removed INTERFACE type

## v1.0.6

- Add `lwprintf_debug` and `lwprintf_debug_cond` functions
Expand Down
11 changes: 6 additions & 5 deletions lwprintf/library.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# LIB_PREFIX: LWPRINTF
#
# This file provides set of variables for end user
Expand All @@ -16,7 +16,7 @@
set(LWPRINTF_CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib_inc)

# Library core sources
set(lwprintf_core_SRCS
set(lwprintf_core_SRCS
${CMAKE_CURRENT_LIST_DIR}/src/lwprintf/lwprintf.c
)

Expand All @@ -35,9 +35,9 @@ set(lwprintf_include_DIRS
)

# Register library to the system
add_library(lwprintf INTERFACE)
target_sources(lwprintf INTERFACE ${lwprintf_core_SRCS})
target_include_directories(lwprintf INTERFACE ${lwprintf_include_DIRS})
add_library(lwprintf)
target_sources(lwprintf PRIVATE ${lwprintf_core_SRCS})
target_include_directories(lwprintf PUBLIC ${lwprintf_include_DIRS})
target_compile_options(lwprintf PRIVATE ${LWPRINTF_COMPILE_OPTIONS})
target_compile_definitions(lwprintf PRIVATE ${LWPRINTF_COMPILE_DEFINITIONS})

Expand All @@ -48,4 +48,5 @@ if(NOT LWPRINTF_OPTS_FILE)
else()
message(STATUS "Using custom lwprintf_opts.h file from ${LWPRINTF_OPTS_FILE}")
endif()

configure_file(${LWPRINTF_OPTS_FILE} ${LWPRINTF_CUSTOM_INC_DIR}/lwprintf_opts.h COPYONLY)

0 comments on commit b786494

Please sign in to comment.