-
Notifications
You must be signed in to change notification settings - Fork 52
/
CMakeLists.txt
63 lines (48 loc) · 2.31 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
cmake_minimum_required(VERSION 3.7)
project(mCtrl C)
set(MCTRL_MAJOR_VERSION 0)
set(MCTRL_MINOR_VERSION 11)
set(MCTRL_PATCH_VERSION 5)
set(MCTRL_VERSION ${MCTRL_MAJOR_VERSION}.${MCTRL_MINOR_VERSION}.${MCTRL_PATCH_VERSION})
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo MinSizeRel)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
endif()
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# set up include-directories
include_directories("${PROJECT_SOURCE_DIR}/include")
include_directories("${PROJECT_SOURCE_DIR}/lib")
include_directories("${PROJECT_SOURCE_DIR}/lib/acutest/include")
include_directories("${PROJECT_SOURCE_DIR}/lib/hsluv-c/src")
include_directories("${PROJECT_SOURCE_DIR}/lib/c-win32/include")
include_directories("${PROJECT_SOURCE_DIR}/lib/md4c-utf16")
set(HSLUV_C_TESTS OFF CACHE BOOL "Disable building hsluv-c tests.")
set(MCTRL_BUILD_COMPLETETREE ON CACHE BOOL "Tell examples/CMakeListst.txt it is built as part of complete mCtrl build.")
OPTION(MCTRL_BUILD_EXAMPLES "Enable/disable building of mCtrl examples" ON)
OPTION(MCTRL_BUILD_TESTS "Enable/disable building of mCtrl tests" ON)
# Note this an experimental feature.
# See discussion in https://github.com/mity/mctrl/issues/75
OPTION(MCTRL_BUILD_STATIC "Enable/disable build of mCtrl as a static lib" OFF)
if(MSVC)
# Enforce multi-threading runtime lib.
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELWITHDEBINFO "{$CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /MT")
endif()
# Add sub-directories
add_subdirectory(lib/hsluv-c)
add_subdirectory(lib/md4c-utf16)
add_subdirectory(src)
if(MCTRL_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(MCTRL_BUILD_TESTS)
add_subdirectory(tests)
endif()