2a98d245245778cec2cac0f9f07975642cf256a8
[opencv] / tests / cxts / CMakeLists.txt
1 # ----------------------------------------------------------------------------
2 #  CMake file for cxts. See root CMakeLists.txt
3 #
4 # ----------------------------------------------------------------------------
5 project(cxts)
6
7 file(GLOB lib_srcs "*.cpp")
8 source_group("Src" FILES ${lib_srcs})
9 file(GLOB lib_hdrs "*.h*")
10 source_group("Include" FILES ${lib_hdrs})
11
12 include_directories(.)
13
14 if(WIN32 AND MSVC)
15     set(pch_header "_cxts.h")
16     set(pch_src "precomp.cpp")
17     list(REMOVE_ITEM lib_srcs ${CMAKE_CURRENT_SOURCE_DIR}/${pch_src})
18     set(lib_srcs ${CMAKE_CURRENT_SOURCE_DIR}/${pch_src} ${lib_srcs})
19     foreach(src_file ${lib_srcs})
20         if(${src_file} MATCHES ${pch_src})
21             set_source_files_properties(
22                 ${src_file}
23                 PROPERTIES
24                 COMPILE_FLAGS "/Yc${pch_header}"
25                 )
26         else()
27             set_source_files_properties(
28                 ${src_file}
29                 PROPERTIES
30                 COMPILE_FLAGS "/Yu${pch_header}"
31                 )
32         endif()
33     endforeach()
34 endif()
35
36 # ----------------------------------------------------------------------------------
37 #                               Define the library target:
38 # ----------------------------------------------------------------------------------
39 set(the_target "cxts")
40
41 add_library(${the_target} SHARED ${lib_srcs} ${lib_hdrs})
42
43 # For dynamic link numbering convenions
44 set_target_properties(${the_target} PROPERTIES
45     VERSION ${OPENCV_VERSION}
46     SOVERSION ${OPENCV_SOVERSION}
47     OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}"
48     )
49
50 # Additional target properties
51 set_target_properties(${the_target} PROPERTIES
52         DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
53         ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/"
54         RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
55         DEFINE_SYMBOL "CVAPI_EXPORTS"
56         )
57
58 add_dependencies(${the_target} cxcore)
59
60 # Add the required libraries for linking:
61 target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} cxcore)
62
63 if(WIN32)
64 install(TARGETS ${the_target}
65     RUNTIME DESTINATION bin COMPONENT main
66         LIBRARY DESTINATION lib COMPONENT main
67         ARCHIVE DESTINATION lib COMPONENT main)
68 endif()