2 cmake_minimum_required(VERSION 2.8)
3 # required for exports? cmake_minimum_required (VERSION 2.8.6)
7 set(PACKAGE_VERSION "6.7.1")
9 set(USE_COMBINATION_EXPLOSION_CHECK 0)
10 set(USE_CRNL_AS_LINE_TERMINATOR 0)
11 set(VERSION ${PACKAGE_VERSION})
14 # Force to always compile with W4
15 if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
16 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
18 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
20 elseif(CMAKE_COMPILER_IS_GNUCXX)
21 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
22 elseif(CMAKE_COMPILER_IS_GNUCC)
23 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
27 include(cmake/dist.cmake)
28 include(CheckCSourceCompiles)
29 include(CheckIncludeFiles)
30 include(CheckFunctionExists)
31 include(CheckSymbolExists)
32 include(CheckTypeSize)
33 include(TestBigEndian)
35 check_function_exists(alloca HAVE_ALLOCA)
36 check_include_files(alloca.h HAVE_ALLOCA_H)
37 set(HAVE_PROTOTYPES 1)
38 check_include_files(stdarg.h HAVE_STDARG_PROTOTYPES)
39 check_include_files(stdint.h HAVE_STDINT_H)
40 check_include_files(stdlib.h HAVE_STDLIB_H)
41 check_include_files(strings.h HAVE_STRINGS_H)
42 check_include_files(string.h HAVE_STRING_H)
43 check_include_files(limits.h HAVE_LIMITS_H)
44 check_include_files(sys/times.h HAVE_SYS_TIMES_H)
45 check_include_files(sys/time.h HAVE_SYS_TIME_H)
46 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
47 check_include_files(unistd.h HAVE_UNISTD_H)
48 check_include_files(inttypes.h HAVE_INTTYPES_H)
49 check_type_size(int SIZEOF_INT)
50 check_type_size(long SIZEOF_LONG)
51 check_type_size(short SIZEOF_SHORT)
52 check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
54 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
56 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/oniguruma.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc @ONLY)
59 include_directories(${CMAKE_CURRENT_BINARY_DIR})
60 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
62 set(_SRCS src/regint.h src/regparse.h src/regenc.h src/st.h
63 src/regerror.c src/regparse.c src/regext.c src/regcomp.c src/regexec.c
64 src/reggnu.c src/regenc.c src/regsyntax.c src/regtrav.c src/regversion.c
65 src/st.c src/regposix.c src/regposerr.c src/onig_init.c
66 src/unicode.c src/ascii.c src/utf8.c src/utf16_be.c src/utf16_le.c
67 src/utf32_be.c src/utf32_le.c src/euc_jp.c src/sjis.c src/iso8859_1.c
68 src/iso8859_2.c src/iso8859_3.c src/iso8859_4.c src/iso8859_5.c
69 src/iso8859_6.c src/iso8859_7.c src/iso8859_8.c src/iso8859_9.c
70 src/iso8859_10.c src/iso8859_11.c src/iso8859_13.c src/iso8859_14.c
71 src/iso8859_15.c src/iso8859_16.c src/euc_tw.c src/euc_kr.c src/big5.c
72 src/gb18030.c src/koi8_r.c src/cp1251.c
73 src/euc_jp_prop.c src/sjis_prop.c
74 src/unicode_unfold_key.c
75 src/unicode_fold1_key.c src/unicode_fold2_key.c src/unicode_fold3_key.c)
78 add_library(onig ${_SRCS})
82 install_header(src/oniguruma.h src/onigposix.h src/oniggnu.h)
84 install_doc(doc/API doc/API.ja doc/RE doc/RE.ja doc/UNICODE_PROPERTIES)
85 install_data(AUTHORS COPYING HISTORY README.md)
87 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc
88 DESTINATION lib/pkgconfig)