-
Notifications
You must be signed in to change notification settings - Fork 3
/
vosmModule.cmake
61 lines (47 loc) · 1.7 KB
/
vosmModule.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
# this is template for a VOSM module
macro(define_vosm_module name)
project(${name})
add_definitions(-DCVAPI_EXPORTS)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_BINARY_DIR}")
file(GLOB lib_srcs "src/*.cpp")
file(GLOB lib_hdrs "include/*.h*")
source_group("Src" FILES ${lib_srcs} ${lib_hdrs})
set(the_target "${name}")
add_library(${the_target} ${lib_srcs} ${lib_hdrs} )
# For dynamic link numbering convenions
set_target_properties(${the_target} PROPERTIES
VERSION ${VOSM_VERSION}
SOVERSION ${VOSM_SOVERSION}
OUTPUT_NAME "${the_target}${VOSM_DLLVERSION}"
)
# Additional target properties
set_target_properties(${the_target} PROPERTIES
DEBUG_POSTFIX "${VOSM_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
)
# Add the required libraries for linking:
target_link_libraries(${the_target} ${VOSM_LINKER_LIBS} ${IPP_LIBS} )
if(MSVC)
if(CMAKE_CROSSCOMPILING)
set_target_properties(${the_target} PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:secchk"
)
endif()
set_target_properties(${the_target} PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:libc"
)
endif()
# Dependencies of this target:
add_dependencies(${the_target} ${ARGN})
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main)
install(FILES ${lib_hdrs}
DESTINATION include/vosm/${name}
COMPONENT main)
endmacro()