Revision 812989
Go back to digest for 1st June 2008Bug Fixes in KDE Base
Fixed CMakeLists.txt to generally properly generate the io code files. If no java is present, then the pregenerated files from svn are copied to the build directory to be used.
Tips from Alexander Neundorf:
I just tried to build kdesupport out-of-source on a MacBook.
It failed in strigi/src/xsd/ because it couldn't find metadataproperties.cpp
I had a look at the cmake file and found a few things, see the attached patch.
In general, while it may save some typing, getting input file via GLOB is no good idea. They will only be picked up when cmake runs again (which doesn't happen by just adding the file in the directory), and at that point in time there might be other files around which are then
also found.
There was a
if(JAVA_COMPILE AND ... IS_NEWER_THAN ...)
...
ADD_CUSTOM_COMMAND(...)
This doesn't seem to make a lot of sense. If at cmake time some file is newer than another one, a rule is added which depends on this newer file.
This means this rule will not exist if that condition wasn't true at cmake time. I removed that second part of the if so the rule now always exists and is executed if required.
If you want it purely at cmake time than the test with the IS_NEWER_THAN is ok, but then you probably want to run the command via EXECUTE_PROCESS (which is also done at cmake time), not via ADD_CUSTOM_COMMAND (which will be executed at build time).
Then the files were generated into the source directory. In general files which are generated should always go in the build dir, so that removing the build dir really removes everything. I modified the CMakeLists.txt accordingly.
Then I noticed that these generated files are actually in svn. Why?
If this is the case and if that has to be, then generating the files into the source dir is probably ok, but I have the feeling that it should be done at cmake time then, not at build time.
To get the dependencies right, it is usually a good idea to use the full path to files in custom commands, I did that.
Also I replaced the STRING(REPLACE) with GET_FILENAME_COMPONENT(), which does just what you want.
File Changes
- /trunk/kdesupport/strigi/src/xsd/CMakeLists.txt