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)

Attachment: 0001-ExternalProject_Add-Allow-generator-expressions-in-C.patch
Description: Binary data

-- 

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

Reply via email to