View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015287CMakeCMakepublic2014-12-07 17:172015-11-02 09:13
ReporterZachary Sims 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015287: ExternalProject commands do not support generator expressions
DescriptionExternalProject_* does not support generator expressions. For projects such as boost, "variant" can be set to debug or release. However, ${CONFIG} will be either Debug or Release (note case).


Example being:
ExternalProject_Add(
    boost
    DOWNLOAD_COMMAND snip
    SOURCE_DIR # snip
    BUILD_IN_SOURCE 1
    UPDATE_COMMAND ""
    PATCH_COMMAND ""
    CONFIGURE_COMMAND ${BOOST_BOOTSTRAP_COMMAND}
    BUILD_COMMAND
        b2 variant=$<LOWER_CASE:$<CONFIG>>
    INSTALL_COMMAND ""
    LOG_DOWNLOAD 1
    LOG_CONFIGURE 1
    LOG_BUILD 1
)

It's true the generator expressions might not always be sufficient, but would certainly help.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0037402)
Brad King (manager)
2014-12-08 08:44

The _COMMAND options just map to add_custom_command underneath, and that supports generator expressions. I just tried an example and it works for me.

Can you post a non-snipped example where it does not work?
(0037420)
Zachary Sims (reporter)
2014-12-08 16:59

Forgive my somewhat rash jump to conclusions. Reading the source to ExternalProject.cmake I thought that it always wrote the build steps to a .cmake file.

However, upon further digging... generator expressions are not supported if LOG_BUILD is set, as externalproject will wrap the command in an execute_process to log the output.

A short, standalone way to reproduce the bug:

cmake_minimum_required(VERSION 3.0)

project(generator_expressions_ep)
include(ExternalProject)

externalproject_add(
    otherproject
    SOURCE_DIR .
    BUILD_IN_SOURCE 1
    BUILD_COMMAND ${CMAKE_COMMAND} -E echo $<LOWER_CASE:$<CONFIG>>
    INSTALL_COMMAND ""
    LOG_BUILD 1
)

Note that removing LOG_BUILD 1 means the generator expression will be evaluated, otherwise it's not.
(0037425)
Brad King (manager)
2014-12-09 08:24

Re 0015287:0037420: Good catch. This would have not been possible to solve at the time this infrastructure was first written, but now we have file(GENERATE) which may make this possible.

Please look at converting the file(WRITE) calls in _ep_write_log_script to file(GENERATE) calls. To work in multi-config generators a loop over CMAKE_CONFIGURATION_TYPES and a separate script per configuration will be needed. The custom command used to launch the script with cmake -P will also need a generator expression to determine which script to run based on $<CONFIG>.
(0038573)
Brad King (manager)
2015-04-21 11:02

Fixed and test case added:

 ExternalProject: Allow generator expressions with LOG_* options
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0273ef14 [^]
(0039785)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-12-07 17:17 Zachary Sims New Issue
2014-12-08 08:44 Brad King Note Added: 0037402
2014-12-08 16:59 Zachary Sims Note Added: 0037420
2014-12-09 08:24 Brad King Note Added: 0037425
2015-04-21 11:02 Brad King Note Added: 0038573
2015-04-21 11:02 Brad King Status new => resolved
2015-04-21 11:02 Brad King Resolution open => fixed
2015-04-21 11:02 Brad King Fixed in Version => CMake 3.3
2015-04-21 11:02 Brad King Target Version => CMake 3.3
2015-11-02 09:13 Robert Maynard Note Added: 0039785
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team