mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Improve CMake rules
* Disable building examples by default. * Use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR. * Add an option to disable install rules.
This commit is contained in:
+6
-3
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user