cmake_minimum_required(VERSION 3.9.1) project(hashmap VERSION 1.0.1 DESCRIPTION "A small hashmap written in C to use with some other projects") add_library(hashmap SHARED src src/hashmap.c src/linkedlist.c src/node.c) set_target_properties(hashmap PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(hashmap PROPERTIES SOVERSION 1) set_target_properties(hashmap PROPERTIES PUBLIC_HEADER "include/hashmap.h;include/linkedlist.h;include/node.h") target_include_directories(hashmap PRIVATE include) include(GNUInstallDirs) configure_file(hashmap.pc.in hashmap.pc @ONLY) install(TARGETS hashmap LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${CMAKE_BINARY_DIR}/hashmap.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)