CMakeLists.txt 1.36 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

Martin Heistermann's avatar
Martin Heistermann committed
12 13
enable_testing()
find_package(GTest)
14 15

if(GTEST_FOUND)
Martin Heistermann's avatar
Martin Heistermann committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    include(GoogleTest)

    add_executable(unittests ${SOURCE_FILES})
    target_link_libraries(unittests
        OpenVolumeMesh::OpenVolumeMesh
        GTest::GTest
        GTest::Main
        )

    gtest_add_tests(TARGET unittests
        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"
        )

34 35 36 37 38 39
    set_target_properties(unittests PROPERTIES
        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
40 41 42 43 44 45

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