46 lines
1.8 KiB
Text
46 lines
1.8 KiB
Text
From 5ab73ee82245b586f69762411edc7824d778ee2a Mon Sep 17 00:00:00 2001
|
|
From: Chris Kitching <chriskitching@linux.com>
|
|
Date: Tue, 15 Nov 2016 10:15:48 +0000
|
|
Subject: [PATCH] Rely on BUILD_SHARED_LIBS instead of custom options
|
|
|
|
Instead of having your own option for choosing between static
|
|
and shared versions of the library, use cmake's built-in option
|
|
for this:
|
|
https://cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html
|
|
|
|
Set -DBUILD_SHARED_LIBS=ON to get a shared library, and omit it
|
|
or set it to OFF to get a static one.
|
|
Can add one extra line to the cmake file to make the default be
|
|
shared. Makes most of the cmake crap go away.
|
|
--- cmake_unofficial/CMakeLists.txt.orig 2016-08-11 18:18:57 UTC
|
|
+++ cmake_unofficial/CMakeLists.txt
|
|
@@ -6,26 +6,14 @@ project(xxhash)
|
|
set(XXHASH_LIB_VERSION "0.42.0")
|
|
set(XXHASH_LIB_SOVERSION "0")
|
|
|
|
-set(BUILD_SHARED_LIBS ON CACHE BOOL "Set to ON to build shared libraries")
|
|
-if(BUILD_SHARED_LIBS)
|
|
- add_library(xxhash SHARED ../xxhash.c)
|
|
- set_target_properties(xxhash PROPERTIES COMPILE_DEFINITIONS "XXHASH_EXPORT"
|
|
+add_library(xxhash SHARED ../xxhash.c)
|
|
+set_target_properties(xxhash PROPERTIES COMPILE_DEFINITIONS "XXHASH_EXPORT"
|
|
VERSION "${XXHASH_LIB_VERSION}"
|
|
SOVERSION "${XXHASH_LIB_SOVERSION}")
|
|
- LIST(APPEND install_libs xxhash)
|
|
-endif(BUILD_SHARED_LIBS)
|
|
|
|
-set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
|
|
-if(BUILD_STATIC_LIBS)
|
|
- add_library(xxhashstatic ../xxhash.c)
|
|
- set_target_properties(xxhashstatic PROPERTIES OUTPUT_NAME xxhash)
|
|
- LIST(APPEND install_libs xxhashstatic)
|
|
-endif(BUILD_STATIC_LIBS)
|
|
-
|
|
-
|
|
INSTALL(FILES ../xxhash.h DESTINATION include)
|
|
INSTALL(
|
|
- TARGETS ${install_libs}
|
|
+ TARGETS xxhash
|
|
RUNTIME DESTINATION bin
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|