REFACTOR: Translated to internal file for setup towards singular Vec
This commit is contained in:
+24
-6
@@ -3,12 +3,30 @@ project(libvec LANGUAGES C)
|
||||
set(CMAKE_C_STANDARD 23)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
include_directories(include)
|
||||
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
src/char.c
|
||||
src/utils.c
|
||||
add_library(libvec STATIC
|
||||
src/libvec.c
|
||||
src/lib/char/char.c
|
||||
src/lib/utils/utils.c
|
||||
# Add your other types here as you implement them:
|
||||
# src/lib/float/float.c
|
||||
# src/lib/int/int.c
|
||||
# src/lib/string/string.c
|
||||
)
|
||||
|
||||
add_executable(libvec ${SOURCES})
|
||||
target_include_directories(libvec
|
||||
# PRIVATE: Internal headers under src/lib are only visible
|
||||
# to files being compiled into libvec (char.c, utils.c, libvec.c).
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib
|
||||
|
||||
# PUBLIC: Consumers (and test_runner) are granted access ONLY to include/
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
add_executable(test_runner src/main.c)
|
||||
|
||||
# Linking libvec privately gives test_runner access to include/libvec.h,
|
||||
# but strictly hides src/lib/char/char.h and src/lib/utils/utils.h.
|
||||
target_link_libraries(test_runner PRIVATE libvec)
|
||||
|
||||
Reference in New Issue
Block a user