Files
libvec/CMakeLists.txt
T

43 lines
1.2 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/char.c
src/int.c
src/utils.c
src/float.c
src/string.c
# Add your other types here as you implement them:
)
include(FetchContent)
FetchContent_Declare(libstr
GIT_REPOSITORY https://git.moomancer.xyz/DarthMooMancer/libstr.git
GIT_TAG main
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(libstr)
target_link_libraries(libvec PRIVATE libstr)
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
# PUBLIC: Consumers (and test_runner) are granted access ONLY to include/
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
# ${CMAKE_CURRENT_SOURCE_DIR}/src/lib # Turn back to private when ready
)
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)