-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
79 lines (65 loc) · 2.32 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
73
74
75
76
77
78
79
# 作者:康林<[email protected]>
cmake_minimum_required(VERSION 2.8)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
project(TransformCoordinate)
# Find Git Version Patch
IF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
if(NOT GIT)
SET(GIT $ENV{GIT})
endif()
if(NOT GIT)
FIND_PROGRAM(GIT NAMES git git.exe git.cmd)
endif()
IF(GIT)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT} describe --tags
OUTPUT_VARIABLE TransformCoordinate_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT} rev-parse --short HEAD
OUTPUT_VARIABLE TransformCoordinate_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT TransformCoordinate_VERSION)
SET(TransformCoordinate_VERSION "v1.1.2")
endif()
ENDIF()
ENDIF()
message("TransformCoordinate_VERSION:${TransformCoordinate_VERSION};TransformCoordinate_REVISION:${TransformCoordinate_REVISION}")
if(NOT TransformCoordinate_VERSION)
SET(TransformCoordinate_VERSION "v1.1.2")
endif()
string(REPLACE "v" "" TransformCoordinate_VERSION ${TransformCoordinate_VERSION})
if(TransformCoordinate_REVISION)
string(REPLACE "v" "" TransformCoordinate_REVISION ${TransformCoordinate_REVISION})
endif()
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(GenerateExportHeader)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckFunctionExists)
CHECK_INCLUDE_FILE_CXX("string" HAVE_STRING_H)
check_include_file("math.h" HAVE_MATH_H)
check_function_exists("fabs" HAVE_FABS)
check_function_exists("sin" HAVE_SIN)
check_function_exists("cos" HAVE_COS)
SET(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libs")
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
add_subdirectory(Src)
# Build options
option(BUILD_APP "Set to ON to build applaction" ON)
if(BUILD_APP)
add_subdirectory(App)
endif(BUILD_APP)
include(Package/CMakeCPack.cmake)
message("Build app:${BUILD_APP}")
message("Build shared library:${BUILD_SHARED_LIBS}")
message("Build GPXMODEL:${WITH_GPXMODEL}")