-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs 11914. Make p11 windows installer friendly
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
- Loading branch information
Miguel Barro
committed
Dec 9, 2021
1 parent
92e0e6b
commit 803b532
Showing
8 changed files
with
76 additions
and
50 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,25 +1,43 @@ | ||
# Find libp11 | ||
# FindLibP11 | ||
# | ||
# LIBP11_INCLUDE_DIR | ||
# LIBP11_LIBRARIES | ||
# LIBP11_FOUND | ||
# Generates an imported target associated to an available pksc11 library: | ||
# | ||
# + On linux relies on the apt package libp11-dev | ||
# | ||
# + On Windows the library must be build from sources available at https://github.com/OpenSC/libp11.git | ||
# Given that each user must build its own binaries the following environment variables must be set to hint | ||
# where to locate headers and binaries (semicolon-separated list see https://cmake.org/cmake/help/v3.22/variable/PackageName_ROOT.html): | ||
# + LibP11_ROOT_32 -> to reference sources and 32 bit binaries location | ||
# + LibP11_ROOT_64 -> to reference sources and 64 bit binaries location | ||
|
||
if(TARGET eProsima_p11) | ||
return() | ||
endif() | ||
|
||
IF (LIBP11_INCLUDE_DIR) | ||
SET(LIBP11_FIND_QUIETLY TRUE) | ||
ENDIF (LIBP11_INCLUDE_DIR) | ||
if(CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
set(LibP11_ROOT "$ENV{LibP11_ROOT_32}") | ||
else() | ||
set(LibP11_ROOT "$ENV{LibP11_ROOT_64}") | ||
endif() | ||
|
||
FIND_PATH(LIBP11_INCLUDE_DIR libp11.h) | ||
find_path(LIBP11_INCLUDE_DIR NAMES libp11.h HINTS ${LibP11_ROOT}) | ||
find_library(LIBP11_LIBRARY NAMES libp11.a libp11.lib HINTS ${LibP11_ROOT}) | ||
|
||
SET(LIBP11_NAMES p11 libp11) | ||
FIND_LIBRARY(LIBP11_LIBRARY NAMES ${LIBP11_NAMES} ) | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(LibP11 DEFAULT_MSG LIBP11_LIBRARY LIBP11_INCLUDE_DIR) | ||
|
||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibP11 DEFAULT_MSG LIBP11_LIBRARY LIBP11_INCLUDE_DIR) | ||
if(LibP11_FOUND) | ||
# add the target | ||
add_library(eProsima_p11 STATIC IMPORTED) | ||
|
||
IF(LIBP11_FOUND) | ||
SET( LIBP11_LIBRARIES ${LIBP11_LIBRARY} ) | ||
ELSE(LIBP11_FOUND) | ||
SET( LIBP11_LIBRARIES ) | ||
ENDIF(LIBP11_FOUND) | ||
# update the properties | ||
set_target_properties(eProsima_p11 PROPERTIES | ||
IMPORTED_LOCATION "${LIBP11_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${LIBP11_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
MARK_AS_ADVANCED( LIBP11_LIBRARY LIBP11_INCLUDE_DIR ) | ||
# clean local variables | ||
unset(LIBP11_INCLUDE_DIR) | ||
unset(LIBP11_LIBRARY) | ||
unset(LibP11_ROOT) |
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
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
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
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
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
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
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