-
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.
See oetiker/rrdtool-1.x@b76e3c5 Fix #8
- Loading branch information
Showing
2 changed files
with
30 additions
and
2 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 |
---|---|---|
@@ -1,14 +1,36 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES C) | ||
|
||
include(CheckCSourceCompiles) | ||
|
||
set(CMAKE_C_STANDARD 99) | ||
|
||
function(check_mutable_argv) | ||
set(CMAKE_REQUIRED_LIBRARIES PkgConfig::LIBRRD) | ||
check_c_source_compiles( | ||
" | ||
#include <rrd.h> | ||
int main() { | ||
(void)rrd_graph_v(0, (char**)NULL); | ||
return 0; | ||
} | ||
" | ||
LIBRRD_HAS_MUTABLE_ARGV) | ||
unset(CMAKE_REQUIRED_LIBRARIES) | ||
endfunction() | ||
|
||
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(LIBRRD REQUIRED IMPORTED_TARGET librrd) | ||
|
||
check_mutable_argv() | ||
|
||
python_add_library(rrd MODULE c_src/rrd.c WITH_SOABI) | ||
target_link_libraries(rrd PRIVATE PkgConfig::LIBRRD) | ||
if(LIBRRD_HAS_MUTABLE_ARGV) | ||
target_compile_definitions(rrd PRIVATE LIBRRD_HAS_MUTABLE_ARGV) | ||
endif() | ||
set_property(TARGET rrd PROPERTY INTERPROCEDURAL_OPTIMIZATION True) | ||
|
||
install(TARGETS rrd DESTINATION collectd_rest) |
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