Notes |
|
(0037152)
|
Guillaume Papin
|
2014-11-04 10:19
|
|
This doesn't answer your request but can't you just call 'env'?
env LD_LIBRARY_PATH=... ASAN_OPTIONS=... command |
|
|
(0037153)
|
Marcel Loose
|
2014-11-04 10:39
|
|
Prefixing the command like you described is also perfectly legal in sh. So, there must be something else going wrong. |
|
|
(0037154)
|
Bill Torpey
|
2014-11-04 11:14
|
|
Guillaume: With your suggestion the command runs, but the env variables are not in effect.
Marcel: Quite right! Fiddled with it some more and managed to get it going by changing around quoting.
Thanks!
Still: it would be helpful some times to force bash instead of sh -- they're not the same! |
|
|
(0037156)
|
Brad King
|
2014-11-04 11:27
|
|
For reference, the code in CMake that tells the Makefile what shell to use is here:
http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalUnixMakefileGenerator3.cxx;hb=v3.0.2#l687 [^]
However, that is only relevant to the Makefile generators. A custom command specified by the project should also be able to work with the other generators for which the shell cannot be selected.
If you really want to run a bash script, then write one and run the file with bash:
add_custom_command(... COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/myscript.bash ...)
Also note that CMake 3.1 introduces "cmake -E env" as a cross-platform version of the POSIX "env" tool. |
|
|
(0038592)
|
Bill Torpey
|
2015-04-23 18:31
|
|
Just an FYI -- we've taken the approach of writing a "link.sh" shell script and invoking that in the build (by setting new values for CMAKE_CXX_LINK_EXECUTABLE and CMAKE_CXX_CREATE_SHARED_LIBRARY).
(BTW, the purpose of this exercise is to unset LD_LIBRARY_PATH before calling the linker to ensure that only directories explicitly specified in the link command are searched).
That works, but it would be much cleaner if cmake would honor the value already set for SHELL, which in my environment is /bin/bash). |
|
|
(0042657)
|
Kitware Robot
|
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. |
|