[CMake] Run compiler through another tool?

David Cole david.cole at kitware.com
Wed Nov 17 06:02:42 EST 2010


On Wed, Nov 17, 2010 at 5:50 AM, Micha Renner <Micha.Renner at t-online.de> wrote:
> Am Mittwoch, den 17.11.2010, 15:07 +0530 schrieb Hariharan:
>> Is it possible to run the compiler and linker through another command,
>> say "time" or a custom script? In other words, I want the compile and
>> link steps to run "<command> gcc" and "<command> ld".
>>
> In this case you have to work with a combination of the CMake commands
> add_custom_command, add_custom_target, add_dependencies.
>
> As an idea: Maybe you can find CMake-projects which work with C#, which
> is currently, as much as I know, not supported by CMake.
> They do pretty much the same, what you want to do. (Of course there are
> principal differences).
>
> Greetings
>
> Micha
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

If your "compiler" is really just a wrapper script around a real
compiler, set the environment variables before running CMake:

export CC=/path/to/script/cc.sh
export CXX=/path/to/script/cxx.sh
cmake ../src

Of course, any calls to the wrapper script should take the args and
pass them along to the real compiler.


HTH,
David


More information about the CMake mailing list