Skip to content

Commit

Permalink
#3076: Merge pull request #3090 from NickCao/main
Browse files Browse the repository at this point in the history
cmake: use IMPORTED_TARGET to create imported target for botan2
  • Loading branch information
pbek committed Aug 26, 2024
2 parents a1007ed + 77605f2 commit a344eb9
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/cmake/FindBotan2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,7 @@ if(TARGET Botan2::Botan2)
endif()

find_package(PkgConfig REQUIRED QUIET)
find_package(PackageHandleStandardArgs REQUIRED QUIET)

pkg_check_modules(Botan2 REQUIRED IMPORTED_TARGET botan-2)

pkg_check_modules(Botan2
botan-2
)

find_library(Botan2_FullLibraryPath
${Botan2_LIBRARIES}
PATHS ${Botan2_LIBRARY_DIRS}
NO_DEFAULT_PATH
)

find_package_handle_standard_args(Botan2
REQUIRED_VARS Botan2_LIBRARIES Botan2_INCLUDE_DIRS
VERSION_VAR Botan2_VERSION
)
message("Botan2_INCLUDE_DIRS ${Botan2_INCLUDE_DIRS}")

if(Botan2_FOUND)
if(NOT TARGET Botan2::Botan2)
add_library(Botan2::Botan2
UNKNOWN IMPORTED GLOBAL
)
set_target_properties(Botan2::Botan2 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Botan2_INCLUDE_DIRS}
IMPORTED_LOCATION ${Botan2_FullLibraryPath}
LINK_FLAGS ${Botan2_LDFLAGS_OTHER}
)
endif()
endif()
add_library(Botan2::Botan2 ALIAS PkgConfig::Botan2)

0 comments on commit a344eb9

Please sign in to comment.