diff options
author | Andrey Pokrovskiy <pokroa@amazon.com> | 2015-04-21 06:28:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-21 14:51:08 (GMT) |
commit | 0273ef146972e0fbfbf399e468ae9d5f2b4bb3d3 (patch) | |
tree | dce385a51cfe0fa127fe13dc6f210af23dfdbc27 /Modules/ExternalProject.cmake | |
parent | 7bd8cfb813e9bd19cebda92b280beb2deaf052d4 (diff) | |
download | CMake-0273ef146972e0fbfbf399e468ae9d5f2b4bb3d3.zip CMake-0273ef146972e0fbfbf399e468ae9d5f2b4bb3d3.tar.gz CMake-0273ef146972e0fbfbf399e468ae9d5f2b4bb3d3.tar.bz2 |
ExternalProject: Allow generator expressions with LOG_* options (#15287)
Use file(GENERATE) to write the logging wrapper scripts to evaluate
generator expressions. Use a per-config script names in case the
content varies by configuration.
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d916270..d9b6842 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -106,6 +106,8 @@ Create custom targets to build projects in external trees :manual:`CMake Options <cmake(1)>`. Arguments in the form ``-Dvar:string=on`` are always passed to the command line, and therefore cannot be changed by the user. + Arguments may use + :manual:`generator expressions <cmake-generator-expressions(7)>`. ``CMAKE_CACHE_ARGS <arg>...`` Initial cache arguments, of the form ``-Dvar:string=on``. These arguments are written in a pre-load a script that populates @@ -271,6 +273,9 @@ specifies to run ``make`` and then ``echo done`` during the build step. Whether the current working directory is preserved between commands is not defined. Behavior of shell operators like ``&&`` is not defined. +Arguments to ``<step>_COMMAND`` or ``COMMAND`` options may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. + .. command:: ExternalProject_Get_Property The ``ExternalProject_Get_Property`` function retrieves external project @@ -1303,14 +1308,14 @@ endif() endif() endforeach() set(code "${code}set(command \"${cmd}\")${code_execute_process}") - file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake "${code}") - set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-impl.cmake) + file(GENERATE OUTPUT "${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake" CONTENT "${code}") + set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake) endif() # Wrap the command in a script to log output to files. - set(script ${stamp_dir}/${name}-${step}.cmake) + set(script ${stamp_dir}/${name}-${step}-$<CONFIG>.cmake) set(logbase ${stamp_dir}/${name}-${step}) - file(WRITE ${script} " + set(code " ${code_cygpath_make} set(command \"${command}\") execute_process( @@ -1331,6 +1336,7 @@ else() message(STATUS \"\${msg}\") endif() ") + file(GENERATE OUTPUT "${script}" CONTENT "${code}") set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script}) set(${cmd_var} "${command}" PARENT_SCOPE) endfunction() |