aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml7
-rw-r--r--CMakeLists.txt28
2 files changed, 33 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml
index a5938670..2a03267e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,10 +26,13 @@ before_install:
script:
- mkdir build && cd build
-- cmake ..
+- cmake -DCMAKE_INSTALL_PREFIX=../install ..
- cmake --build . --target all
+- cmake --build . --target install
- cd ..
-- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX"
+- ls -R install
+- mv lib lib.back # Force the below script to use the installed copy instead
+- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDES += -I./install/include" "LIBS += -L./install/lib"
- make all
- if [ "$QMC_TEST_USER" != "" ]; then $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 82ab2b55..3ee2200d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.1)
project(qmatrixclient CXX)
include(CheckCXXCompilerFlag)
+if (NOT WIN32)
+ include(GNUInstallDirs)
+endif(NOT WIN32)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -86,6 +89,31 @@ target_link_libraries(qmatrixclient Qt5::Core Qt5::Network Qt5::Gui)
add_executable(qmc-example ${example_SRCS})
target_link_libraries(qmc-example Qt5::Core qmatrixclient)
+# Installation
+
+if (NOT CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR ".")
+endif()
+
+if (NOT CMAKE_INSTALL_BINDIR)
+ set(CMAKE_INSTALL_BINDIR ".")
+endif()
+
+if (NOT CMAKE_INSTALL_INCLUDEDIR)
+ set(CMAKE_INSTALL_INCLUDEDIR "include")
+endif()
+
+install (TARGETS qmatrixclient EXPORT QMatrixClient
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+install (DIRECTORY . DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING PATTERN "*.h")
+
+install (TARGETS qmc-example RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+install (EXPORT QMatrixClient DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/qmatrixclient)
+
if (WIN32)
install (FILES mime/packages/freedesktop.org.xml
DESTINATION mime/packages)