UNIXworkcode

1 set(sources 2 utils.c 3 allocator.c 4 string.c 5 list.c 6 array_list.c 7 linked_list.c 8 buffer.c 9 map.c 10 hash_key.c 11 hash_map.c 12 basic_mempool.c 13 printf.c 14 compare.c 15 ) 16 set(headers 17 cx/common.h 18 cx/utils.h 19 cx/string.h 20 cx/allocator.h 21 cx/iterator.h 22 cx/collection.h 23 cx/list.h 24 cx/array_list.h 25 cx/linked_list.h 26 cx/buffer.h 27 cx/map.h 28 cx/hash_key.h 29 cx/hash_map.h 30 cx/mempool.h 31 cx/basic_mempool.h 32 cx/printf.h 33 cx/compare.h 34 ) 35 36 add_library(ucx SHARED ${sources}) 37 add_library(ucx_static STATIC ${sources}) 38 39 target_include_directories(ucx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 40 target_include_directories(ucx_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 41 42 set_target_properties(ucx PROPERTIES SOVERSION 4 VERSION 4.0.0) 43 set_target_properties(ucx_static PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) 44 45 # it is sufficient to specify the headers for one of the targets 46 set_target_properties(ucx PROPERTIES PUBLIC_HEADER "${headers}") 47 48 include(GNUInstallDirs) 49 install(TARGETS ucx ucx_static 50 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 51 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 52 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cx)