Update CMake to expose lib as PUBLIC/PRIVATE and not INTERFACE

This commit is contained in:
Tilen M 2024-09-03 21:42:01 +02:00
parent 3e2cb7d08b
commit 756a7bce1d
2 changed files with 8 additions and 6 deletions

View File

@ -2,6 +2,8 @@
## Develop
- Rework library CMake with removed INTERFACE type
## v2.1.0
- Split CMakeLists.txt files between library and executable

View File

@ -39,16 +39,16 @@ set(lwmem_core_SRCS ${lwmem_core_SRCS}
endif()
# Register core library
add_library(lwmem INTERFACE)
target_sources(lwmem PUBLIC ${lwmem_core_SRCS})
target_include_directories(lwmem INTERFACE ${lwmem_include_DIRS})
add_library(lwmem)
target_sources(lwmem PRIVATE ${lwmem_core_SRCS})
target_include_directories(lwmem PUBLIC ${lwmem_include_DIRS})
target_compile_options(lwmem PRIVATE ${LWMEM_COMPILE_OPTIONS})
target_compile_definitions(lwmem PRIVATE ${LWMEM_COMPILE_DEFINITIONS})
# Register core library with C++ extensions
add_library(lwmem_cpp INTERFACE)
target_sources(lwmem_cpp PUBLIC ${lwmem_core_SRCS})
target_include_directories(lwmem_cpp INTERFACE ${lwmem_include_DIRS})
add_library(lwmem_cpp)
target_sources(lwmem_cpp PRIVATE ${lwmem_core_SRCS})
target_include_directories(lwmem_cpp PUBLIC ${lwmem_include_DIRS})
target_compile_options(lwmem_cpp PRIVATE ${LWMEM_COMPILE_OPTIONS})
target_compile_definitions(lwmem_cpp PRIVATE ${LWMEM_COMPILE_DEFINITIONS})