[CMake] add_custom_command and generated true
Micha Renner
Micha.Renner at t-online.de
Tue Jan 25 04:17:02 EST 2011
Recently, I learned that ADD_CUSTOM_COMMAND generated the property
GENERATED TRUE for the generated file.
Somehow I have trouble in this situation:
In a top level CMakeLists file a source file, blue.c, is generated. This
file should be used in a subdirectory with its own CMakeLists file.
Running CMake generates the message: "cannot find blue.c etc..."
Okay, the information, that this is a generated sourcefile is, maybe,
lost on the transition to the subdirectory.
So, I inserted in the CMakeLists file of subdirectory the line:
SET_SOURCE_FILES_PROPERTIES(blue.c PROPERTIES GENERATED TRUE)
which generates the make message
No rule to build target subdirectory/blue.c
I changed the inserted line (see above) to...
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/blue.c
PROPERTIES GENERATED TRUE)
... which is okay.
=> Two question
- Is it general true, that properties are lost on transition to a
subdirectory?
- In which cases is it absolute necessary to work with absolute paths
and SET_SOURCE_FILES?
In the appendix is a small example (Unix only)
Greetings
Micha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeQuest.tar.gz
Type: application/x-compressed-tar
Size: 678 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110125/98609bfb/attachment.bin>
More information about the CMake
mailing list