[CMake] ADD_CUSTOM_COMMAND and unix makefile generator
Ian.Appru at ubs.com
Ian.Appru at ubs.com
Fri Feb 10 13:06:51 EST 2006
The solution use suggested does not quite work since the java compile
kicks off before swig has had a chance to generate the java files.
However I did come up with a working soln.
The key is to tie the java compile target to a fake cxx file - see below
SET(DUMMY_CXX_FILE
"${BUILD_DIR}/delete-me-to-force-java-rebuild.cxx")
ADD_CUSTOM_COMMAND(
OUTPUT "${DUMMY_CXX_FILE}"
COMMAND "echo"
ARGS "\"//**dummy**file**\""
">"
"${DUMMY_CXX_FILE}"
"&&"
"cd"
"${BUILD_DIR}"
"&&"
"make"
"compile-java"
COMMENT "Generate a dummy file and kick of java builds")
SWIG_ADD_MODULE( ${SWIG_PROJECT_NAME} ${SWIG_GEN_TYPE}
${PHI_ALL_SWIG_IFILES}
${DUMMY_CXX_FILE})
- Ian
-----Original Message-----
From: William A. Hoffman [mailto:billlist at nycap.rr.com]
Sent: 08 February 2006 18:30
To: Appru, Ian; cmake at cmake.org
Subject: Re: [CMake] ADD_CUSTOM_COMMAND and unix makefile generator
At 12:19 PM 2/8/2006, Ian.Appru at ubs.com wrote:
>I am trying to get ADD_CUSTOM_COMMAND to execute before a build - ie
>using PRE_BUILD variable - with the unix makefile generator.
>
>This is so that I can get java to compile swig generated java files
>before the cxx generated files are compiled.
> - Its quite a large project with a long build time and errors are
>generally in the java layer.
>
>However this doesn't seem to work - nothing is added to the makefile.
>I am using a copy of cmake from cvs - about a week old.
>
>I looked at changing the SWIG_ADD_MODULE macro, but I think the change
>is required in cxx.
>
>Are there any work-arounds?
>Or failing that I'm not averse to putting together a code patch - so
>hints would be apreciated.
>
>Regards
>Ian
It is not possible to do PRE_BUILD with makefiles.
We have tried there is some discussion on the list:
http://www.cmake.org/pipermail/cmake/2004-April/004983.html
It may be possible to do what you want in a different way.
If you make the cxx library depend on the java target then, it should
build the jave target first.
-Bill
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
More information about the CMake
mailing list