-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental: added CMake-based installer.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 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,30 @@ | ||
cmake_policy(SET CMP0048 NEW) | ||
project(hdrbg VERSION 1.0.0 DESCRIPTION "C implementation of Hash DRBG") | ||
cmake_minimum_required(VERSION 3.22) | ||
include(GNUInstallDirs) | ||
|
||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
set(CMAKE_C_EXTENSIONS OFF) | ||
set(CMAKE_C_STANDARD 17) | ||
set(CMAKE_C_STANDARD_REQUIRED TRUE) | ||
|
||
file(GLOB sources lib/*.c) | ||
list(FILTER sources EXCLUDE REGEX ".*py.*") | ||
add_library(hdrbg SHARED ${sources}) | ||
target_include_directories(hdrbg PRIVATE include) | ||
configure_file(hdrbg.pc.in hdrbg.pc @ONLY) | ||
|
||
set_target_properties(hdrbg PROPERTIES | ||
PUBLIC_HEADER include/hdrbg.h | ||
SOVERSION 1 | ||
VERSION ${PROJECT_VERSION} | ||
) | ||
target_compile_options(hdrbg PRIVATE -O2 -Wall -Wextra -fstrict-aliasing) | ||
|
||
install(TARGETS hdrbg | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
install(FILES ${CMAKE_BINARY_DIR}/hdrbg.pc | ||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig | ||
) |
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,12 @@ | ||
prefix=@CMAKE_INSTALL_PREFIX@ | ||
exec_prefix=@CMAKE_INSTALL_PREFIX@ | ||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ | ||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ | ||
|
||
Name: @PROJECT_NAME@ | ||
Description: @PROJECT_DESCRIPTION@ | ||
Version: @PROJECT_VERSION@ | ||
|
||
Requires: | ||
Libs: -L${libdir} -lhdrbg | ||
Cflags: -I${includedir} |