forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
librhash: switch to custom CMakeLists.txt
The build scripts in the project are quite non-standard and not too portable. Based on rhash/RHash#103
- Loading branch information
Showing
4 changed files
with
67 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Based on https://github.com/rhash/RHash/pull/103 | ||
cmake_minimum_required(VERSION 3.15) | ||
project(librhash LANGUAGES C) | ||
|
||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/version.h" versionfile) | ||
string(REGEX MATCH "#define VERSION \"([0-9]*)\.([0-9]*)\.([0-9]*)\"" _ ${versionfile}) | ||
set(RHASH_VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
set(RHASH_VERSION_MINOR ${CMAKE_MATCH_2}) | ||
set(RHASH_VERSION_PATCH ${CMAKE_MATCH_3}) | ||
set(RHASH_VERSION "${RHASH_VERSION_MAJOR}.${RHASH_VERSION_MINOR}.${RHASH_VERSION_PATCH}") | ||
|
||
option(USE_OPENSSL "Enable OpenSSL (optimized hash functions) support" ON) | ||
|
||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | ||
|
||
set(SRC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/src/librhash") | ||
file(GLOB SOURCE_FILES "${SRC_ROOT}/*.c") | ||
file(GLOB HEADER_FILES "${SRC_ROOT}/*.h") | ||
|
||
add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}") | ||
|
||
if(USE_OPENSSL) | ||
find_package(OpenSSL REQUIRED) | ||
target_link_libraries(${PROJECT_NAME} OpenSSL::Crypto) | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_OPENSSL) | ||
endif() | ||
|
||
if(MSVC) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_DEPRECATE) | ||
endif() | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES | ||
COMPILE_DEFINITIONS IN_RHASH | ||
DEFINE_SYMBOL RHASH_EXPORTS | ||
PREFIX "" | ||
IMPORT_PREFIX "" | ||
VERSION ${RHASH_VERSION} | ||
SOVERSION ${RHASH_VERSION_MAJOR}) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
|
||
install(FILES "${SRC_ROOT}/rhash.h" "${SRC_ROOT}/rhash_torrent.h" | ||
DESTINATION include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
recipes/librhash/all/patches/0001-1.4.2-fix-compiler-detection.patch
This file was deleted.
Oops, something went wrong.