-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build overlaybd using static compiled libcurl 7.42.1
Signed-off-by: 鸣舟 <[email protected]>
- Loading branch information
Showing
3 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
include(FetchContent) | ||
|
||
if(${BUILD_CURL_FROM_SOURCE}) | ||
message("Add and build standalone libcurl") | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
curl_bundle | ||
GIT_REPOSITORY https://github.com/curl/curl.git | ||
GIT_TAG curl-7_42_1 | ||
GIT_PROGRESS 1) | ||
|
||
FetchContent_GetProperties(curl_bundle) | ||
if(NOT curl_bundle_POPULATED) | ||
FetchContent_Populate(curl_bundle) | ||
|
||
if(NOT EXISTS ${curl_bundle_BINARY_DIR}/lib/libcurl.a | ||
OR NOT EXISTS ${curl_bundle_BINARY_DIR}/include/curl/curl.h) | ||
execute_process( | ||
COMMAND autoreconf -i | ||
WORKING_DIRECTORY ${curl_bundle_SOURCE_DIR} | ||
COMMAND_ECHO STDOUT) | ||
|
||
execute_process( | ||
COMMAND | ||
sh configure --with-openssl --without-libssh2 | ||
--enable-static --enable-shared=no --enable-optimize | ||
--enable-symbol-hiding --disable-manual --without-libidn | ||
--prefix=${curl_bundle_BINARY_DIR} | ||
WORKING_DIRECTORY ${curl_bundle_SOURCE_DIR} | ||
COMMAND_ECHO STDOUT) | ||
|
||
execute_process( | ||
COMMAND make -j | ||
WORKING_DIRECTORY ${curl_bundle_SOURCE_DIR} | ||
COMMAND_ECHO STDOUT) | ||
|
||
execute_process( | ||
COMMAND make install | ||
WORKING_DIRECTORY ${curl_bundle_SOURCE_DIR} | ||
COMMAND_ECHO STDOUT) | ||
endif() | ||
|
||
endif() | ||
|
||
include_directories(${curl_bundle_BINARY_DIR}/include) | ||
link_directories(${curl_bundle_BINARY_DIR}/lib) | ||
message("${curl_bundle_BINARY_DIR}") | ||
|
||
set(CURL_FOUND yes) | ||
set(CURL_LIBRARY ${curl_bundle_BINARY_DIR}/lib/libcurl.a) | ||
set(CURL_LIBRARIES ${CURL_LIBRARY}) | ||
set(CURL_LIBRARY_RELEASE ${CURL_LIBRARY}) | ||
set(CURL_INCLUDE_DIR ${curl_bundle_BINARY_DIR}/include) | ||
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) | ||
set(CURL_VERSION_STRING 7.42.1) | ||
|
||
if(NOT TARGET CURL::libcurl) | ||
add_library(CURL::libcurl UNKNOWN IMPORTED) | ||
set_target_properties(CURL::libcurl PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") | ||
|
||
if(EXISTS "${CURL_LIBRARY}") | ||
set_target_properties(CURL::libcurl PROPERTIES | ||
IMPORTED_LINK_INTERFACE_LANGUAGES "C" | ||
IMPORTED_LOCATION "${CURL_LIBRARY}") | ||
endif() | ||
if(CURL_LIBRARY_RELEASE) | ||
set_property(TARGET CURL::libcurl APPEND PROPERTY | ||
IMPORTED_CONFIGURATIONS RELEASE) | ||
set_target_properties(CURL::libcurl PROPERTIES | ||
IMPORTED_LINK_INTERFACE_LANGUAGES "C" | ||
IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") | ||
endif() | ||
target_link_libraries(CURL::libcurl INTERFACE crypto ssl) | ||
endif() | ||
else() | ||
include(${CMAKE_ROOT}/Modules/FindCURL.cmake) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters