Date & Time Dynamic Build Variable #20
-
Is this the right place to post something..? I just went to the CDT forums and read about the migration to GitHub. What I am trying to do is define a few dynamic command line arguments that get input into the link command once the compilation step has completed successfully. So essentially instead of defining a linker argument statically like -config_file={workspace....}, it would be something like -define=${date_time} where date_time resolves to the host machine date and time every time the link step runs. The linker then takes this command line argument into the configuration file to fill in a variable value somewhere else in the code. I am aware of the __ DATE __ and __ TIME __ type stuff that you can put within the code, but please don't miss understand. We only need / want the date & time to be put into the binary upon an actual change and successful build. We are not interested in touching a source file every time we press the build button in order to trigger a build. If this functionality is already present and I just don't know the syntax, or if it's a planned feature in the future, one caveat is that we may require a very custom date and time format. I think there is another way to achieve what we want that requires no CDT changes, but research seems to turn up blank with regards to CDT. I cannot seem to figure out what command interpreter is used within eclipse when it runs the build steps for compilation, linking, etc.. It seems it would be possible to run a nested command within the arguments of the command line and a tiny custom command line program that just spits out the host's current date and time in our desired format.. Essentially piping the output of one program into the command line of the link step. In this way we could just define a linker variable such as: -define t=(time_prog). I am not a command line expert on windows / unix. So what command line interpreter is being used within eclipse and is it possible to set it to bash or windows (batch)? Is it an agnostic interpreter? If so, what capabilities / options do I have for running a nested program within the link build step command? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
👍 Yes it is, but it is all new to us too and we are still transitioning and haven't officially announced the move. Welcome and congratulations on being the first to ask a question here.
There is some functionality like this present by implementing the org.eclipse.core.variables.dynamicVariables extension point (but knowing the vastness of Eclipse there may be other ways too).
The command interpreter is determined by make (assuming you are using a generated Makefile). If you are using the internal builder (i.e. no makefiles) then there is no command interpreter involved. Therefore the command intepreter depends on the machine you are running on (generally /bin/sh on Linux and cmd on windows). See make manual for more details. If you are using generated makefiles, you may be able to force a specific shell by creating a |
Beta Was this translation helpful? Give feedback.
👍 Yes it is, but it is all new to us too and we are still transitioning and haven't officially announced the move. Welcome and congratulations on being the first to ask a question here.
There is some functionality like this present by implementing the org.eclipse.core.variables.dynamicVariables extension point (but knowing the vastness of Eclipse there may be other ways too).