Skip to content

Commit cab2772

Browse files
committed
add cmake for crypto lib
1 parent 11db878 commit cab2772

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# -*- cmake -*-
2+
#
3+
# Find cryptopp library or sources.
4+
#
5+
# Input variables:
6+
# CRYPTOPP_DIR - set this to specify the cryptopp source to be built.
7+
#
8+
# Output variables:
9+
#
10+
# CRYPTOPP_FOUND - set if library was found
11+
# CRYPTOPP_INCLUDE_DIR - Set to where include files ar found (or sources)
12+
# CRYPTOPP_LIBRARIES - Set to library
13+
# CRYPTOPP_IS_LIB - set if library was found
14+
# CRYPTOPP_IS_SOURCE - set if sources were found
15+
16+
FIND_PATH(CRYPTOPP_INCLUDE_DIR
17+
cryptlib.h
18+
PATHS
19+
/usr/include/cryptopp
20+
/usr/include
21+
/opt/local/include
22+
)
23+
24+
FIND_LIBRARY(CRYPTOPP_LIBRARIES
25+
NAMES
26+
libcryptopp
27+
cryptopp
28+
PATHS
29+
/opt/local/lib
30+
)
31+
32+
IF(CRYPTOPP_INCLUDE_DIR AND CRYPTOPP_LIBRARIES)
33+
SET(CRYPTOPP_FOUND TRUE)
34+
SET(CRYPTOPP_IS_LIB TRUE)
35+
SET(CRYPTOPP_IS_SOURCE FALSE)
36+
IF(CMAKE_TRACE)
37+
MESSAGE(STATUS "Cryptopp libraries found in: ${CRYPTOPP_INCLUDE_DIR}")
38+
ENDIF(CMAKE_TRACE)
39+
include_directories(/opt/local/include)
40+
link_directories(/opt/local/lib/)
41+
ELSE(CRYPTOPP_INCLUDE_DIR AND CRYPTOPP_LIBRARIES)
42+
IF(CRYPTOPP_DIR)
43+
FIND_PATH(CRYPTOPP_INCLUDE_DIR
44+
cryptlib.h
45+
PATHS
46+
${CRYPTOPP_DIR}
47+
)
48+
IF(CRYPTOPP_INCLUDE_DIR)
49+
IF(CMAKE_TRACE)
50+
MESSAGE(STATUS "Cryptopp source found in: ${CRYPTOPP_INCLUDE_DIR}")
51+
ENDIF(CMAKE_TRACE)
52+
SET(CRYPTOPP_FOUND TRUE)
53+
SET(CRYPTOPP_IS_LIB FALSE)
54+
SET(CRYPTOPP_IS_SOURCE TRUE)
55+
ENDIF(CRYPTOPP_INCLUDE_DIR)
56+
ENDIF(CRYPTOPP_DIR)
57+
ENDIF(CRYPTOPP_INCLUDE_DIR AND CRYPTOPP_LIBRARIES)

0 commit comments

Comments
 (0)