aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-10-07 12:25:33 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-10-07 12:25:33 +0200
commit544f69c3e8cd744db0b8f20aade475159fef1d5e (patch)
treedfc5a40901c125afd5494f9f2fa48de2104f40eb
parentd2c33da6230d3b1ed1eeeb059272123d895569ed (diff)
parentae7dd58eb381f3e95954705766dc5138e10a03f4 (diff)
downloadlibnitrokey-544f69c3e8cd744db0b8f20aade475159fef1d5e.tar.gz
libnitrokey-544f69c3e8cd744db0b8f20aade475159fef1d5e.tar.bz2
Merge branch 'pr_68'
Closes #68
-rw-r--r--CMakeLists.txt24
1 files changed, 19 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11882f9..d28425a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,15 @@ project(libnitrokey)
SET(PROJECT_VERSION "3.0-alpha")
set(CMAKE_CXX_STANDARD 14)
-OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" TRUE)
+set(LIBNK_VERSION_MAJOR 3) # reminder: incompatible API changes
+set(LIBNK_VERSION_MINOR 0) # add functionality in a backwards-compatible manner
+set(LIBNK_VERSION_PATCH 0) # make backwards-compatible bug fixes
+set(LIBNK_VERSION ${LIBNK_VERSION_MAJOR}.${LIBNK_VERSION_MINOR}.${LIBNK_VERSION_PATCH} )
+
+
+include(GNUInstallDirs)
+
+OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" FALSE)
OPTION(COMPILE_TESTS "Compile tests" FALSE)
@@ -84,8 +92,7 @@ ENDIF()
IF (NOT LIBNITROKEY_STATIC)
add_library(nitrokey SHARED ${SOURCE_FILES})
add_library(nitrokey-log SHARED ${SOURCE_FILES})
- install (TARGETS nitrokey DESTINATION "lib")
- SET(LIBNAME nitrokey)
+ SET(LIBNAME nitrokey)
ELSE()
add_library(nitrokey-static STATIC ${SOURCE_FILES})
add_library(nitrokey-static-log STATIC ${SOURCE_FILES})
@@ -96,6 +103,11 @@ ENDIF()
target_link_libraries(${LIBNAME} hidapi-libusb)
target_link_libraries(${LIBNAME}-log hidapi-libusb)
+set_target_properties(${LIBNAME} PROPERTIES VERSION ${LIBNK_VERSION}
+ SOVERSION ${LIBNK_VERSION_MAJOR} )
+set_target_properties(${LIBNAME}-log PROPERTIES VERSION ${LIBNK_VERSION}
+ SOVERSION ${LIBNK_VERSION_MAJOR} )
+
OPTION(ERROR_ON_WARNING "Stop compilation on warning found (not supported for MSVC)" ON)
if (NOT MSVC)
set(COMPILE_FLAGS "-Wall -Wno-unused-function -Wcast-qual -Woverloaded-virtual")
@@ -110,8 +122,10 @@ endif()
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG")
-file(GLOB LIB_INCLUDES "include/libnitrokey/*.h")
-install (FILES ${LIB_INCLUDES} DESTINATION "include")
+file(GLOB LIB_INCLUDES "include/*.h")
+install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libnitrokey)
+install (TARGETS ${LIBNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install (TARGETS ${LIBNAME}-log DESTINATION ${CMAKE_INSTALL_LIBDIR})
IF (COMPILE_TESTS)
include_directories(unittest/Catch/include)