-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
46 lines (35 loc) · 1.08 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
cmake_minimum_required(VERSION 2.8)
# Generate config.h
include(CheckCSourceCompiles)
check_c_source_compiles("
#include <pwd.h>
int main() { return 0; }
" HAVE_PWD_H)
check_c_source_compiles("
#include <sys/time.h>
int main() { return 0; }
" HAVE_SYS_TIME_H)
check_c_source_compiles("
#include <unistd.h>
int main() { return 0; }
" HAVE_UNISTD_H)
configure_file(${CMAKE_CURRENT_LIST_DIR}/config.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DHAVE_CONFIG_H)
# Special flags depending on the compiler
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(--std=c++11)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
add_definitions(-DHAVE_TIME_H)
endif()
file(GLOB sundown_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
sundown/*.c)
file(GLOB bake_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.cpp)
add_library(sundown OBJECT ${sundown_sources})
add_executable(bake $<TARGET_OBJECTS:sundown> ${bake_sources})