ExternalProject_Add() setting build command to run external project's makefile

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ExternalProject_Add() setting build command to run external project's makefile

David Starkweather
Hello
First off, much thanks to all the contributors of cmake. A truly invaluable build utility. Your efforts
are greatly appreciated.

I've been successfully using cmake to build an external project (the client library for redis, hiredis) 
that has already been downloaded. I was able to do this with BUILD_IN_SOURCE set to true, like so:

ExternalProject_Add(hiredis  
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/hiredis
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hiredis
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND echo configure
BUILD_COMMAND make static
INSTALL_COMMAND echo install)


However, now i'd like to automatically download the source from github.  So, I switch to 
the following:

set(HIREDIS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hiredis)
set(HIREDIS_INCLUDE_DIRS ${HIREDIS_DIR}/include)
ExternalProject_Add(hiredis
  URL https://github.com/redis/hiredis/archive/v0.9.0.tar.gz
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/hiredis
  SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/hiredis
  DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/hiredis
  BUILD_IN_SOURCE 1
  CONFIGURE_COMMAND ""
  BUILD_COMMAND make static
  INSTALL_COMMAND "")


And I get the following error:

[  3%] Creating directories for 'hiredis'
[  6%] Performing download step (download, verify and extract) for 'hiredis'
-- Downloading...
   dst='/home/david/projects/clipseekr/hiredis/v0.9.0.tar.gz'
   timeout='none'
-- Using src='https://github.com/redis/hiredis/archive/v0.9.0.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/david/projects/clipseekr/hiredis/v0.9.0.tar.gz'
     dst='/home/david/projects/clipseekr/hiredis'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
make[2]: *** [CMakeFiles/hiredis.dir/build.make:93: hiredis/src/hiredis-stamp/hiredis-download] Error 1
make[1]: *** [CMakeFiles/Makefile2:147: CMakeFiles/hiredis.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

It seems cmake is trying to invoke its internal cmake make files, rather than just run the "make static"
build command.  How do I just run the the "make static" command directly? 

Once again, thanks.
starkdg
  

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProject_Add() setting build command to run external project's makefile

Michael Ellery
It seems like the error might be related to the download/extract step. I think the fact that you are using the same dir for PREFIX, SOURCE_DIR and DOWNLOAD_DIR might be confusing things. I would try commenting out those three properties and see if it makes any difference, and then you can fine-tune those properties as needed once you get it working (maybe but just setting PREFIX).

-Mike

> On May 31, 2019, at 7:41 AM, David Starkweather <[hidden email]> wrote:
>
> Hello
> First off, much thanks to all the contributors of cmake. A truly invaluable build utility. Your efforts
> are greatly appreciated.
>
> I've been successfully using cmake to build an external project (the client library for redis, hiredis)
> that has already been downloaded. I was able to do this with BUILD_IN_SOURCE set to true, like so:
>
> ExternalProject_Add(hiredis  
> PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/hiredis
> SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hiredis
> BUILD_IN_SOURCE 1
> CONFIGURE_COMMAND echo configure
> BUILD_COMMAND make static
> INSTALL_COMMAND echo install)
>
>
> However, now i'd like to automatically download the source from github.  So, I switch to
> the following:
>
> set(HIREDIS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hiredis)
> set(HIREDIS_INCLUDE_DIRS ${HIREDIS_DIR}/include)
> ExternalProject_Add(hiredis
>   URL https://github.com/redis/hiredis/archive/v0.9.0.tar.gz
>   PREFIX ${CMAKE_CURRENT_BINARY_DIR}/hiredis
>   SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/hiredis
>   DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/hiredis
>   BUILD_IN_SOURCE 1
>   CONFIGURE_COMMAND ""
>   BUILD_COMMAND make static
>   INSTALL_COMMAND "")
>
> And I get the following error:
>
> [  3%] Creating directories for 'hiredis'
> [  6%] Performing download step (download, verify and extract) for 'hiredis'
> -- Downloading...
>    dst='/home/david/projects/clipseekr/hiredis/v0.9.0.tar.gz'
>    timeout='none'
> -- Using src='https://github.com/redis/hiredis/archive/v0.9.0.tar.gz'
> -- Downloading... done
> -- extracting...
>      src='/home/david/projects/clipseekr/hiredis/v0.9.0.tar.gz'
>      dst='/home/david/projects/clipseekr/hiredis'
> -- extracting... [tar xfz]
> -- extracting... [analysis]
> -- extracting... [rename]
> -- extracting... [clean up]
> -- extracting... done
> make[2]: *** [CMakeFiles/hiredis.dir/build.make:93: hiredis/src/hiredis-stamp/hiredis-download] Error 1
> make[1]: *** [CMakeFiles/Makefile2:147: CMakeFiles/hiredis.dir/all] Error 2
> make: *** [Makefile:163: all] Error 2
>
> It seems cmake is trying to invoke its internal cmake make files, rather than just run the "make static"
> build command.  How do I just run the the "make static" command directly?
>
> Once again, thanks.
> starkdg
>  
>  
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake