Update to 2.0.0 tree from current Fremantle build
[opencv] / tests / cv / CMakeLists.txt
1 # ----------------------------------------------------------------------------
2 #  CMake file for cvtest. See root CMakeLists.txt
3 #
4 # ----------------------------------------------------------------------------
5 project(cvtest)
6
7 file(GLOB test_srcs "src/*.cpp")
8 source_group("Src" FILES ${test_srcs})
9 file(GLOB test_hdrs "src/*.h*")
10 source_group("Include" FILES ${test_hdrs})
11
12 include_directories("${CMAKE_SOURCE_DIR}/include/opencv"
13                     "${CMAKE_CURRENT_SOURCE_DIR}/src"
14                     "${CMAKE_CURRENT_BINARY_DIR}")
15
16 include_directories(../cxts)
17
18 set(the_target "cvtest")
19
20 add_executable(${the_target} ${test_srcs} ${test_hdrs})
21
22 if(PCHSupport_FOUND)
23     set(pch_header ${CMAKE_SOURCE_DIR}/tests/cv/src/cvtest.h)
24     if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*")
25         if(${CMAKE_GENERATOR} MATCHES "Visual*")
26             set(${the_target}_pch "src/cvtest.cpp")
27         endif()            
28         add_native_precompiled_header(${the_target} ${pch_header})
29     elseif(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_GENERATOR} MATCHES ".*Makefiles")
30         add_precompiled_header(${the_target} ${pch_header})
31     endif()
32 endif()
33
34 # Additional target properties
35 set_target_properties(${the_target} PROPERTIES
36         DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
37         RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
38         )
39
40
41 add_dependencies(${the_target} cxts cxcore cv cvaux highgui)
42
43 # Add the required libraries for linking:
44 target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} cxcore cv cvaux highgui cxts)
45
46 enable_testing()
47 get_target_property(LOC ${the_target} LOCATION)
48 add_test(cvtest "${LOC}")
49
50 if(WIN32)
51 install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main)
52 endif()