mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
ExternalProject: Allow generator expressions in initial cache options
Use file(GENERATE) to write the initial cache file so that we can evaluate generator expressions. Use a per-config initial cache file name in case the content varies by configuration.
This commit is contained in:
committed by
Brad King
parent
1cf43dcf7c
commit
7bd8cfb813
@@ -113,6 +113,8 @@ Create custom targets to build projects in external trees
|
||||
overcome command line length limits.
|
||||
These arguments are :command:`set` using the ``FORCE`` argument,
|
||||
and therefore cannot be changed by the user.
|
||||
Arguments may use
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
``CMAKE_CACHE_DEFAULT_ARGS <arg>...``
|
||||
Initial default cache arguments, of the form ``-Dvar:string=on``.
|
||||
These arguments are written in a pre-load a script that populates
|
||||
@@ -121,6 +123,8 @@ Create custom targets to build projects in external trees
|
||||
These arguments can be used as default value that will be set if no
|
||||
previous value is found in the cache, and that the user can change
|
||||
later.
|
||||
Arguments may use
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
|
||||
Build step options are:
|
||||
|
||||
@@ -1126,10 +1130,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()
|
||||
|
||||
|
||||
@@ -2054,7 +2055,7 @@ function(_ep_add_configure_command name)
|
||||
get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS)
|
||||
|
||||
if(cmake_cache_args OR cmake_cache_default_args)
|
||||
set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake")
|
||||
set(_ep_cache_args_script "${tmp_dir}/${name}-cache-$<CONFIG>.cmake")
|
||||
if(cmake_cache_args)
|
||||
_ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user