[cmake-developers] [PATCH] ExternalProject_Add: Allow generator expressions in CMAKE_CACHE_ARGS
Andrey Pokrovskiy
wonder.mice at gmail.com
Fri Apr 17 12:27:25 EDT 2015
> does the external project's configure step re-run when you edit only the CMAKE_CACHE_ARGS for it?
Yes. Verified with the following example:
----
cmake_minimum_required(VERSION 3.2)
project(CMakeExternalProjectGenExpr)
include(ExternalProject)
set(ZF_QUEUE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/zf_queue.install")
ExternalProject_Add(zf_queue_ep
GIT_REPOSITORY https://github.com/wonder-mice/zf_queue.git
UPDATE_COMMAND ""
INSTALL_DIR ${ZF_QUEUE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>)
On Fri, Apr 17, 2015 at 4:19 AM, David Cole <DLRdave at aol.com> wrote:
> With this change, does the external project's configure step re-run
> when you edit only the CMAKE_CACHE_ARGS for it?
>
> (It did with the *.in / configure_file approach...)
>
>
> On Fri, Apr 17, 2015 at 12:55 AM, Andrey Pokrovskiy
> <wonder.mice at gmail.com> wrote:
>> In current implementation of ExternalProject_Add generator expressions
>> are supported in CMAKE_ARGS (probably by coincidence), but not in
>> CMAKE_CACHE_ARGS. This patch will enable generators expressions in
>> CMAKE_CACHE_ARGS.
>>
>> Use case:
>> set(LIBEV_LIBRARIES $<TARGET_FILE:ev>)
>> ExternalProject_Add(
>> ...
>> CMAKE_CACHE_ARGS
>> -DLIBEV_LIBRARIES=${LIBEV_LIBRARIES}
>> ...)
>>
>> ---
>> Modules/ExternalProject.cmake | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
>> index 0c73d41..1c7cf51 100644
>> --- a/Modules/ExternalProject.cmake
>> +++ b/Modules/ExternalProject.cmake
>> @@ -1126,10 +1126,7 @@ function(_ep_write_initial_cache target_name
>> script_filename script_initial_cach
>> # Replace location tags.
>> _ep_replace_location_tags(${target_name} script_initial_cache)
>> # Write out the initial cache file to the location specified.
>> - if(NOT EXISTS "${script_filename}.in")
>> - file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n")
>> - endif()
>> - configure_file("${script_filename}.in" "${script_filename}")
>> + file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_initial_cache}")
>> endfunction()
>>
>>
>> --
>> 2.3.2 (Apple Git-55)
>>
>> --
>>
>> 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:
>> http://public.kitware.com/mailman/listinfo/cmake-developers
More information about the cmake-developers
mailing list