Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linking with lib jansson #229

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions cmake/jansson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ find_package(jansson CONFIG)

if(jansson_FOUND)

message(STATUS "jansson library found via find_package")
message(STATUS "[p4est] jansson library found via find_package")
set(P4EST_HAVE_JSON 1)

else()

Expand All @@ -17,9 +18,14 @@ else()
pkg_check_modules(P4EST_JANSSON QUIET IMPORTED_TARGET jansson)

if (P4EST_JANSSON_FOUND)
message(STATUS "jansson library found via pkg-config")
add_library(jansson::jansson ALIAS PkgConfig::P4EST_JANSSON)
message(STATUS "[p4est] jansson library found via pkg-config")

add_library(jansson::jansson INTERFACE IMPORTED GLOBAL)
target_include_directories(jansson::jansson INTERFACE "${LIBSC_JANSSON_INCLUDE_DIRS}")
target_link_libraries(jansson::jansson INTERFACE "${LIBSC_JANSSON_LIBRARIES}")

set(jansson_FOUND 1)
set(P4EST_HAVE_JSON 1)
else()
set(jansson_FOUND 0)
endif()
Expand All @@ -32,4 +38,9 @@ endif()

if( NOT jansson_FOUND )
message(NOTICE "libjansson was not found")
set(P4EST_HAVE_JSON 0)
endif()

if (NOT DEFINED SC_HAVE_JSON)
set(SC_HAVE_JSON ${P4EST_HAVE_JSON})
endif()