56197e8bc89e2c72147babcd4f6325ed595be85c
[opencv] / src / cvaux / CMakeLists.txt
1 # ----------------------------------------------------------------------------
2 #  CMake file for cvaux. See root CMakeLists.txt
3 #
4 # ----------------------------------------------------------------------------
5 project(cvaux)
6
7 file(GLOB aux_srcs *.cpp)
8 file(GLOB aux_srcs_vs vs/*.cpp)
9 set(lib_srcs ${aux_srcs_vs} ${aux_srcs})
10 source_group(Src FILES ${aux_srcs})
11 source_group(Src\\VideoSurveillance FILES ${aux_srcs_vs})
12
13 set(aux_hdr_names cvaux.h cvaux.hpp cvvidsurv.hpp)
14 set(aux_hdrs_ext)
15 foreach(h ${aux_hdr_names})
16     list(APPEND aux_hdrs_ext "${CMAKE_CURRENT_SOURCE_DIR}/../../include/opencv/${h}")
17 endforeach()
18
19 file(GLOB_RECURSE aux_hdrs_int *.h*)
20 set(lib_hdrs ${lib_hdrs} ${aux_hdrs_ext} ${aux_hdrs_int})
21
22 source_group("Include\\External" FILES ${aux_hdrs_ext})
23 source_group("Include\\Internal" FILES ${aux_hdrs_int})
24
25 add_definitions(-DCVAPI_EXPORTS)
26
27 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../include/opencv"
28                     "${CMAKE_CURRENT_SOURCE_DIR}"
29                     "${CMAKE_CURRENT_BINARY_DIR}"
30                     "${CMAKE_CURRENT_SOURCE_DIR}/../cv" ".")
31
32 # ----------------------------------------------------------------------------------
33 #                               Define the library target:
34 # ----------------------------------------------------------------------------------
35 set(the_target "cvaux")
36
37 add_library(${the_target} SHARED ${lib_srcs} ${lib_hdrs})
38
39 if(PCHSupport_FOUND)
40     set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/_cvaux.h)
41     if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*")
42         if(${CMAKE_GENERATOR} MATCHES "Visual*")
43             set(${the_target}_pch "cvauxprecomp.cpp")
44         endif()            
45         add_native_precompiled_header(${the_target} ${pch_header})
46     elseif(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_GENERATOR} MATCHES ".*Makefiles")
47         add_precompiled_header(${the_target} ${pch_header})
48     endif()
49 endif()
50
51 # For dynamic link numbering convenions
52 set_target_properties(${the_target} PROPERTIES
53         VERSION ${OPENCV_VERSION}
54         SOVERSION ${OPENCV_SOVERSION}
55         OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}"
56         )
57
58 # Additional target properties
59 set_target_properties(${the_target} PROPERTIES
60         DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
61         ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/"
62         RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
63         )
64
65 # Add the required libraries for linking:
66 target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} cxcore cv highgui ml)
67
68 if(MSVC AND CMAKE_CROSSCOMPILING)
69         set_target_properties(${the_target} PROPERTIES
70                 LINK_FLAGS "/NODEFAULTLIB:secchk"
71                 )
72 endif()
73
74 # Dependencies of this target:
75 add_dependencies(${the_target} cxcore cv highgui ml)
76
77 install(TARGETS ${the_target}
78         RUNTIME DESTINATION bin COMPONENT main
79         LIBRARY DESTINATION lib COMPONENT main
80         ARCHIVE DESTINATION lib COMPONENT main)
81
82 install(FILES ${aux_hdrs_ext}
83         DESTINATION include/opencv
84         COMPONENT main)