refactor CMake configuration: update library installation paths and exclude Unity from default build
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
# Library Configuration
|
||||
add_library(dynamic_array
|
||||
dynamic_array.c
|
||||
dynamic_array.h)
|
||||
target_include_directories(dynamic_array INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set_target_properties(dynamic_array PROPERTIES PUBLIC_HEADER dynamic_array.h)
|
||||
|
||||
|
||||
# Install the library to a specific directory (e.g., 'lib') relative to the install prefix
|
||||
install(TARGETS dynamic_array
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # Installs shared libs to <prefix>/lib
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # Installs static libs to <prefix>/lib
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # Installs associated executables to <prefix>/bin
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # Installs headers to <prefix>/include
|
||||
)
|
||||
|
||||
|
||||
# Testing
|
||||
|
||||
add_executable(test_dynamic_array test_dynamic_array.c)
|
||||
target_link_libraries(test_dynamic_array PRIVATE dynamic_array unity::framework)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user