Yes, the CMAKE_CURRENT_BINARY_DIR is the same as PROJECT_BINARY_DIR.
It works for me now. The depends file (test.java) is actually copied over
to the build directory
before compiling it (the copy command was not shown in the previous email).
I changed
DEPENDS ${PROJECT_BINARY_DIR}/test.java
to
On Tue, Mar 6, 2012 at 1:22 PM, Ajay Panyala 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"
> VERBATIM)
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 ${PROJECT_BINARY
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
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 insi
2012/3/6 Ajay Panyala :
> 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 inte
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 messages