Apply fixes to let 1.0.1 build

This commit is contained in:
Nicholas Chambers 2018-05-19 12:29:47 -05:00
parent 166c487a62
commit 309c33f496
5 changed files with 28 additions and 1 deletions

12
CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
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.c)
target_include_directories(hashmap PRIVATE include)
# target_include_directories(hashmap PRIVATE src)
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)

12
hashmap.pc.in Normal file
View File

@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Requires:
Libs: -L${libdir} -lhashmap
Cflags: -I${includedir}

View File

@ -9,7 +9,7 @@ struct ll {
struct node *tail;
};
struct new_ll();
struct ll new_ll();
void insert_ll(struct ll *list, const char *key, const char *value);
void remove_ll(struct ll *list, struct node *link);

View File

@ -1,4 +1,6 @@
#include <hashmap.h>
#include <stdio.h>
#include <string.h>
struct hashmap new_map() {
struct hashmap new;

View File

@ -1,4 +1,5 @@
#include <linkedlist.h>
#include <stdlib.h>
struct ll new_ll() {
struct ll new;