OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 The RE2 Authors. All Rights Reserved. |
| 2 # Use of this source code is governed by a BSD-style |
| 3 # license that can be found in the LICENSE file. |
| 4 |
| 5 # Old enough to support Ubuntu Precise. |
| 6 cmake_minimum_required(VERSION 2.8.7) |
| 7 |
| 8 project(RE2 CXX) |
| 9 option(BUILD_SHARED_LIBS "build shared libraries" OFF) |
| 10 option(USEPCRE "use PCRE in tests and benchmarks" OFF) |
| 11 |
| 12 set(EXTRA_TARGET_LINK_LIBRARIES) |
| 13 |
| 14 if(WIN32) |
| 15 add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX) |
| 16 set(THREADING threadwin) |
| 17 else() |
| 18 set(THREADING thread) |
| 19 list(APPEND EXTRA_TARGET_LINK_LIBRARIES -pthread) |
| 20 endif() |
| 21 |
| 22 if(USEPCRE) |
| 23 add_definitions(-DUSEPCRE) |
| 24 list(APPEND EXTRA_TARGET_LINK_LIBRARIES pcre) |
| 25 endif() |
| 26 |
| 27 include_directories(${CMAKE_SOURCE_DIR}) |
| 28 |
| 29 set(RE2_LIBRARY_SOURCES |
| 30 re2/bitstate.cc |
| 31 re2/compile.cc |
| 32 re2/dfa.cc |
| 33 re2/filtered_re2.cc |
| 34 re2/mimics_pcre.cc |
| 35 re2/nfa.cc |
| 36 re2/onepass.cc |
| 37 re2/parse.cc |
| 38 re2/perl_groups.cc |
| 39 re2/prefilter.cc |
| 40 re2/prefilter_tree.cc |
| 41 re2/prog.cc |
| 42 re2/re2.cc |
| 43 re2/regexp.cc |
| 44 re2/set.cc |
| 45 re2/simplify.cc |
| 46 re2/stringpiece.cc |
| 47 re2/tostring.cc |
| 48 re2/unicode_casefold.cc |
| 49 re2/unicode_groups.cc |
| 50 util/hash.cc |
| 51 util/logging.cc |
| 52 util/rune.cc |
| 53 util/stringprintf.cc |
| 54 util/strutil.cc |
| 55 util/valgrind.cc |
| 56 ) |
| 57 |
| 58 add_library(re2 ${RE2_LIBRARY_SOURCES}) |
| 59 |
| 60 set(TEST_LIBRARY_SOURCES |
| 61 re2/testing/backtrack.cc |
| 62 re2/testing/dump.cc |
| 63 re2/testing/exhaustive_tester.cc |
| 64 re2/testing/null_walker.cc |
| 65 re2/testing/regexp_generator.cc |
| 66 re2/testing/string_generator.cc |
| 67 re2/testing/tester.cc |
| 68 util/pcre.cc |
| 69 util/random.cc |
| 70 util/${THREADING}.cc |
| 71 ) |
| 72 |
| 73 add_library(test STATIC ${TEST_LIBRARY_SOURCES} util/test.cc) |
| 74 add_library(benchmark STATIC ${TEST_LIBRARY_SOURCES} util/benchmark.cc) |
| 75 |
| 76 set(TEST_TARGETS |
| 77 charclass_test |
| 78 compile_test |
| 79 filtered_re2_test |
| 80 mimics_pcre_test |
| 81 parse_test |
| 82 possible_match_test |
| 83 re2_test |
| 84 re2_arg_test |
| 85 regexp_test |
| 86 required_prefix_test |
| 87 search_test |
| 88 set_test |
| 89 simplify_test |
| 90 string_generator_test |
| 91 |
| 92 dfa_test |
| 93 exhaustive1_test |
| 94 exhaustive2_test |
| 95 exhaustive3_test |
| 96 exhaustive_test |
| 97 random_test |
| 98 ) |
| 99 |
| 100 set(BENCHMARK_TARGETS |
| 101 regexp_benchmark |
| 102 ) |
| 103 |
| 104 foreach(target ${TEST_TARGETS}) |
| 105 add_executable(${target} re2/testing/${target}.cc) |
| 106 target_link_libraries(${target} test re2 ${EXTRA_TARGET_LINK_LIBRARIES}) |
| 107 endforeach(target) |
| 108 |
| 109 foreach(target ${BENCHMARK_TARGETS}) |
| 110 add_executable(${target} re2/testing/${target}.cc) |
| 111 target_link_libraries(${target} benchmark re2 ${EXTRA_TARGET_LINK_LIBRARIES}) |
| 112 endforeach(target) |
OLD | NEW |