diff --git a/CMakeLists.txt b/CMakeLists.txt index 3186252..ff8dfdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/Modules/FindCrypto++.cmake b/cmake/Modules/FindCrypto++.cmake new file mode 100644 index 0000000..37a4a9a --- /dev/null +++ b/cmake/Modules/FindCrypto++.cmake @@ -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) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 438d2dc..34910cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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/) diff --git a/src/CryptClass/CMakeLists.txt b/src/CryptClass/CMakeLists.txt index 173e737..8218d9c 100644 --- a/src/CryptClass/CMakeLists.txt +++ b/src/CryptClass/CMakeLists.txt @@ -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}) diff --git a/src/IOFileClass/CMakeLists.txt b/src/IOFileClass/CMakeLists.txt index af1ec84..8cc95cd 100644 --- a/src/IOFileClass/CMakeLists.txt +++ b/src/IOFileClass/CMakeLists.txt @@ -1 +1,2 @@ +#Make IOFileClass lib add_library(IOFileClass ./FileManIOFile.cpp) diff --git a/src/ParserClass/CMakeLists.txt b/src/ParserClass/CMakeLists.txt index 90317fb..2449ee3 100644 --- a/src/ParserClass/CMakeLists.txt +++ b/src/ParserClass/CMakeLists.txt @@ -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/) diff --git a/src/ParserClass/FileManContainer/CMakeLists.txt b/src/ParserClass/FileManContainer/CMakeLists.txt index 0988d54..0535fb2 100644 --- a/src/ParserClass/FileManContainer/CMakeLists.txt +++ b/src/ParserClass/FileManContainer/CMakeLists.txt @@ -1 +1,2 @@ +#Make FileManContainer lib add_library(FileManContainer ./Website.cpp)