CMakeLists.txt 1.43 KB
Newer Older
Martin Heistermann's avatar
Martin Heistermann committed
1
2
3
4
5
6
7
8
SET(SOURCE_FILES
    unittests_smartptr.cc
    unittests_basics.cc
    unittests_files.cc
    unittests_common.cc
    unittests.cc
    unittests_iterators.cc
    unittests_properties.cc)
9

Martin Heistermann's avatar
Martin Heistermann committed
10
find_package(OpenVolumeMesh REQUIRED)
11

12
13
set(TARGET_NAME "${OVM_TARGET_PREFIX}unittests")

Martin Heistermann's avatar
Martin Heistermann committed
14
15
enable_testing()
find_package(GTest)
16
17

if(GTEST_FOUND)
Martin Heistermann's avatar
Martin Heistermann committed
18
19
    include(GoogleTest)

20
    add_executable(${TARGET_NAME} ${SOURCE_FILES})
21
    target_link_libraries(${TARGET_NAME}
Martin Heistermann's avatar
Martin Heistermann committed
22
23
24
25
26
        OpenVolumeMesh::OpenVolumeMesh
        GTest::GTest
        GTest::Main
        )

27
    gtest_add_tests(TARGET ${TARGET_NAME}
Martin Heistermann's avatar
Martin Heistermann committed
28
29
30
31
32
33
34
35
        EXTRA_ARGS "--gtest_color=yes;--gtest_output=xml"
        WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests"
        )

    file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/TestFiles/"
        DESTINATION "${CMAKE_BINARY_DIR}/Unittests"
        )

36
    set_target_properties(${TARGET_NAME} PROPERTIES
37
38
39
40
41
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests
        CXX_STANDARD ${OVM_CXX_VERSION}
        CXX_STANDARD_REQUIRED YES
        CXX_EXTENSIONS NO
        )
Martin Heistermann's avatar
Martin Heistermann committed
42
43
44

    #[[=
    if ( WIN32 )
45
        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
Martin Heistermann's avatar
Martin Heistermann committed
46
47
                                COMMAND ${CMAKE_COMMAND} -E
                                    copy_if_different
48
49
                                    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/unittests.exe
                                    ${CMAKE_BINARY_DIR}/Unittests/unittests.exe)
Martin Heistermann's avatar
Martin Heistermann committed
50
51
52
    endif()
    =]]
endif()