diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-24 17:13:27 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-24 17:13:27 +0100 |
commit | 9eac618a73006c9c74f79695d94a4ed305583c39 (patch) | |
tree | abb4f9c747eb951aa6c1e8322914d53db6d145fa /cmake | |
parent | 9ef4d441ad91ebcbc68bdae309122f128ed69f56 (diff) | |
download | fastd-9eac618a73006c9c74f79695d94a4ed305583c39.tar fastd-9eac618a73006c9c74f79695d94a4ed305583c39.zip |
Make build dependencies more configurable
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindCAP.cmake | 16 | ||||
-rw-r--r-- | cmake/FindJSON_C.cmake | 24 | ||||
-rw-r--r-- | cmake/Findlibcap.cmake | 18 | ||||
-rw-r--r-- | cmake/Findlibsodium.cmake | 24 | ||||
-rw-r--r-- | cmake/Findlibuecc.cmake | 24 | ||||
-rw-r--r-- | cmake/deps.cmake | 67 |
6 files changed, 116 insertions, 57 deletions
diff --git a/cmake/FindCAP.cmake b/cmake/FindCAP.cmake deleted file mode 100644 index 80afff3..0000000 --- a/cmake/FindCAP.cmake +++ /dev/null @@ -1,16 +0,0 @@ -FIND_PATH(CAP_INCLUDE_DIR sys/capability.h) -FIND_LIBRARY(CAP_LIBRARY NAMES cap) - -IF (CAP_INCLUDE_DIR AND CAP_LIBRARY) - SET(CAP_FOUND TRUE) -ENDIF (CAP_INCLUDE_DIR AND CAP_LIBRARY) - -IF (CAP_FOUND) - IF (NOT CAP_FIND_QUIETLY) - MESSAGE(STATUS "Found libcap: ${CAP_LIBRARY}; include path: ${CAP_INCLUDE_DIR}") - ENDIF (NOT CAP_FIND_QUIETLY) -ELSE (CAP_FOUND) - IF (CAP_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find libcap") - ENDIF (CAP_FIND_REQUIRED) -ENDIF (CAP_FOUND) diff --git a/cmake/FindJSON_C.cmake b/cmake/FindJSON_C.cmake new file mode 100644 index 0000000..e31a8b9 --- /dev/null +++ b/cmake/FindJSON_C.cmake @@ -0,0 +1,24 @@ +# Defines the following variables: +# JSON_C_FOUND +# JSON_C_INCLUDE_DIR +# JSON_C_LIBRARIES +# JSON_C_CFLAGS_OTHER +# JSON_C_LDFLAGS_OTHER + + +if(ANDROID) + find_host_package(PkgConfig REQUIRED QUIET) +else(ANDROID) + find_package(PkgConfig REQUIRED QUIET) +endif(ANDROID) + +pkg_check_modules(_JSON_C json-c) + +find_path(JSON_C_INCLUDE_DIR NAMES json-c/json.h HINTS ${_JSON_C_INCLUDE_DIRS}) +find_library(JSON_C_LIBRARIES NAMES json-c HINTS ${_JSON_C_LIBRARY_DIRS}) + +set(JSON_C_CFLAGS_OTHER "${_JSON_C_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for json-c") +set(JSON_C_LDFLAGS_OTHER "${_JSON_C_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for json-c") + +find_package_handle_standard_args(JSON_C REQUIRED_VARS JSON_C_LIBRARIES JSON_C_INCLUDE_DIR) +mark_as_advanced(JSON_C_INCLUDE_DIR JSON_C_LIBRARIES JSON_C_CFLAGS_OTHER JSON_C_LDFLAGS_OTHER) diff --git a/cmake/Findlibcap.cmake b/cmake/Findlibcap.cmake new file mode 100644 index 0000000..3a16af1 --- /dev/null +++ b/cmake/Findlibcap.cmake @@ -0,0 +1,18 @@ +FIND_PATH(LIBCAP_INCLUDE_DIR sys/capability.h) +FIND_LIBRARY(LIBCAP_LIBRARY NAMES cap) + +IF (LIBCAP_INCLUDE_DIR AND LIBCAP_LIBRARY) + SET(LIBCAP_FOUND TRUE) +ENDIF (LIBCAP_INCLUDE_DIR AND LIBCAP_LIBRARY) + +IF (LIBCAP_FOUND) + IF (NOT LIBCAP_FIND_QUIETLY) + MESSAGE(STATUS "Found libcap: ${LIBCAP_LIBRARY}; include path: ${LIBCAP_INCLUDE_DIR}") + ENDIF (NOT LIBCAP_FIND_QUIETLY) +ELSE (LIBCAP_FOUND) + IF (LIBCAP_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find libcap") + ENDIF (LIBCAP_FIND_REQUIRED) +ENDIF (LIBCAP_FOUND) + +mark_as_advanced(LIBCAP_INCLUDE_DIR LIBCAP_LIBRARY) diff --git a/cmake/Findlibsodium.cmake b/cmake/Findlibsodium.cmake new file mode 100644 index 0000000..a82063a --- /dev/null +++ b/cmake/Findlibsodium.cmake @@ -0,0 +1,24 @@ +# Defines the following variables: +# LIBSODIUM_FOUND +# LIBSODIUM_INCLUDE_DIR +# LIBSODIUM_LIBRARIES +# LIBSODIUM_CFLAGS_OTHER +# LIBSODIUM_LDFLAGS_OTHER + + +if(ANDROID) + find_host_package(PkgConfig REQUIRED QUIET) +else(ANDROID) + find_package(PkgConfig REQUIRED QUIET) +endif(ANDROID) + +pkg_check_modules(_LIBSODIUM libsodium) + +find_path(LIBSODIUM_INCLUDE_DIR NAMES sodium/crypto_stream.h HINTS ${_LIBSODIUM_INCLUDE_DIRS}) +find_library(LIBSODIUM_LIBRARIES NAMES sodium HINTS ${_LIBSODIUM_LIBRARY_DIRS}) + +set(LIBSODIUM_CFLAGS_OTHER "${_LIBSODIUM_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for libsodium") +set(LIBSODIUM_LDFLAGS_OTHER "${_LIBSODIUM_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for libsodium") + +find_package_handle_standard_args(libsodium REQUIRED_VARS LIBSODIUM_LIBRARIES LIBSODIUM_INCLUDE_DIR) +mark_as_advanced(LIBSODIUM_INCLUDE_DIR LIBSODIUM_LIBRARIES LIBSODIUM_CFLAGS_OTHER LIBSODIUM_LDFLAGS_OTHER) diff --git a/cmake/Findlibuecc.cmake b/cmake/Findlibuecc.cmake new file mode 100644 index 0000000..dfee8bc --- /dev/null +++ b/cmake/Findlibuecc.cmake @@ -0,0 +1,24 @@ +# Defines the following variables: +# LIBUECC_FOUND +# LIBUECC_INCLUDE_DIR +# LIBUECC_LIBRARIES +# LIBUECC_CFLAGS_OTHER +# LIBUECC_LDFLAGS_OTHER + + +if(ANDROID) + find_host_package(PkgConfig REQUIRED QUIET) +else(ANDROID) + find_package(PkgConfig REQUIRED QUIET) +endif(ANDROID) + +pkg_check_modules(_LIBUECC libuecc>=5) + +find_path(LIBUECC_INCLUDE_DIR NAMES libuecc/ecc.h HINTS ${_LIBUECC_INCLUDE_DIRS}) +find_library(LIBUECC_LIBRARIES NAMES uecc HINTS ${_LIBUECC_LIBRARY_DIRS}) + +set(LIBUECC_CFLAGS_OTHER "${_LIBUECC_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for libuecc") +set(LIBUECC_LDFLAGS_OTHER "${_LIBUECC_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for libuecc") + +find_package_handle_standard_args(LIBUECC REQUIRED_VARS LIBUECC_LIBRARIES LIBUECC_INCLUDE_DIR) +mark_as_advanced(LIBUECC_INCLUDE_DIR LIBUECC_LIBRARIES LIBUECC_CFLAGS_OTHER LIBUECC_LDFLAGS_OTHER) diff --git a/cmake/deps.cmake b/cmake/deps.cmake index ce3ca1b..38f1b49 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -6,71 +6,56 @@ endif(NOT DARWIN) if(ANDROID) find_host_package(BISON 2.5 REQUIRED) - find_host_package(PkgConfig REQUIRED) else(ANDROID) find_package(BISON 2.5 REQUIRED) - find_package(PkgConfig REQUIRED) endif(ANDROID) -pkg_check_modules(UECC REQUIRED libuecc>=5) +find_package(libuecc REQUIRED) - -set(NACL_INCLUDE_DIRS "") -set(NACL_CFLAGS_OTHER "") -set(NACL_LIBRARY_DIRS "") -set(NACL_LIBRARIES "") -set(NACL_LDFLAGS_OTHER "") +set(NACL_INCLUDE_DIR) +set(NACL_CFLAGS_OTHER) +set(NACL_LIBRARIES) +set(NACL_LDFLAGS_OTHER) if(ENABLE_LIBSODIUM) - pkg_check_modules(SODIUM libsodium) - - if(SODIUM_FOUND) - set(NACL_INCLUDE_DIRS "${SODIUM_INCLUDE_DIRS}") - foreach(dir "${SODIUM_INCLUDEDIR}" ${SODIUM_INCLUDE_DIRS}) - list(APPEND NACL_INCLUDE_DIRS "${dir}/sodium") - endforeach(dir) - - set(NACL_CFLAGS_OTHER "${SODIUM_CFLAGS_OTHER}") - set(NACL_LIBRARY_DIRS "${SODIUM_LIBRARY_DIRS}") - set(NACL_LIBRARIES "${SODIUM_LIBRARIES}") - set(NACL_LDFLAGS_OTHER "${SODIUM_LDFLAGS_OTHER}") - endif(SODIUM_FOUND) + find_package(libsodium) + + if(LIBSODIUM_FOUND) + set(NACL_INCLUDE_DIR "${LIBSODIUM_INCLUDE_DIR}/sodium") + set(NACL_LIBRARIES "${LIBSODIUM_LIBRARIES}") + set(NACL_CFLAGS_OTHER "${LIBSODIUM_CFLAGS_OTHER}") + set(NACL_LDFLAGS_OTHER "${LIBSODIUM_LDFLAGS_OTHER}") + endif(LIBSODIUM_FOUND) else(ENABLE_LIBSODIUM) find_package(NaCl) - if(NACL_FOUND) - set(NACL_INCLUDE_DIRS "${NACL_INCLUDE_DIR}") - set(NACL_LIBRARIES "${NACL_LIBRARY}") - endif(NACL_FOUND) + set(NACL_LIBRARIES "${NACL_LIBRARY}") endif(ENABLE_LIBSODIUM) set_property(GLOBAL PROPERTY NACL_REQUIRED FALSE) if(ENABLE_OPENSSL) - pkg_check_modules(OPENSSL_CRYPTO REQUIRED libcrypto) + find_package(OpenSSL REQUIRED) else(ENABLE_OPENSSL) - set(OPENSSL_CRYPTO_INCLUDE_DIRS "") - set(OPENSSL_CRYPTO_CFLAGS_OTHER "") - set(OPENSSL_CRYPTO_LIBRARY_DIRS "") - set(OPENSSL_CRYPTO_LIBRARIES "") - set(OPENSSL_CRYPTO_LDFLAGS_OTHER "") + set(OPENSSL_INCLUDE_DIR) + set(OPENSSL_CRYPTO_LIBRARY) endif(ENABLE_OPENSSL) if(WITH_CAPABILITIES) - find_package(CAP REQUIRED) + find_package(libcap REQUIRED) else(WITH_CAPABILITIES) - set(CAP_INCLUDE_DIR "") - set(CAP_LIBRARY "") + set(LIBCAP_INCLUDE_DIR) + set(LIBCAP_LIBRARY) endif(WITH_CAPABILITIES) if(WITH_STATUS_SOCKET) - pkg_check_modules(JSONC REQUIRED json-c) + find_package(JSON_C REQUIRED) else(WITH_STATUS_SOCKET) - set(JSONC_INCLUDE_DIRS "") - set(JSONC_CFLAGS_OTHER "") - set(JSONC_LIBRARY_DIRS "") - set(JSONC_LIBRARIES "") - set(JSONC_LDFLAGS_OTHER "") + set(JSON_C_INCLUDE_DIRS) + set(JSON_C_CFLAGS_OTHER) + set(JSON_C_LIBRARY_DIRS) + set(JSON_C_LIBRARIES) + set(JSON_C_LDFLAGS_OTHER) endif(WITH_STATUS_SOCKET) |