File: CMakeLists.txt

package info (click to toggle)
libcsfml 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,240 kB
  • sloc: cpp: 7,741; ansic: 2,616; sh: 805; makefile: 16
file content (77 lines) | stat: -rw-r--r-- 2,644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
include(FetchContent)

set(CATCH_CONFIG_FAST_COMPILE ON CACHE BOOL "")
set(CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ON CACHE BOOL "")
find_package(Catch2 3.7 REQUIRED)
include(Catch)

set(CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE PRE_TEST)

add_executable(test-csfml-system
    System/Buffer.test.cpp
    System/Clock.test.cpp
    System/Sleep.test.cpp
    System/Time.test.cpp
    System/Vector2.test.cpp
    System/Vector3.test.cpp
)
target_link_libraries(test-csfml-system PRIVATE csfml-system Catch2::Catch2WithMain)
set_target_warnings(test-csfml-system)
catch_discover_tests(test-csfml-system)

add_executable(test-csfml-window
    Window/Joystick.test.cpp
    Window/Keyboard.test.cpp
    Window/Mouse.test.cpp
    Window/Sensor.test.cpp
    Window/Window.test.cpp
    Window/WindowBase.test.cpp
)
target_link_libraries(test-csfml-window PRIVATE csfml-window Catch2::Catch2WithMain SFML::Window)
set_target_warnings(test-csfml-window)
catch_discover_tests(test-csfml-window)

add_executable(test-csfml-graphics
    Graphics/BlendMode.test.cpp
    Graphics/Color.test.cpp
    Graphics/CoordinateType.test.cpp
    Graphics/Image.test.cpp
    Graphics/PrimitiveType.test.cpp
    Graphics/Rect.test.cpp
    Graphics/RenderStates.test.cpp
    Graphics/Shape.test.cpp
    Graphics/StencilMode.test.cpp
    Graphics/Transform.test.cpp
    Graphics/VertexArray.test.cpp
    Graphics/View.test.cpp
)
target_link_libraries(test-csfml-graphics PRIVATE csfml-graphics Catch2::Catch2WithMain SFML::Graphics)
set_target_warnings(test-csfml-graphics)
catch_discover_tests(test-csfml-graphics WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(test-csfml-network
    Network/Ftp.test.cpp
    Network/Http.test.cpp
    Network/IpAddress.test.cpp
    Network/SocketStatus.test.cpp
)
target_link_libraries(test-csfml-network PRIVATE csfml-network Catch2::Catch2WithMain SFML::Network)
set_target_warnings(test-csfml-network)
catch_discover_tests(test-csfml-network)

add_executable(test-csfml-audio
    Audio/SoundChannel.test.cpp
)
target_link_libraries(test-csfml-audio PRIVATE csfml-audio Catch2::Catch2WithMain SFML::Audio)
set_target_warnings(test-csfml-audio)
catch_discover_tests(test-csfml-audio)

# Copy DLLs into the same directory
if(SFML_OS_WINDOWS AND NOT CSFML_LINK_SFML_STATICALLY)
    foreach(SFML_TARGET SFML::System SFML::Window SFML::Graphics SFML::Audio SFML::Network)
        add_custom_command(
            TARGET test-csfml-system PRE_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${SFML_TARGET}> $<TARGET_FILE_DIR:test-csfml-system> COMMAND_EXPAND_LISTS
        )
    endforeach()
endif()