-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
83 lines (74 loc) · 2 KB
/
CMakeLists.txt
File metadata and controls
83 lines (74 loc) · 2 KB
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
80
81
82
83
cmake_minimum_required(VERSION 3.16.3)
project(PCT)
## PCT Version
set(PCT_VERSION_MAJOR "0")
set(PCT_VERSION_MINOR "1")
set(PCT_VERSION_PATCH "0")
set(PCT_VERSION_STRING "${PCT_VERSION_MAJOR}.${PCT_VERSION_MINOR}")
set(PCT_LIBRARIES PCT)
if(NOT ITK_SOURCE_DIR)
find_package(ITK REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
endif()
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
if(GIT_SHA1 MATCHES ".*NOTFOUND")
set(PCT_VERSION_HASH "")
else()
set(PCT_VERSION_HASH ", git hash ${GIT_SHA1}")
endif()
if(NOT ITK_SOURCE_DIR)
include(ITKModuleExternal)
else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if(NOT PCT_INSTALL_RUNTIME_DIR)
set(PCT_INSTALL_RUNTIME_DIR bin)
endif()
if(NOT PCT_INSTALL_LIB_DIR)
set(PCT_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT PCT_INSTALL_ARCHIVE_DIR)
set(PCT_INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
# --------------------------------------------------------
# Build applications
option(
PCT_BUILD_APPLICATIONS
"Build PCT applications"
${RTK_BUILD_APPLICATIONS}
)
if(PCT_BUILD_APPLICATIONS)
add_subdirectory(applications)
endif()
#=========================================================
# Build doc
option(PCT_BUILD_SPHINX "Build Sphinx Documentation" OFF)
if(PCT_BUILD_SPHINX)
add_subdirectory(documentation/docs)
endif()
#---------------------------------------------------------
# Git hooks
if(
EXISTS
"${PCT_SOURCE_DIR}/.git/config"
AND
NOT
EXISTS
"${PCT_SOURCE_DIR}/.git/hooks/pre-commit"
)
# Silently ignore the error if the hooks directory is read-only.
execute_process(
COMMAND
${CMAKE_COMMAND} -E copy ${PCT_SOURCE_DIR}/cmake/Hooks/pre-commit
${PCT_SOURCE_DIR}/.git/hooks/pre-commit
OUTPUT_VARIABLE _output
ERROR_VARIABLE _output
RESULT_VARIABLE _result
)
if(_result AND NOT "${_output}" MATCHES "Error copying file")
message("${_output}")
endif()
endif()