MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015112 | CMake | CMake | public | 2014-08-26 17:35 | 2015-03-02 08:57 |
Reporter | Javier Martinez | ||||
Assigned To | Brad King | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Windows | OS | Windows | OS Version | Win7-64 |
Product Version | CMake 3.0.1 | ||||
Target Version | CMake 3.1 | Fixed in Version | CMake 3.1 | ||
Summary | 0015112: add_custom_command: Clarify documented relationship of multiple COMMANDs | ||||
Description | CMake generates incorrect commands in a custom build step causing builds to fail. The attached example exposes two issues: - CMake inserts spaces around the statement in parenthesis which changes the variable value. In the attached example the CONF variable value is "Release " instead of "Release" Expected: if '$(Configuration)'=='Release-Internal' set (CONF=Release) Actual: if '$(Configuration)'=='Release-Internal' set ( CONF=Release ) Workaround: if there's no else clause the w/a is to not use parenthesis - If the content of a variable is used at the beginning of a command CMake will wrap it in additional percent (%) characters making the command invalid. Expected: %CMDLINE% Actual: %%CMDLINE%% Workaround: use conditional expressions to avoid the variable be at the beginning, for example ECHO "Running command" && %CMDLINE% | ||||
Steps To Reproduce | cmake_minimum_required(VERSION 3.0) add_custom_target(Test ) add_custom_command( TARGET Test PRE_BUILD COMMAND set CONF=$(Configuration) COMMAND if '$(Configuration)'=='Release-Internal' set (CONF=Release) COMMAND set BUNDLE_FOLDER=Prebuilt/Windows/%CONF%/$(PlatformArchitecture) COMMAND set CMDLINE=7z.exe x -y %BUNDLE_FOLDER%/bundle.7z -o%BUNDLE_FOLDER% COMMAND echo %CMDLINE% COMMAND %CMDLINE% COMMENT "Extracting Bundle (failed)" ) add_custom_command( TARGET Test POST_BUILD COMMAND set CONF=$(Configuration) COMMAND if '$(Configuration)'=='Release-Internal' set CONF=Release COMMAND set BUNDLE_FOLDER=Prebuilt/Windows/%CONF%/$(PlatformArchitecture) COMMAND set CMDLINE=7z.exe x -y %BUNDLE_FOLDER%/bundle.7z -o%BUNDLE_FOLDER% COMMAND echo %CMDLINE% && %CMDLINE% COMMENT "Extracting Bundle (succeed)" ) | ||||
Additional Information | Command line to reproduce: cmake.exe CMakeLists.txt -G"Visual Studio 12" -B"CMakeOutput" | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | ![]() https://public.kitware.com/Bug/file/5235/CMakeLists.txt | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2014-08-26 17:35 | Javier Martinez | New Issue | |||
2014-08-26 17:35 | Javier Martinez | File Added: CMakeLists.txt | |||
2014-08-27 07:51 | David Cole | Note Added: 0036679 | |||
2014-08-27 07:58 | David Cole | Summary | Incorrect commands generated on bustom build step for Visual Studio => Incorrect commands generated on custom build step for Visual Studio | ||
2014-08-27 09:34 | Brad King | Note Added: 0036682 | |||
2014-08-28 17:01 | Javier Martinez | Note Added: 0036689 | |||
2014-09-02 15:15 | Brad King | Summary | Incorrect commands generated on custom build step for Visual Studio => add_custom_command: Clarify documented relationship of multiple COMMANDs | ||
2014-09-02 15:15 | Brad King | Note Added: 0036702 | |||
2014-09-04 09:44 | Brad King | Assigned To | => Brad King | ||
2014-09-04 09:44 | Brad King | Status | new => resolved | ||
2014-09-04 09:44 | Brad King | Resolution | open => fixed | ||
2014-09-04 09:44 | Brad King | Fixed in Version | => CMake 3.1 | ||
2014-09-04 09:44 | Brad King | Target Version | => CMake 3.1 | ||
2014-09-08 14:06 | Javier Martinez | Note Added: 0036748 | |||
2014-09-08 14:06 | Javier Martinez | Status | resolved => feedback | ||
2014-09-08 14:06 | Javier Martinez | Resolution | fixed => reopened | ||
2014-09-08 14:16 | Brad King | Note Added: 0036749 | |||
2014-09-08 14:17 | Brad King | Status | feedback => assigned | ||
2014-09-08 14:17 | Brad King | Resolution | reopened => open | ||
2014-09-11 13:03 | Brad King | Status | assigned => resolved | ||
2014-09-11 13:03 | Brad King | Resolution | open => fixed | ||
2015-03-02 08:57 | Robert Maynard | Note Added: 0038114 | |||
2015-03-02 08:57 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|