forked from jeaye/color_coded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (53 loc) · 1.52 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
71
72
cmake_minimum_required(VERSION 2.9)
project(color_coded)
# Shut up the warning about CMake policy CMP0042.
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(64_BIT_PLATFORM 1)
else()
set(64_BIT_PLATFORM 0)
endif()
# C++14
include(cmake/cxx14.cmake)
# Lua
include(cmake/lua.cmake)
# Boost
include(cmake/boost.cmake)
# Curses
find_package(Curses REQUIRED)
# ZLib
find_package(ZLIB REQUIRED)
# Clang
include(cmake/clang/download.cmake)
include_directories(
include
${LLVM_ROOT_PATH}/include
${CURSES_INCLUDE_PATH}
${ZLIB_INCLUDE_PATH}
)
include(cmake/generate_sources.cmake)
add_library(color_coded SHARED src/main.cpp)
# Force the same naming across platforms
set_property(TARGET color_coded PROPERTY PREFIX "")
set_property(TARGET color_coded PROPERTY OUTPUT_NAME "color_coded.so")
set_property(TARGET color_coded PROPERTY SUFFIX "")
# Fix compilation problem: relocation R_X86_64_32 against `a local symbol' can not be
# used when making a shared object; recompile with -fPIC.
# See http://www.cmake.org/pipermail/cmake/2007-May/014350.html
if(64_BIT_PLATFORM)
set_property(TARGET color_coded_boost PROPERTY COMPILE_FLAGS "-fPIC")
set_property(TARGET color_coded PROPERTY COMPILE_FLAGS "-fPIC")
endif()
# Clang
include(cmake/clang/link.cmake)
target_link_libraries(color_coded
color_coded_boost
${LUA_LIBRARIES}
${CURSES_LIBRARY}
${ZLIB_LIBRARIES}
)
# Install locally
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR})
install(TARGETS color_coded DESTINATION bin)