[CMake] Execute command after project generation

Petr Kmoch petr.kmoch at gmail.com
Thu Feb 4 02:04:46 EST 2016


Hi Nicolas.

Last time I asked for something like that, it was rejected:
http://public.kitware.com/Bug/view.php?id=13020

But maybe the stance could change on that? After all, I don't think CMake
would want to cater for every possible postprocessing anyone needs. Perhaps
it could be considered if a big warning "May not be forward compatible" was
attached to it?

Petr

On Fri, Jan 29, 2016 at 8:13 PM, Nicolas Schneider <nioncode at gmail.com>
wrote:

> Is it possible to execute commands after the generation step of the
> project files?
>
> I want to set custom properties in the generated Visual Studio project,
> because it should be built as a driver, which requires a few extra steps.
> These changes should be done automatically by CMake (or a script run
> after project generation) to be in sync between all developers.
>
> I also tried just setting the properties with something like: cmake
> --build . -- /p:FilesToPackage="a;b;c"
>
> But it seems like CMake does not pass the command as raw string, because
> msbuild complains about non-existing property, like it does when called
> directly without quotes: msbuild project /p:FilesToPackage=a;b;c
> which would treat 'b' as a property key instead of part of the value for
> FilesToPackage.
>
> The only workaround, currently, is to use:
> cmake ..
> modifyProjects.py
> cmake --build .
>
> However, I assume this does not work correctly if CMake regenerates the
> project files because of changes in CMakeLists (because
> modifyProjects.py will not be called automatically by CMake), correct?
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160204/b56b32d9/attachment.html>


More information about the CMake mailing list