[CMake] recognizing shell in use

Ajay Panyala ajay at csc.lsu.edu
Tue Mar 6 10:27:13 EST 2012


That is because I have a custom target like

ADD_CUSTOM_TARGET(testc ALL
  COMMAND java ${PROJECT_BINARY_DIR}/test.java
  DEPENDS ${PROJECT_BINARY_DIR}/test.java
)

I want to build test.java only if it has been changed.

Since custom targets are always out-of-date, I wanted to have the
command inside the custom target like

COMMAND if( test.java has not been modified ) then java build/test.java; fi

The syntax of *if* differs between different shells. So I wanted to check
for
the shell first and use the appropriate IF syntax.


Thanks
Ajay


On Mon, Mar 5, 2012 at 11:03 PM, Eric Noulard <eric.noulard at gmail.com>wrote:

> 2012/3/6 Ajay Panyala <ajay at csc.lsu.edu>:
> > Hello,
> >
> > Is there anyway that cmake could figure out the shell (bash,csh,..)
> > that is being use when cmake is invoked on the command line ?
>
> May be you can check $ENV{SHELL} ?
> Why would you like to do that?
>
> Usually when using CMake one tries to avoid shell/command interpreter
> dependency??
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120306/632575f2/attachment.htm>


More information about the CMake mailing list