forked from google/compact_enc_det
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
64 lines (50 loc) · 2.14 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
58
59
60
61
62
63
64
# Copyright 2016 Google Inc. All Rights Reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Old enough to support Ubuntu Precise.
cmake_minimum_required(VERSION 2.8.7)
set(PROJECT_VERSION 1.0)
if (WIN32)
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/compact_enc_det/compact_enc_det.h")
message(FATAL_ERROR "\nCould not find source code. Make sure you are running this script from the root of the distribution tree.")
endif()
endif()
project(CED CXX)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-c++11-narrowing")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if (NOT BUILD_SHARED_LIBS)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
endif()
endif()
set(EXTRA_TARGET_LINK_LIBRARIES)
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX)
endif()
set(THREADING thread)
list(APPEND EXTRA_TARGET_LINK_LIBRARIES -pthread)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(${CMAKE_SOURCE_DIR})
set(CED_LIBRARY_SOURCES
compact_enc_det/compact_enc_det.cc
compact_enc_det/compact_enc_det_hint_code.cc
util/encodings/encodings.cc
util/languages/languages.cc
)
add_library(ced STATIC ${CED_LIBRARY_SOURCES})
target_include_directories(ced PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ced PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# Uncomment to put CED into WHATWG-compliant mode.
#add_definitions(-DHTML5_MODE)