[CMake] How to detect & set dependences when build-time(not when cmake)?
持重 金
pjincz at yahoo.com.cn
Thu Dec 8 23:18:36 EST 2011
Hello every one.
Recently, I try to rewrite a large project's building system by using cmake.
I meet a difficult point, how to detect & set dependences when build-time.
I have lot of this requirement, and currently I solve it with some terrible ways. I want some refined ways. For example:
Using precompiled header file.
Cmake do not support pch directly and can not detect a header's dependences as a source file.
I can't set pch's dependences when cmake-time because it's changed frequently and it's dependences is tree structures.
Currently, I create a assistant library-target, it have a cpp file only that includes precompiled header, and then add_custom_command depend it.
So, once assistant library-target build, the precompiled header is recompiled. (How terrible it is.)
Compile qrc file.
If I scan qrc's dependences on cmake-time, and I remove some of file from qrc file after running cmake.Then I got an error, because qrc still depend it.
So, currently I use "configure" command to copy qrc file in order to update qrc's dependences when cmake to check-build-system.
Compile idl file.
Just as previous requirement, idl's dependences is tree structures. In addition I write a script to scan dependences. How can I run this script on build-time.
Currently, I have no ways.
In CMake 2.8's document I see that add_custom_command has an IMPLICIT_DEPENDS but I can't find any more data about it. And I have not found any where use it.
More information about the CMake
mailing list