-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
37 lines (28 loc) · 1 KB
/
Copy pathCMakeLists.txt
File metadata and controls
37 lines (28 loc) · 1 KB
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
#############
## pathstr ##
#############
cmake_minimum_required(VERSION 3.16)
project(pathstr LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_TESTS "Enable building of unit tests" ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
add_library(pathstr STATIC
pathstr.cpp
pathstr.h
)
target_link_libraries(pathstr PRIVATE Qt${QT_VERSION_MAJOR}::Core)
target_compile_definitions(pathstr PRIVATE PATHSTR_LIBRARY)
target_include_directories(pathstr PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(BUILD_TESTS)
enable_testing()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test)
add_executable(test_pathstr test_pathstr.cpp)
add_test(NAME test_pathstr COMMAND test_pathstr)
target_link_libraries(test_pathstr PRIVATE Qt${QT_VERSION_MAJOR}::Test pathstr)
endif(BUILD_TESTS)