Skip to content

Commit

Permalink
Merge pull request #170 from PJK/lm
Browse files Browse the repository at this point in the history
Explicitly link math library
  • Loading branch information
PJK committed Nov 27, 2020
2 parents 14abd14 + 08625bc commit 0741dd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Next
---------------------
- Improved pkg-config paths handling [[#164]](https://github.com/PJK/libcbor/pull/164) (by [jtojnar@](https://github.com/jtojnar))
- Use explicit math.h linkage [[#170]](https://github.com/PJK/libcbor/pull/170)

0.8.0 (2020-09-20)
---------------------
Expand Down
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set(SOURCES cbor.c cbor/streaming.c cbor/internal/encoders.c cbor/internal/build

include(GNUInstallDirs)
include(JoinPaths)
include(CheckFunctionExists)
set(CMAKE_SKIP_BUILD_RPATH FALSE)

if (CBOR_CUSTOM_ALLOC)
Expand All @@ -15,6 +16,12 @@ endif()
add_library(cbor ${SOURCES})
target_include_directories(cbor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# Explicitly link math.h if necessary
check_function_exists(ldexp LDEXP_AVAILABLE)
if (NOT LDEXP_AVAILABLE)
target_link_libraries(cbor m)
endif()

include(GenerateExportHeader)
generate_export_header(cbor EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/cbor/cbor_export.h)
target_include_directories(cbor PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
Expand Down

0 comments on commit 0741dd4

Please sign in to comment.