-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
70 lines (59 loc) · 2.41 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
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.5)
project(tilp_and_gfm C)
###############################################
# Experimental CMake support for tilp and gfm #
###############################################
#
# This aims to provide a much simpler way to build and install tilp and gfm
# on computers that have decent and recent OS and toolchains.
# As a bonus, it provides better support for CMake-oriented IDE (e.g. CLion).
#
# Features:
# - builds and installs both executables
# - creates and installs i18n .mo files (when libs/tools are present)
#
# Caveats:
# - you'll need to generate the pot files first (intltool-update --pot)
# - not all the autotools/configure options are available
# - probably doesn't work very well with ancient toolchains or on uncommon OSes
#
# In the future...:
# - TODO: look at CPack features for bundling/packaging
# - WISH: do not hardcode the (auto-generated...) potfiles_* target names
# - WISH: add support for Windows (that will probably be annoying)
#
message(STATUS "Detected system: ${CMAKE_SYSTEM_NAME} - host processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
include(GNUInstallDirs)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -Wextra -Wno-unused-parameter -Werror=shadow -Werror=write-strings -Wredundant-decls -Werror=format -Werror=format-nonliteral -Werror=format-security -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=date-time -Werror=missing-prototypes -Werror=return-type -Werror=pointer-arith ")
if(APPLE)
add_definitions(-D__MACOSX__)
elseif(UNIX)
add_definitions(-D__LINUX__)
elseif(MINGW)
add_definitions(-D__MINGW32__)
elseif(WIN32)
add_definitions(-D__WIN32__)
endif()
# i18n support checking
include(FindGettext)
include(FindIntl)
if(Intl_FOUND AND GETTEXT_FOUND)
set(ENABLE_NLS 1)
add_definitions(-DENABLE_NLS=1)
else()
message(WARNING "The Intl and GetText libs are needed for translations - English only will be available")
endif()
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}")
# Global defines
add_definitions(-DENABLE_LOGGING=1 -DHAVE_FVISIBILITY=1 -DLOCALEDIR="${LOCALEDIR}")
# For libs finding
find_package(PkgConfig)
# Our modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake)
file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/*.cmake")
foreach(file ${files})
include(${file})
endforeach()
add_subdirectory(gfm/trunk)
add_subdirectory(tilp/trunk)