Merge pull request #38 from Shatur95/improve-cmake-rule

Improve CMake rules
This commit is contained in:
Felix Barz
2020-06-07 21:00:21 +02:00
committed by GitHub
+6 -3
View File
@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.1)
project(qhotkey VERSION 1.2.2 LANGUAGES CXX)
option(QHOTKEY_EXAMPLES "Build examples" ON)
option(QHOTKEY_EXAMPLES "Build examples" OFF)
option(QHOTKEY_INSTALL "Enable install rule" ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -53,6 +54,7 @@ if(QHOTKEY_EXAMPLES)
add_subdirectory(HotkeyTest)
endif()
if(QHOTKEY_INSTALL)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/QHotkey)
@@ -62,9 +64,10 @@ install(
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES
${CMAKE_SOURCE_DIR}/QHotkey/qhotkey.h
${CMAKE_SOURCE_DIR}/QHotkey/QHotkey
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/qhotkey.h
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/QHotkey
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/)
install(EXPORT QHotkeyConfig DESTINATION ${INSTALL_CONFIGDIR})
export(TARGETS qhotkey FILE QHotkeyConfig.cmake)
endif()