34 lines
1.0 KiB
CMake
34 lines
1.0 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(libvec LANGUAGES C)
|
|
set(CMAKE_C_STANDARD 23)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
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
|
|
)
|
|
|
|
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(libvec_bin src/main.c)
|
|
set_target_properties(libvec_bin PROPERTIES OUTPUT_NAME "libvec")
|
|
|
|
# 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(libvec_bin PRIVATE libvec)
|