Cmake support (#55)

* Added cmake support. This builds an object library target that can be included with generator expression in the executable.
This commit is contained in:
Jeroen Oomkes 2018-10-20 00:27:31 +02:00 committed by oKcerG
parent a4b7b6e1d1
commit 02f8f9ef65
2 changed files with 51 additions and 1 deletions

49
CMakeLists.txt Normal file
View File

@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt5 REQUIRED
Core
Qml
)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) # This is to find generated *.moc and *.h files in build dir
add_library(SortFilterProxyModel OBJECT
qqmlsortfilterproxymodel.cpp
filters/filter.cpp
filters/filtercontainer.cpp
filters/rolefilter.cpp
filters/valuefilter.cpp
filters/indexfilter.cpp
filters/regexpfilter.cpp
filters/rangefilter.cpp
filters/expressionfilter.cpp
filters/filtercontainerfilter.cpp
filters/anyoffilter.cpp
filters/alloffilter.cpp
filters/filtersqmltypes.cpp
sorters/sorter.cpp
sorters/sortercontainer.cpp
sorters/rolesorter.cpp
sorters/stringsorter.cpp
sorters/expressionsorter.cpp
sorters/sortersqmltypes.cpp
proxyroles/proxyrole.cpp
proxyroles/proxyrolecontainer.cpp
proxyroles/joinrole.cpp
proxyroles/switchrole.cpp
proxyroles/expressionrole.cpp
proxyroles/proxyrolesqmltypes.cpp
proxyroles/singlerole.cpp
proxyroles/regexprole.cpp
sorters/filtersorter.cpp
proxyroles/filterrole.cpp
)
target_include_directories(SortFilterProxyModel PUBLIC
${CMAKE_CURRENT_LIST_DIR}
$<TARGET_PROPERTY:Qt5::Core,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Qt5::Qml,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@ -12,7 +12,8 @@ Install
##### Without qpm :
1. clone or download this repository
2. add `include (<path/to/SortFilterProxyModel>/SortFilterProxyModel.pri)` in your `.pro`
2. * `qmake` add `include (<path/to/SortFilterProxyModel>/SortFilterProxyModel.pri)` in your `.pro`
* `CMake` add $<TARGET_OBJECTS:SortFilterProxyModel> to the sources of your executable target in your cmake project
3. `import SortFilterProxyModel 0.2` to use this library in your QML files
Sample Usage