Add crypto++ detect for cmake
This commit is contained in:
parent
1ac5203e38
commit
9dc95b5197
7 changed files with 67 additions and 11 deletions
|
@ -1,13 +1,18 @@
|
|||
|
||||
#Defined project name
|
||||
project(forgetIt)
|
||||
|
||||
#Assign Modules path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
#Defined project VERSION
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 1)
|
||||
set(VERSION_REV 0)
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
|
||||
|
||||
#Minimum cmake VERSION
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
#Add source directory
|
||||
add_subdirectory(src)
|
||||
|
||||
|
|
36
cmake/Modules/FindCrypto++.cmake
Normal file
36
cmake/Modules/FindCrypto++.cmake
Normal file
|
@ -0,0 +1,36 @@
|
|||
# - Find Crypto++
|
||||
|
||||
if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
|
||||
set(CRYPTO++_FOUND TRUE)
|
||||
|
||||
else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
|
||||
find_path(CRYPTO++_INCLUDE_DIR cryptlib.h
|
||||
/usr/include/crypto++
|
||||
/usr/include/cryptopp
|
||||
/usr/local/include/crypto++
|
||||
/usr/local/include/cryptopp
|
||||
/opt/local/include/crypto++
|
||||
/opt/local/include/cryptopp
|
||||
$ENV{SystemDrive}/Crypto++/include
|
||||
)
|
||||
|
||||
find_library(CRYPTO++_LIBRARIES NAMES cryptopp
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
$ENV{SystemDrive}/Crypto++/lib
|
||||
)
|
||||
|
||||
if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
|
||||
set(CRYPTO++_FOUND TRUE)
|
||||
message(STATUS "Found Crypto++: ${CRYPTO++_INCLUDE_DIR}, ${CRYPTO++_LIBRARIES}")
|
||||
else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
|
||||
set(CRYPTO++_FOUND FALSE)
|
||||
message(STATUS "Crypto++ not found.")
|
||||
endif(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
|
||||
|
||||
mark_as_advanced(CRYPTO++_INCLUDE_DIR CRYPTO++_LIBRARIES)
|
||||
|
||||
endif(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
|
||||
|
|
@ -1,18 +1,27 @@
|
|||
#Defined executable
|
||||
add_executable(
|
||||
forgetIt
|
||||
./main.cpp
|
||||
)
|
||||
|
||||
#Find all libraries
|
||||
find_package(LibXML++ REQUIRED)
|
||||
find_package(GTK3 REQUIRED)
|
||||
find_package(Crypto++ REQUIRED)
|
||||
|
||||
include_directories(${LibXML++_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS})
|
||||
target_link_libraries(forgetIt ${LibXML++_LIBRARIES} ${GTK3_LIBRARIES})
|
||||
#Include "Includes" and "Libraries"
|
||||
include_directories(${LibXML++_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${CRYPTO++_INCLUDE_DIR})
|
||||
target_link_libraries(forgetIt ${LibXML++_LIBRARIES} ${GTK3_LIBRARIES} ${CRYPTO++_LIBRARIES})
|
||||
|
||||
#Export "Includes" and "Libraries" to cache
|
||||
set_property(GLOBAL PROPERTY LibXML++_INCLUDE_DIRS "${LibXML++_INCLUDE_DIRS}")
|
||||
set_property(GLOBAL PROPERTY LibXML++_LIBRARIES "${LibXML++_LIBRARIES}")
|
||||
|
||||
set_property(GLOBAL PROPERTY CRYPTO++_INCLUDE_DIR "${CRYPTO++_INCLUDE_DIR}")
|
||||
set_property(GLOBAL PROPERTY CRYPTO++_LIBRARIES "${CRYPTO++_LIBRARIES}")
|
||||
|
||||
|
||||
#Add subdirectory
|
||||
add_subdirectory(./CryptClass/)
|
||||
add_subdirectory(./IOFileClass/)
|
||||
add_subdirectory(./ParserClass/)
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
#Retrieve crypto++ libraries
|
||||
get_property(CRYPTO++_LIBRARIES GLOBAL PROPERTY CRYPTO++_LIBRARIES)
|
||||
|
||||
#Make CryptClass lib
|
||||
add_library(CryptClass ./AESCrypt.cpp ./HASHCrypt.cpp)
|
||||
|
||||
#Add crypto++ to CryptClass
|
||||
target_link_libraries(CryptClass ${CRYPTO++_LIBRARIES})
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#Make IOFileClass lib
|
||||
add_library(IOFileClass ./FileManIOFile.cpp)
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
add_library(ParserClass ./AbstractIDManager.cpp ./FileManParser.cpp)
|
||||
|
||||
|
||||
#Retrieve LibXML++ libraries
|
||||
get_property(LibXML++_INCLUDE_DIRS GLOBAL PROPERTY LibXML++_INCLUDE_DIRS)
|
||||
|
||||
#Create ParserClass lib
|
||||
add_library(ParserClass ./AbstractIDManager.cpp ./FileManParser.cpp)
|
||||
|
||||
|
||||
|
||||
#Make ParserClass lib
|
||||
target_link_libraries(ParserClass ${LibXML++_LIBRARIES})
|
||||
|
||||
|
||||
|
||||
|
||||
#Add FileManContainer subdirectory
|
||||
add_subdirectory(./FileManContainer/)
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#Make FileManContainer lib
|
||||
add_library(FileManContainer ./Website.cpp)
|
||||
|
|
Loading…
Add table
Reference in a new issue