View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015927 | CMake | CMake | public | 2016-01-19 10:07 | 2016-06-10 14:21 | ||||
Reporter | Gehua Yang | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | OS | Windows | OS Version | ||||||
Product Version | CMake 3.4.1 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015927: Escape semicolon ";" in CMake/CTest variables? | ||||||||
Description | My CMake-Controlled private build depends on a couple external libraries. On Windows, the build needs to find the dll files of external libraries in order to run the automated tests. The solution I came up with is to add those folders to the PATH environment variable for the build. Here is what I did in the CTest script (using CMake 3.4.1 for Windows): SET(MYPATH "$ENV{PATH}\;C:\\Gehua\\Code\\tbb\\tbb43_20150611oss\\bin\\intel64\\vc14") # set any extra envionment variables here # a. TBB path is needed to run tests # b. Use the "true" command-line plink for git's ssh use. SET (CTEST_ENVIRONMENT "GIT_SSH=c:\\Program Files (x86)\\PuTTY\\plink.exe" "PATH=${MYPATH}" ) MESSAGE(STATUS "env=${CTEST_ENVIRONMENT}") Here is the output from running the build from the code above: -- env=GIT_SSH=c:\Program Files (x86)\PuTTY\plink.exe;PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;%USERPROFILE%\.dnx\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\IDM Computer Solutions\UltraCompare;C:\Program Files\IDM Computer Solutions\UltraFinder\\;C:\Gehua\Code\tbb\tbb43_20150611oss\bin\intel64\vc14 But this change does NOT work for the tests. The tests failed without execution. I suspected that it still did not find the depending dll files. So I added the following code in a simple test file: std::cout << "env PATH=" << getenv ("PATH") << '\n'; std::cout << "env GIT_SSH=" << getenv ("GIT_SSH") << '\n'; The output is : env PATH=C:\ProgramData\Oracle\Java\javapath env GIT_SSH=c:\Program Files (x86)\PuTTY\plink.exe As one can see, The PATH variable content was truncated at the semicolon mark (";"). It is not surprising outcome as CMake use semicolon as delimiter of list elements. But in this particular case, I am seeking for a way to escape the semicolons so that CMake/CTest treats it as an integral part of the string. Is there a way to do it? | ||||||||
Steps To Reproduce | SET(MYPATH "$ENV{PATH}\;C:\\Gehua\\Code\\tbb\\tbb43_20150611oss\\bin\\intel64\\vc14") # set any extra envionment variables here # a. TBB path is needed to run tests # b. Use the "true" command-line plink for git's ssh use. SET (CTEST_ENVIRONMENT "GIT_SSH=c:\\Program Files (x86)\\PuTTY\\plink.exe" "PATH=${MYPATH}" ) MESSAGE(STATUS "env=${CTEST_ENVIRONMENT}") But the result is: PATH=C:\ProgramData\Oracle\Java\javapath GIT_SSH=c:\Program Files (x86)\PuTTY\plink.exe | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0040259) Brad King (manager) 2016-01-19 10:13 |
The CTEST_ENVIRONMENT setting is an undocumented legacy variable left from early ctest scripts that worked declaratively. For modern ctest scripts you can just set(ENV{PATH} "...") and the environment setting will affect everything after that. |
(0040271) Gehua Yang (reporter) 2016-01-19 15:25 |
Thanks for the info. I will try that. Gary |
(0041281) Kitware Robot (administrator) 2016-06-10 14:21 |
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 |
2016-01-19 10:07 | Gehua Yang | New Issue | |
2016-01-19 10:13 | Brad King | Note Added: 0040259 | |
2016-01-19 15:25 | Gehua Yang | Note Added: 0040271 | |
2016-01-20 10:29 | Brad King | Status | new => resolved |
2016-01-20 10:29 | Brad King | Resolution | open => no change required |
2016-06-10 14:21 | Kitware Robot | Note Added: 0041281 | |
2016-06-10 14:21 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |