MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0015935 | CMake | CMake | public | 2016-01-26 05:32 | 2016-06-10 14:31 |
| Reporter | Kiron | ||||
| Assigned To | Kitware Robot | ||||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Summary | 0015935: Custom command post-genex ;-list expansion | ||||
| Description | When an $<0:...> generator expression in a COMMAND argument of add_custom_command (and add_custom_target) the Visual Studio generator generates an invalid command "". When using a normal variable which is empty or not set, the COMMAND argument is just ignored. | ||||
| Steps To Reproduce | Create a file called CMakeLists.txt with the following content in an empty directory: cmake_minimum_required(VERSION 3.0 FATAL_ERROR) cmake_policy(VERSION 3.0) project(EmptyGenExCommand LANGUAGES CXX VERSION 0.0.1.0) set(_stamp ${CMAKE_BINARY_DIR}/foo.stamp) add_custom_command(OUTPUT ${_stamp} COMMAND $<$<BOOL:$<TARGET_PROPERTY:foo,FOOCMD>>:$<TARGET_PROPERTY:foo,FOOCMD>> COMMAND ${CMAKE_COMMAND} -E echo foo is done WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) add_custom_target(foo ALL DEPENDS ${_stamp}) #set_property(TARGET foo PROPERTY FOOCMD ${CMAKE_COMMAND} -E sleep 1) | ||||
| Additional Information | Tested with cmake version 3.4.3 under Windows 7 64 bit. When using the Visual Studio generator the vcxproj contains: <ItemGroup> <CustomBuild Include="..."> [...] <Command ...>setlocal cd S:\abc if %errorlevel% neq 0 goto :cmEnd S: if %errorlevel% neq 0 goto :cmEnd "" if %errorlevel% neq 0 goto :cmEnd When trying to execute "" the following error from cmd.exe is generated: '""' is not recognized as an internal or external command, operable program or batch file. Also when setting the FOOCMD property to an actual command (e.g.: set_property(TARGET foo PROPERTY FOOCMD ${CMAKE_COMMAND} -E sleep 1)) it will not work, since it evaluates to "C:\Program Files (x86)\CMake\bin\cmake.exe";"-E";"sleep";"1" or with quotes in the set_property command it evaluates to "C:\Program Files (x86)\CMake\bin\cmake.exe -E sleep 1". | ||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2016-01-26 05:32 | Kiron | New Issue | |||
| 2016-01-26 10:15 | Brad King | Note Added: 0040328 | |||
| 2016-01-26 10:16 | Brad King | Severity | minor => feature | ||
| 2016-01-26 10:16 | Brad King | Status | new => backlog | ||
| 2016-01-26 10:16 | Brad King | Summary | Empty generator expression in COMMAND leads to "" => Custom command post-genex ;-list expansion | ||
| 2016-06-10 14:29 | Kitware Robot | Note Added: 0042922 | |||
| 2016-06-10 14:29 | Kitware Robot | Status | backlog => resolved | ||
| 2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
| 2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
| 2016-06-10 14:31 | Kitware Robot | Status | resolved => closed | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||