View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014306 | CMake | CMake | public | 2013-07-24 03:45 | 2016-06-10 14:31 | ||||
Reporter | ycollet | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | x86 | OS | Linux | OS Version | |||||
Product Version | CMake 2.8.9 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014306: environment variable set in a add_custom_target is forgotten | ||||||||
Description | Under windows, I set an environment variable and then launch a batch file which displays the value of the environment variable. add_custom_target(test_env_var COMMAND set MYENVVAR=this_is_a_test COMMAND ${CMAKE_SOURCE_DIR}/echo.bat) The variable is correctly displayed. Under linux, I tried to do the same add_custom_target(test_env_var COMMAND export MYENVVAR=this_is_a_test COMMAND ${CMAKE_SOURCE_DIR}/echo.sh) The shell script displays an empty variable. To be able to display the environment variable, I must do like this: add_custom_target(test_env_var COMMAND export MYENVVAR=this_is_a_test && ${CMAKE_SOURCE_DIR}/echo.sh) And then it works. Under linux, it's like a new shell is started each time a COMMAND is met. Under windows, it's like a shell is started at the first COMMAND and the same shell is reused for each COMMAND. | ||||||||
Steps To Reproduce | I added an archive with the test case. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0033595) Brad King (manager) 2013-07-24 13:53 |
This is a platform-specific behavior that CMake does not abstract. There is work here on providing environment support in custom commands: https://github.com/Kitware/CMake/pull/31 [^] Meanwhile you'll have to work around this by setting the environment variable in a script that launches the real process. |
(0042323) Kitware Robot (administrator) 2016-06-10 14:29 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-07-24 03:45 | ycollet | New Issue | |
2013-07-24 03:45 | ycollet | File Added: tmp.zip | |
2013-07-24 13:53 | Brad King | Note Added: 0033595 | |
2013-07-24 13:53 | Brad King | Status | new => backlog |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042323 | |
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 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |