This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
forked from rrthomas/lrexlib
/
CMakeLists.txt
57 lines (48 loc) · 1.64 KB
/
CMakeLists.txt
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
54
55
56
57
# Copyright (C) 2007-2012 LuaDist.
# Created by Peter Kapec, Peter Drahos
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.
project ( lrexlib C )
cmake_minimum_required ( VERSION 2.8 )
include ( cmake/dist.cmake )
include ( lua )
# Find PCRE
find_package ( PCRE )
if ( PCRE_FOUND )
include_directories ( ${PCRE_INCLUDE_DIRS} )
endif ( )
# Find posix (RXSpencer on Windows)
if ( WIN32 AND NOT CYGWIN )
add_definitions ( -Doff_t=_off_t )
find_package ( RXSpencer REQUIRED )
include_directories ( ${RXSPENCER_INCLUDE_DIRS} )
if ( MSVC )
add_definitions ( "-DREX_API=__declspec(dllexport)" )
endif ( )
endif ( )
# Find Oniguruma
find_package ( Oniguruma )
if ( Oniguruma_FOUND )
include_directories ( ${ONIGURUMA_INCLUDE_DIRS} )
endif ( )
# common lrexlib modules
set ( COMMON_SRC src/common.c )
# pcre module
if ( PCRE_FOUND )
set ( PCRE_SRCS src/pcre/lpcre.c src/pcre/lpcre_f.c ${COMMON_SRC} )
install_lua_module ( rex_pcre ${PCRE_SRCS} LINK ${PCRE_LIBRARIES} )
endif ( )
# posix module
set ( POSIX_SRCS src/posix/lposix.c ${COMMON_SRC} )
install_lua_module ( rex_posix ${POSIX_SRCS} LINK ${RXSPENCER_LIBRARIES} )
# oniguruma module
find_package ( Oniguruma )
if ( Oniguruma_FOUND )
set ( ONIGURUMA_SRCS src/oniguruma/lonig.c src/oniguruma/lonig_f.c ${COMMON_SRC} )
install_lua_module ( rex_onig ${ONIGURUMA_SRCS} LINK ${ONIGURUMA_LIBRARIES} )
endif ( )
# Install lrexlib modules
install_data ( LICENSE NEWS README.rst )
install_test ( test/ )
install_doc ( doc/ )