forked from Sidatii/xpscan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
32 lines (25 loc) · 977 Bytes
/
Copy pathCMakeLists.txt
File metadata and controls
32 lines (25 loc) · 977 Bytes
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
cmake_minimum_required(VERSION 3.10)
project(XP-SCAN)
set(CMAKE_CXX_STANDARD 17)
set(SOURCES src/Scanner.cpp src/Exporter.cpp src/Printer.cpp)
set(TEST_SOURCES tests/ExporterTest.cpp tests/ScannerTest.cpp tests/PrinterTest.cpp)
# Find Criterion (Testing library)
find_package(PkgConfig REQUIRED)
pkg_check_modules(CRITERION REQUIRED criterion)
# Look for threads
find_package(Threads REQUIRED)
# Include directories
include_directories(include)
# Actual executable
add_executable(xpscan src/main.cpp ${SOURCES})
target_link_libraries(xpscan PRIVATE Threads::Threads)
# Tests runner
add_executable(xpscan_tests EXCLUDE_FROM_ALL ${TEST_SOURCES} ${SOURCES})
target_include_directories(xpscan_tests PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(xpscan_tests PRIVATE Threads::Threads ${CRITERION_LIBRARIES})
# Test target
add_custom_target(test
COMMAND ${CMAKE_MAKE_PROGRAM} xpscan_tests
COMMAND ./xpscan_tests
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)