forked from PrinceNgattaiLam/Trafic
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Trafic.cmake
100 lines (81 loc) · 3.63 KB
/
Trafic.cmake
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
cmake_minimum_required(VERSION 2.8.9)
set(LOCAL_PROJECT_NAME Trafic)
project(Trafic)
if(${LOCAL_PROJECT_NAME}_BUILD_SLICER_EXTENSION)
#-----------------------------------------------------------------------------
# Extension meta-information
set(EXTENSION_HOMEPAGE "http://slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/Trafic")
set(EXTENSION_CATEGORY "Classification")
set(EXTENSION_CONTRIBUTORS "Prince Ngattai Lam")
set(EXTENSION_DESCRIPTION "")
set(EXTENSION_ICONURL "http://www.example.com/Slicer/Extensions/Trafic.png")
set(EXTENSION_SCREENSHOTURLS "http://www.example.com/Slicer/Extensions/Trafic/Screenshots/1.png")
set(EXTENSION_DEPENDS "NA") # Specified as a space separated string, a list or 'NA' if any
#-----------------------------------------------------------------------------
# Extension dependencies
find_package(Slicer REQUIRED)
include(${Slicer_USE_FILE})
SET(INSTALL_RUNTIME_DESTINATION ${Slicer_INSTALL_CLIMODULES_BIN_DIR})
SET(INSTALL_LIBRARY_DESTINATION ${Slicer_INSTALL_CLIMODULES_LIB_DIR})
SET(INSTALL_ARCHIVE_DESTINATION ${Slicer_INSTALL_CLIMODULES_LIB_DIR})
endif()
SETIFEMPTY(INSTALL_RUNTIME_DESTINATION bin)
SETIFEMPTY(INSTALL_LIBRARY_DESTINATION bin)
SETIFEMPTY(INSTALL_ARCHIVE_DESTINATION lib/static)
SETIFEMPTY(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
SETIFEMPTY(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
SETIFEMPTY(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
find_package(niral_utilities REQUIRED
HINTS ${niral_utilities_DIR})
include_directories(${niral_utilities_INCLUDE_DIRS})
#-----------------------------------------------------------------------------
# Extension modules
add_subdirectory(TraficMulti)
add_subdirectory(TraficLib)
add_subdirectory(CLI/cxx)
## NEXT_MODULE
if(${LOCAL_PROJECT_NAME}_BUILD_SLICER_EXTENSION)
#-----------------------------------------------------------------------------
include(${Slicer_EXTENSION_GENERATE_CONFIG})
include(${Slicer_EXTENSION_CPACK})
endif()
### This is the config file for niral_utilities
# Create the FooBarConfig.cmake and FooBarConfigVersion files
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR CMake)
else()
set(DEF_INSTALL_CMAKE_DIR lib/CMake/Trafic)
endif()
set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH
"Installation directory for CMake files")
set(INSTALL_INCLUDE_DIR include)
set(INSTALL_BIN_DIR bin)
# Make relative paths absolute (needed later on)
foreach(p LIB BIN INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
file(RELATIVE_PATH REL_INCLUDE_DIR ${INSTALL_CMAKE_DIR} ${INSTALL_INCLUDE_DIR})
file(RELATIVE_PATH REL_BIN_DIR ${INSTALL_CMAKE_DIR} ${INSTALL_BIN_DIR})
# ... for the build tree
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
get_property(CONF_LIBRARIES GLOBAL PROPERTY Trafic_LIBRARIES)
set(Trafic_PY_DIR ${Trafic_SOURCE_DIR})
configure_file(TraficConfig.cmake.in
"${PROJECT_BINARY_DIR}/TraficConfig.cmake" @ONLY)
# ... for the install tree
set(CONF_INCLUDE_DIRS "\${Trafic_CMAKE_DIR}/${REL_INCLUDE_DIR}")
set(CONF_PY_DIR "\${Trafic_CMAKE_DIR}/${REL_BIN_DIR}")
configure_file(TraficConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TraficConfig.cmake" @ONLY)
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TraficConfig.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
# Install the export set for use with the install-tree
install(EXPORT TraficTargets DESTINATION
"${INSTALL_CMAKE_DIR}" COMPONENT dev)
export(TARGETS ${CONF_LIBRARIES}
FILE "${PROJECT_BINARY_DIR}/TraficTargets.cmake"
)