[cmake-developers] [CMake 0015233]: is there a way to force the use of bash for command execution?

Mantis Bug Tracker mantis at public.kitware.com
Tue Nov 4 10:11:58 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15233 
====================================================================== 
Reported By:                Bill Torpey
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15233
Category:                   CMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-11-04 10:11 EST
Last Modified:              2014-11-04 10:11 EST
====================================================================== 
Summary:                    is there a way to force the use of bash for command
execution?
Description: 
Under Linux, cmake runs external commands (e.g., specified in
add_custom_command) using sh.  While sh resolves to bash, when invoked as sh
bash does not support many features.

In particular, we need to:
- Specify LD_LIBRARY_PATH for a custom command (since it is being built as part
of the build process, with a non-standard compiler)
- Specify ASAN_OPTIONS (since the custom commmand is being built w/clang+asan)
to force it to return a zero return code.

The natural way to do this is to prefix the custom command:

LD_LIBRARY_PATH=... ASAN_OPTIONS=... command

While this is perfectly legal bash, sh fails with "No such file or directory"

It's possible to wrap the command in a shell script and execute that, but it
would be much cleaner to specify the command directly in the CMakeLists.txt
file.

FWIW, we don't care about portability -- our application is strictly Linux
x86_64 -- we just use CMake as a superior alternative to autotools.


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-11-04 10:11 Bill Torpey    New Issue                                    
======================================================================



More information about the cmake-developers mailing list