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
That's the wrong way to go about things. Rather than putting the COMMAND
in the custom target, put it in a add_custom_command() call and make the
custom target DEPENDS on it. Then you let the build system handle the
dependencies. E.g. like this:
find_program(JAVAC_COMPILER javac PATH_SUFFIXES bin
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.class
COMMAND ${JAVAC_COMPILER} -d ${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/test.java
DEPENDS ${PROJECT_BINARY_DIR}/test.java
COMMENT Compiling test.java
VERBATIM)
add_custom_target(compile-test-java
DEPENDS
On Tue, Mar 6, 2012 at 1:22 PM, Ajay Panyala a...@csc.lsu.edu wrote:
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.class
COMMAND ${JAVAC_COMPILER} -d ${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/test.java
DEPENDS ${PROJECT_BINARY_DIR}/test.java
COMMENT Compiling test.java
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 ?
Thanks
Ajay
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep
2012/3/6 Ajay Panyala a...@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