diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindJsonC.cmake | 78 | ||||
-rw-r--r-- | cmake/FindLibarchive.cmake | 74 | ||||
-rw-r--r-- | cmake/FindLibcurl.cmake | 74 |
3 files changed, 135 insertions, 91 deletions
diff --git a/cmake/FindJsonC.cmake b/cmake/FindJsonC.cmake index f3c90df..59cf00a 100644 --- a/cmake/FindJsonC.cmake +++ b/cmake/FindJsonC.cmake @@ -1,45 +1,63 @@ # # JSONC_INCLUDE_DIRS # JSONC_LIBRARIES +# JSONC_CFLAGS find_package(PkgConfig QUIET) if (PKG_CONFIG_FOUND) - pkg_check_modules(_JSONC QUIET json-c) + pkg_check_modules(_JSONC json-c) + + if (BUILD_STATIC AND NOT _JSONC_FOUND) + message(FATAL_ERROR "Cannot find static build information") + endif() endif() -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_lib_suffix 64) +if (_JSONC_FOUND) # we can rely on pkg-config + if (NOT BUILD_STATIC) + set(JSONC_LIBRARIES ${_JSONC_LIBRARIES}) + set(JSONC_INCLUDE_DIRS ${_JSONC_INCLUDE_DIRS}) + set(JSONC_CFLAGS ${_JSONC_CFLAGS_OTHER}) + else() + set(JSONC_LIBRARIES ${_JSONC_STATIC_LIBRARIES}) + set(JSONC_INCLUDE_DIRS ${_JSONC_STATIC_INCLUDE_DIRS}) + set(JSONC_CFLAGS ${_JSONC_STATIC_CFLAGS_OTHER}) + endif() else() - set(_lib_suffix 32) -endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_lib_suffix 64) + else() + set(_lib_suffix 32) + endif() -find_path(JSONC_INC - NAMES json.h - HINTS - ENV jsoncPath${_lib_suffix} - ENV jsoncPath - ${_JSONC_INCLUDE_DIRS} - PATHS - /usr/include/json-c /usr/local/include/json-c) + find_path(JSONC_INC + NAMES json.h + HINTS + ENV jsoncPath${_lib_suffix} + ENV jsoncPath + ${_JSONC_INCLUDE_DIRS} + PATHS + /usr/include/json-c /usr/local/include/json-c) -find_library(JSONC_LIB - NAMES ${_JSONC_LIBRARIES} jsonc json-c - HINTS - ENV jsoncPath${_lib_suffix} - ENV jsoncPath - ${_JSONC_LIBRARY_DIRS} - ${_JSONC_STATIC_LIBRARY_DIRS} - PATHS - /usr/lib /usr/local/lib) + find_library(JSONC_LIB + NAMES ${_JSONC_LIBRARIES} jsonc json-c + HINTS + ENV jsoncPath${_lib_suffix} + ENV jsoncPath + ${_JSONC_LIBRARY_DIRS} + ${_JSONC_STATIC_LIBRARY_DIRS} + PATHS + /usr/lib{_lib_suffix} /usr/local/lib{_lib_suffix} + /usr/lib /usr/local/lib) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(JsonC DEFAULT_MSG JSONC_LIB JSONC_INC) -mark_as_advanced(JSONC_INC JSONC_LIB) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(JsonC DEFAULT_MSG JSONC_LIB JSONC_INC) + mark_as_advanced(JSONC_INC JSONC_LIB) -if(JSONC_FOUND) - set(JSONC_INCLUDE_DIRS ${JSONC_INC}) - set(JSONC_LIBRARIES ${JSONC_LIB}) - if (BUILD_STATIC) - set(JSONC_LIBRARIES ${JSONC_LIBRARIES} ${_JSONC_STATIC_LIBRARY_DIRS}) + if(JSONC_FOUND) + set(JSONC_INCLUDE_DIRS ${JSONC_INC}) + set(JSONC_LIBRARIES ${JSONC_LIB}) + if (BUILD_STATIC) + set(JSONC_LIBRARIES ${JSONC_LIBRARIES} ${_JSONC_STATIC_LIBRARIES}) + endif() endif() endif()
\ No newline at end of file diff --git a/cmake/FindLibarchive.cmake b/cmake/FindLibarchive.cmake index 37ac6bb..e34e991 100644 --- a/cmake/FindLibarchive.cmake +++ b/cmake/FindLibarchive.cmake @@ -1,45 +1,59 @@ # # LIBARCHIVE_INCLUDE_DIRS # LIBARCHIVE_LIBRARIES +# LIBARCHIVE_CFLAGS find_package(PkgConfig QUIET) if (PKG_CONFIG_FOUND) - pkg_check_modules(_LIBARCHIVE QUIET libarchive) + pkg_check_modules(_LIBARCHIVE libarchive) + + if (BUILD_STATIC AND NOT _LIBARCHIVE_FOUND) + message(FATAL_ERROR "Cannot find static build information") + endif() endif() -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_lib_suffix 64) +if (_LIBARCHIVE_FOUND) # we can rely on pkg-config + if (NOT BUILD_STATIC) + set(LIBARCHIVE_LIBRARIES ${_LIBARCHIVE_LIBRARIES}) + set(LIBARCHIVE_INCLUDE_DIRS ${_LIBARCHIVE_INCLUDE_DIRS}) + set(LIBARCHIVE_CFLAGS ${_LIBARCHIVE_CFLAGS_OTHER}) + else() + set(LIBARCHIVE_LIBRARIES ${_LIBARCHIVE_STATIC_LIBRARIES}) + set(LIBARCHIVE_INCLUDE_DIRS ${_LIBARCHIVE_STATIC_INCLUDE_DIRS}) + set(LIBARCHIVE_CFLAGS ${_LIBARCHIVE_STATIC_CFLAGS_OTHER}) + endif() else() - set(_lib_suffix 32) -endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_lib_suffix 64) + else() + set(_lib_suffix 32) + endif() -find_path(LIBARCHIVE_INC - NAMES archive.h archive_entry.h - HINTS - ENV libarchivePath${_lib_suffix} - ENV libarchivePath - ${_LIBARCHIVE_INCLUDE_DIRS} - PATHS - /usr/include /usr/local/include) + find_path(LIBARCHIVE_INC + NAMES archive.h archive_entry.h + HINTS + ENV libarchivePath${_lib_suffix} + ENV libarchivePath + ${_LIBARCHIVE_INCLUDE_DIRS} + PATHS + /usr/include /usr/local/include) -find_library(LIBARCHIVE_LIB - NAMES ${_LIBARCHIVE_LIBRARIES} archive - HINTS - ENV libarchivePath${_lib_suffix} - ENV libarchivePath - ${_LIBARCHIVE_LIBRARY_DIRS} - ${_LIBARCHIVE_STATIC_LIBRARY_DIRS} - PATHS - /usr/lib /usr/local/lib) + find_library(LIBARCHIVE_LIB + NAMES archive + HINTS + ENV libarchivePath${_lib_suffix} + ENV libarchivePath + PATHS + /usr/lib{_lib_suffix} /usr/local/lib{_lib_suffix} + /usr/lib /usr/local/lib) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libarchive DEFAULT_MSG LIBARCHIVE_LIB LIBARCHIVE_INC) -mark_as_advanced(LIBARCHIVE_INC LIBARCHIVE_LIB) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Libarchive DEFAULT_MSG LIBARCHIVE_LIB LIBARCHIVE_INC) + mark_as_advanced(LIBARCHIVE_INC LIBARCHIVE_LIB) -if(LIBARCHIVE_FOUND) - set(LIBARCHIVE_INCLUDE_DIRS ${LIBARCHIVE_INC}) - set(LIBARCHIVE_LIBRARIES ${LIBARCHIVE_LIB}) - if (BUILD_STATIC) - set(LIBARCHIVE_LIBRARIES ${LIBARCHIVE_LIBRARIES} ${_LIBARCHIVE_STATIC_LIBRARIES}) + if(LIBARCHIVE_FOUND) + set(LIBARCHIVE_INCLUDE_DIRS ${LIBARCHIVE_INC}) + set(LIBARCHIVE_LIBRARIES ${LIBARCHIVE_LIB}) + set(LIBARCHIVE_CFLAGS "") endif() endif()
\ No newline at end of file diff --git a/cmake/FindLibcurl.cmake b/cmake/FindLibcurl.cmake index fbe6505..aa89105 100644 --- a/cmake/FindLibcurl.cmake +++ b/cmake/FindLibcurl.cmake @@ -1,46 +1,58 @@ # # LIBCURL_INCLUDE_DIRS # LIBCURL_LIBRARIES +# LIBCURL_CFLAGS find_package(PkgConfig QUIET) if (PKG_CONFIG_FOUND) - pkg_check_modules(_CURL REQUIRED QUIET libcurl) + pkg_check_modules(_CURL libcurl) + + if (BUILD_STATIC AND NOT _CURL_FOUND) + message(FATAL_ERROR "Cannot find static build information") + endif() endif() -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_lib_suffix 64) +if (_CURL_FOUND) # we can rely on pkg-config + if (NOT BUILD_STATIC) + set(LIBCURL_LIBRARIES ${_CURL_LIBRARIES}) + set(LIBCURL_INCLUDE_DIRS ${_CURL_INCLUDE_DIRS}) + set(LIBCURL_CFLAGS ${_CURL_CFLAGS_OTHER}) + else() + set(LIBCURL_LIBRARIES ${_CURL_STATIC_LIBRARIES}) + set(LIBCURL_INCLUDE_DIRS ${_CURL_STATIC_INCLUDE_DIRS}) + set(LIBCURL_CFLAGS ${_CURL_STATIC_CFLAGS_OTHER}) + endif() else() - set(_lib_suffix 32) -endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_lib_suffix 64) + else() + set(_lib_suffix 32) + endif() -find_path(CURL_INC - NAMES curl/curl.h - HINTS - ENV curlPath${_lib_suffix} - ENV curlPath - ${_CURL_INCLUDE_DIRS} - PATHS - /usr/include /usr/local/include) + find_path(CURL_INC + NAMES curl/curl.h + HINTS + ENV curlPath${_lib_suffix} + ENV curlPath + PATHS + /usr/include /usr/local/include) -find_library(CURL_LIB - NAMES ${_CURL_LIBRARIES} curl libcurl - HINTS - ENV curlPath${_lib_suffix} - ENV curlPath - ${_CURL_LIBRARY_DIRS} - ${_CURL_STATIC_LIBRARY_DIRS} - PATHS - /usr/lib /usr/local/lib) + find_library(CURL_LIB + NAMES curl + HINTS + ENV curlPath${_lib_suffix} + ENV curlPath + PATHS + /usr/lib{_lib_suffix} /usr/local/lib{_lib_suffix} + /usr/lib /usr/local/lib) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libcurl DEFAULT_MSG CURL_LIB CURL_INC) -mark_as_advanced(CURL_INC CURL_LIB) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Libcurl DEFAULT_MSG CURL_LIB CURL_INC) + mark_as_advanced(CURL_INC CURL_LIB) -if(LIBCURL_FOUND) - set(LIBCURL_INCLUDE_DIRS ${CURL_INC}) - set(LIBCURL_LIBRARIES ${CURL_LIB}) - if (BUILD_STATIC) - set(LIBCURL_LIBRARIES ${LIBCURL_LIBRARIES} ${_CURL_STATIC_LIBRARIES}) - add_compile_definitions(CURL_STATICLIB) + if(LIBCURL_FOUND) + set(LIBCURL_INCLUDE_DIRS ${CURL_INC}) + set(LIBCURL_LIBRARIES ${CURL_LIB}) + set(LIBCURL_CFLAGS "") endif() endif()
\ No newline at end of file |