forked from tat/mimetic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
51 lines (45 loc) · 1.69 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
cmake_minimum_required (VERSION 2.8)
project (mimetic)
# extract current version from configure.in
FILE(STRINGS configure.in aminit REGEX "AM_INIT_AUTOMAKE")
STRING(REGEX REPLACE "AM_INIT_AUTOMAKE\\([ ]*mimetic[ ]*,(.*)\\)" "\\1" VERSION "${aminit}")
add_definitions(-DVERSION="${VERSION}")
if(WIN32)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FD /EHsc /W3 /TP /wd4267 /wd4244")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FD /EHsc /W3 /TP /wd4267 /wd4244")
add_definitions(-DWIN32 -D_LIB -D_MBCS)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
set(CMAKE_C_FLAGS "$CMAKE_C_FLAGS -fPIC")
add_definitions(-DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_UNISTD_H -DHAVE_SYS_TYPES_H -DHAVE_SYS_STAT_H)
endif()
if (IOS)
if (NOT CMAKE_GENERATOR STREQUAL "Xcode")
message(FATAL_ERROR "only xcode generator is supported for iOS")
endif ()
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "7.0")
if (IOS STREQUAL "sim")
set(CMAKE_OSX_SYSROOT iphonesimulator)
else ()
set(CMAKE_OSX_SYSROOT iphoneos)
endif ()
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_INCLUDING_64_BIT)")
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
SET(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator" )
add_definitions(-DIOS)
endif (IOS)
add_subdirectory(mimetic)
if(NOT IOS)
add_subdirectory(examples)
endif()