I am using an external tool during one phase of the build that requires a file with some data in it. Some of it is working fine. I can give it the C compiler, ar, ranlib. Where I am having trouble is writing out some command lines to this file. For instance I need to give it a partial compilation statement where the external tool can add its own object and source file.
An example of that might be:
CMD=i686-pc-linux-gnu-gcc --sysroot=path/so/sys/root -pthread -Xlinker --fatal-warnings -Xlinker --no-warn-execstack -shared -Wl,-soname=
CMake is currently aware of this kind of information via the toolchain file and will build using bits and pieces like this, but I am struggling to get the information written out.
In my most recent attempt I’ve trying file(CONFIGURE ..) followed by file(GENERATE ..), where the CONFIGURE is generating a .tmp file and GENERATE is taking that as an input to create the final file. But the content of the .tmp and final file end up being identical. I tried with and without the “@ONLY” on the configure but that doesn’t seem to make a difference here.
I tried passing in something like CMD=${CMAKE_C_LINK_EXECUTABLE} ${CMAKE_C_LINKER_FLAGS} in an attempt to get the above line but instead I end up with:
CMD=<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>
I understand ${variables}, I have a looser understanding of $ and I’m lost with . I’m not even confident how to mechanically search for this distinction!
My goal is to have something in place to create this file for 3rd party consumption without needing to hard-code solutions for different toolchains. I’m not above some amount of manipulation steps if some things just need to get removed.
Thanks for any advice on how to proceed!