[CMake] Problem when globbing files and using that OUTPUT variable between ADD_CUSTOM_COMMAND commands
Eric Noulard
eric.noulard at gmail.com
Fri Feb 17 08:32:17 EST 2012
2012/2/17 <norulez at me.com>
>
> Is there no way to depend on an other custom command without using extra files?
I don't think there is beside the fact that you can specify dependency
to a target (including custom target) or files using OUTPUT and DEPENDS options.
> It would be nice if i can pass OUTPUT and TARGET to ADD_CUSTOM_COMMAND.
You can (using OUTPUT and DEPENDS) your problem is you don't
know the output of your command **statically**.
> So i here is my problem in a more detail:
> I want to get a list of files from ${CMAKE_RUNTIME_OUTPUT_DIR}/${PROJECT_NAME}.app where all files beginning with ${PROJECT_NAME} would be excluded.
The result of this command is only known at build-time.
At build time the "build tool" (make, Visual Studio, etc...) is
running not CMake,
The objective of add_custom_xxxx is to execute some commands **at
build-time** on behalf
of the build tool how would the build tool handle a CMake variable
while CMake is not even running ???
> After that I want to iterate over that list (foreach) and run ADD_CUSTOM_COMMAND for each file.
> I see here no need for any extra files.
I think you are missing a point.
the "ADD_CUSTOM_COMMAND" processed by CMake when reading
CMakeLists.txt at CMake time
are ***TRANSLATED*** into build tool rules.
I think there is a need of an extra file because it's the only way to
communicate
"build-time" informations between several build tool rules (i.e.
derived from custom command).
The only way around I see would be for you to know ahead of build (at
CMake time)
the list of files you'll be processing.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list