-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
122 lines (108 loc) · 3.86 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
##############################################################################
#
# Library: IntersonArraySDK
#
# Copyright Kitware Inc. 28 Corporate Drive,
# Clifton Park, NY, 12065, USA.
#
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
cmake_minimum_required( VERSION 3.5 )
project( IntersonArraySDKCxx )
# CMake modules
include( CMakePackageConfigHelpers )
include( CTest )
# Options
option( BUILD_APPLICATIONS "Build applications" OFF )
option( BUILD_SERVERS "Build OpenIGTLink Servers" OFF)
# External dependencies
find_path( IntersonArraySDK_DIR
NAMES Libraries/IntersonArray.dll
PATHS C:/IntersonArraySDK
)
if( NOT IntersonArraySDK_DIR )
message( FATAL_ERROR "Please specify the path to the IntersonArraySDK"
" in IntersonArraySDK_DIR" )
endif()
set( IntersonArraySDK_LIBRARY "${IntersonArraySDK_DIR}/IntersonArray.dll" )
if( NOT EXISTS ${IntersonArraySDK_LIBRARY} )
message( FATAL_ERROR "Interson library is missing [${IntersonArraySDK_LIBRARY}]" )
endif()
# Install relative directories
set( INSTALL_LIB_DIR lib )
set( INSTALL_BIN_DIR bin )
set( INSTALL_INCLUDE_DIR include )
set( INSTALL_CMAKE_DIR cmake )
# Output directories
if( NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${IntersonArraySDKCxx_BINARY_DIR}/${INSTALL_BIN_DIR} )
endif()
if( NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${IntersonArraySDKCxx_BINARY_DIR}/${INSTALL_LIB_DIR} )
endif()
if( NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${IntersonArraySDKCxx_BINARY_DIR}/${INSTALL_LIB_DIR} )
endif()
# Add subdirectories
add_subdirectory( include )
add_subdirectory( src )
if( BUILD_TESTING )
add_subdirectory( test )
endif()
if( BUILD_APPLICATIONS )
add_subdirectory( app )
endif()
if( BUILD_SERVERS )
add_subdirectory( openigtlink )
endif()
# Install Interson libraries
install( FILES ${IntersonArraySDK_LIBRARY}
DESTINATION ${INSTALL_BIN_DIR} COMPONENT Runtime
)
# Configure 'IntersonArraySDKCxxConfig.cmake' for a build tree
set(CONFIG_DIR_CONFIG ${PROJECT_BINARY_DIR})
set(intersonArraySDKCxx_config ${PROJECT_BINARY_DIR}/IntersonArraySDKCxxConfig.cmake)
configure_package_config_file(
IntersonArraySDKCxxConfig.cmake.in
${intersonArraySDKCxx_config}
INSTALL_DESTINATION ${PROJECT_BINARY_DIR}
PATH_VARS CONFIG_DIR_CONFIG
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
# Configure 'IntersonArraySDKCxxConfig.cmake' for an install tree
set(CONFIG_DIR_CONFIG ${INSTALL_CMAKE_DIR})
set( intersonArraySDKCxx_install_config ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/IntersonArraySDKCxxConfig.cmake )
configure_package_config_file(
IntersonArraySDKCxxConfig.cmake.in
${intersonArraySDKCxx_install_config}
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}
PATH_VARS CONFIG_DIR_CONFIG
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
install(
FILES ${intersonArraySDKCxx_install_config}
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Development
)
# Configure 'IntersonArraySDKCxxTargets.cmake'
export( TARGETS IntersonArrayCxx
FILE ${PROJECT_BINARY_DIR}/IntersonArraySDKCxxTargets.cmake
)
# Install 'IntersonArraySDKCxxTargets.cmake' and 'IntersonArraySDKCxxConfig.cmake'
install( EXPORT IntersonArraySDKCxxTargets
FILE IntersonArraySDKCxxTargets.cmake
DESTINATION ${INSTALL_CMAKE_DIR}
COMPONENT Development
)