I have just upgrade my CMake from version 2.8 to 3.2.
It's working like a charm in CMake 2.8 but, after the upgrade, it's failing.
I'm trying to build third party library using ExternalProject_Add()
CMake function.
ExternalProject_Add(
luacov
URL https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
DOWNLOAD_DIR ${EXTERNAL_PROJECT_DOWNLOAD_DIR}
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${MY_TOOLCHAIN_FILE}
SOURCE_DIR ${EXTERNAL_PROJECT_SRC_DIR}/luacov
BINARY_DIR ${EXTERNAL_PROJECT_BUILD_DIR}/luacov
UPDATE_COMMAND ""
PATCH_COMMAND ""
)
MY OBSERVATION:
GIT_REPOSITORY
option, ExternalProject_Add()
allow http
and https
protocol to download external project.URL
option, ExternalProject_Add()
only allow http
, but not https
protocol to download external project.PROBLEM:
Is there any way to download and build external project using https
protocol?
ERROR:
[ 16%] Performing download step (download, verify and extract) for 'luacov'
-- downloading...
src='https://github.com/keplerproject/luacov/archive/v0.7.tar.gz'
dst='/home/build/my_build/external_projects/downloads/v0.7.tar.gz'
timeout='none'
CMake Error at /home/build/my_build/luacov-prefix/src/luacov-stamp/download-luacov.cmake:21 (message):
error: downloading
'https://github.com/keplerproject/luacov/archive/v0.7.tar.gz' failed
status_code: 1
status_string: "Unsupported protocol"
log: Protocol "https" not supported or disabled in libcurl
Closing connection -1
make[3]: *** [luacov-prefix/src/luacov-stamp/luacov-download] Error 1
make[2]: *** [CMakeFiles/luacov.dir/all] Error 2
make[1]: *** [CMakeFiles/luacov.dir/rule] Error 2
make: *** [luacov] Error 2
The problem may be that the CURL library shipped with CMake isn't build with SSL support by default. I had to compile cmake with:
./bootstrap --system-curl
make
sudo make install
... and that worked, because my system's curl has SSL support.
What it worked for me is the following:
Update openssl
sudo apt-get install openssl libssl-dev
Modify bootstrap file to enable CMAKE_USE_OPENSSL. Replace this line by:
cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"
Run bootstrap script normally in cmake folder
/@path_to_cmake/bootstrap
In my ExternalProject_Add()
, I have use GIT_REPOSITORY
insted of URL
option.
#URL https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
GIT_REPOSITORY https://github.com/keplerproject/luacov.git
And luacov
download and build successfully.
For any https
protocol use DOWNLOAD_COMMAND
option of ExternalProject_Add()
function.
DOWNLOAD_COMMAND wget https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
and its working as expected.
Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With