Skip to content

Commit b2e4ed0

Browse files
committed
Build a shared lib by default
1 parent a893dcb commit b2e4ed0

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
*.o
22
*.a
3+
*.so
4+
*.dylib
35
*.plist
46

57
tests

CMakeLists.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ project (Intern)
55
set (PAGE_SIZE 4096 CACHE STRING "Page size for allocations")
66
option (MMAP_PAGES "Allocate pages with mmap(2)" OFF)
77
option (INLINE_UNSIGNED "Inline unsigned integers into the ID" OFF)
8+
option (BUILD_STATIC "Build a static library" OFF)
89

910
configure_file (config.h.in config.h)
1011

11-
add_library (intern strings.c block.c optimize.c)
12+
if (BUILD_STATIC)
13+
set (INTERN_LIB_TYPE STATIC)
14+
else (BUILD_STATIC)
15+
set (INTERN_LIB_TYPE SHARED)
16+
endif (BUILD_STATIC)
17+
18+
add_library (intern ${INTERN_LIB_TYPE} strings.c block.c optimize.c)
1219

1320
install (TARGETS intern DESTINATION lib)
1421
install (FILES strings.h block.h optimize.h DESTINATION include/intern)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Fast, immutable string interning for C.
1717
## Installation
1818

1919
```sh
20-
$ cmake [-DPAGE_SIZE=4096] [-DINLINE_UNSIGNED=1] [-DMMAP_PAGES=1] .
20+
$ cmake -Wno-dev [-DBUILD_STATIC=1] [-DPAGE_SIZE=4096] [-DINLINE_UNSIGNED=1] [-DMMAP_PAGES=1] .
2121
$ make install
2222
```
2323

0 commit comments

Comments
 (0)