aboutsummaryrefslogtreecommitdiff
path: root/ports/gperf/CMakeLists.txt
blob: d9cad0d8955a1ca2e18114f7ac63fd285a0a5f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cmake_minimum_required(VERSION 3.0)
project(gperf LANGUAGES C CXX)

include(CheckCXXSourceCompiles)
include(GNUInstallDirs)

CHECK_CXX_SOURCE_COMPILES("int main(int n) { int dynamic_array[n]; }" HAVE_DYNAMIC_ARRAY)

set(LIBGP_SOURCES
	lib/getline.cc
	lib/getline.h
	lib/getopt.c
	lib/getopt.h
	lib/getopt1.c
	lib/hash.cc
	lib/hash.h)
add_library(gp STATIC ${LIBGP_SOURCES})
target_include_directories(gp PUBLIC "${CMAKE_SOURCE_DIR}/lib")

set(GPERF_SOURCES
	src/bool-array.cc
	src/bool-array.h
	src/bool-array.icc
	src/hash-table.cc
	src/hash-table.h
	src/input.cc
	src/input.h
	src/keyword-list.cc
	src/keyword-list.h
	src/keyword-list.icc
	src/keyword.cc
	src/keyword.h
	src/keyword.icc
	src/main.cc
	src/options.cc
	src/options.h
	src/options.icc
	src/output.cc
	src/output.h
	src/positions.cc
	src/positions.h
	src/positions.icc
	src/search.cc
	src/search.h
	src/version.cc
	src/version.h)
add_executable(gperf ${GPERF_SOURCES})
target_link_libraries(gperf gp)
target_include_directories(gperf PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")

configure_file(config.h.in config.h @ONLY)

install(TARGETS gperf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})