Skip to content

Commit

Permalink
build: minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dleeds-cpi committed Jan 13, 2020
1 parent 671e5cb commit 7b4adc2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
cmake_minimum_required(VERSION 3.5)
project(hashmap VERSION 1.0.0 LANGUAGES C)

set(CMAKE_C_STANDARD 99)

##############################################
# Create target and set properties

add_library(hashmap
src/hashmap.c
)

#Add an alias so that library can be used inside the build tree, e.g. when testing
# Add an alias so that library can be used inside the build tree, e.g. when testing
add_library(HashMap::HashMap ALIAS hashmap)

#Set target properties
# Set target properties
target_include_directories(hashmap
PUBLIC
$<INSTALL_INTERFACE:include>
Expand All @@ -34,12 +36,12 @@ install(TARGETS hashmap
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

#This is required so that the exported target has the name HashMap and not hashmap
# This is required so that the exported target has the name HashMap and not hashmap
set_target_properties(hashmap PROPERTIES EXPORT_NAME HashMap)

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

#Export the targets to a script
# Export the targets to a script
install(EXPORT hashmap-targets
FILE
HashMapTargets.cmake
Expand All @@ -49,7 +51,7 @@ install(EXPORT hashmap-targets
${INSTALL_CONFIGDIR}
)

#Create a ConfigVersion.cmake file
# Create a ConfigVersion.cmake file
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/HashMapConfigVersion.cmake
Expand All @@ -62,7 +64,7 @@ configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/HashMapConfig.cmak
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
)

#Install the config, configversion and custom find modules
# Install the config, configversion and custom find modules
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/HashMapConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/HashMapConfigVersion.cmake
Expand Down
6 changes: 1 addition & 5 deletions include/hashmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* it under the terms of the MIT license. See LICENSE for details.
*/

#ifndef __HASHMAP_H__
#define __HASHMAP_H__
#pragma once

#include <stddef.h>

Expand Down Expand Up @@ -276,6 +275,3 @@ double hashmap_collisions_mean(const struct hashmap *map);
double hashmap_collisions_variance(const struct hashmap *map);
#endif


#endif /* __HASHMAP_H__ */

2 changes: 1 addition & 1 deletion src/hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <ctype.h>
#include <errno.h>

#include "hashmap.h"
#include <hashmap.h>

#ifndef HASHMAP_NOASSERT
#include <assert.h>
Expand Down

0 comments on commit 7b4adc2

Please sign in to comment.