xxhash: enable shared build

This commit is contained in:
Boris Nagaev 2016-07-07 20:25:36 +02:00
parent 4dcc00b55f
commit 23993d6aeb
2 changed files with 38 additions and 15 deletions

View File

@ -1,23 +1,48 @@
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Wed, 6 Jul 2016 22:12:35 +0200
Subject: [PATCH] install .dll to bin/ instead of lib/
Add cmake option BUILD_SHARED_LIBS to prevent building shared library
on static target.
diff --git a/cmake_unofficial/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt
index 825193e..79adbc3 100644
index 1111111..2222222 100644
--- a/cmake_unofficial/CMakeLists.txt
+++ b/cmake_unofficial/CMakeLists.txt
@@ -6,15 +6,16 @@ project(xxhash)
@@ -6,11 +6,14 @@ project(xxhash)
set(XXHASH_LIB_VERSION "0.42.0")
set(XXHASH_LIB_SOVERSION "0")
-add_library(xxhash SHARED ../xxhash.c)
-set_target_properties(xxhash PROPERTIES COMPILE_DEFINITIONS "XXHASH_EXPORT"
- VERSION "${XXHASH_LIB_VERSION}"
- SOVERSION "${XXHASH_LIB_SOVERSION}")
-set(install_libs xxhash)
+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"
VERSION "${XXHASH_LIB_VERSION}"
SOVERSION "${XXHASH_LIB_SOVERSION}")
set(install_libs xxhash)
+ 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")
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
if(BUILD_STATIC_LIBS)
- add_library(xxhashstatic ../xxhash.c)
+ add_library(xxhashstatic STATIC ../xxhash.c)
set_target_properties(xxhashstatic PROPERTIES OUTPUT_NAME xxhash)
LIST(APPEND install_libs xxhashstatic)
endif(BUILD_STATIC_LIBS)
@@ -21,4 +24,9 @@ endif(BUILD_STATIC_LIBS)
INSTALL(FILES ../xxhash.h DESTINATION include)
-INSTALL(TARGETS ${install_libs} DESTINATION lib)
+INSTALL(
+ TARGETS ${install_libs}
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)

View File

@ -24,5 +24,3 @@ define $(PKG)_BUILD
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 install
endef
$(PKG)_BUILD_SHARED =