[cmake-developers] Race between ADD_CUSTOM_COMMAND()

Oleh Kravchenko oleg at kaa.org.ua
Wed Jul 4 12:52:23 EDT 2018


Hello CMake Developers!

Looks like I found interesting bug in CMake:
- ADD_CUSTOM_TARGET() always creates Makefile rule for ADD_CUSTOM_COMMAND().
- As result build simetimes failed if specified -jN for make.

Please find attached simple project which reproduce the problem.

> [ 12%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [ 25%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [ 37%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [ 50%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [ 62%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [ 75%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [ 87%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> [100%] Generate /home/kaa/cmake_add_custom_command-target/build/config
> CMake Error at
/home/kaa/cmake_add_custom_command-target/cmake/config.cmake:3
(CONFIGURE_FILE):
>   CONFIGURE_FILE Problem configuring file
>
> make[2]: *** [CMakeFiles/config2.dir/build.make:61: config] Error 1
> make[2]: *** Deleting file 'config'
> CMake Error at
/home/kaa/cmake_add_custom_command-target/cmake/config.cmake:3
(CONFIGURE_FILE):
>   CONFIGURE_FILE Problem configuring file
>
> make[2]: *** [CMakeFiles/config5.dir/build.make:61: config] Error 1
> make[2]: *** Deleting file 'config'
> make[1]: *** [CMakeFiles/Makefile2:216: CMakeFiles/config5.dir/all]
Error 2
> make[1]: *** Waiting for unfinished jobs....
> make[1]: *** [CMakeFiles/Makefile2:253: CMakeFiles/config2.dir/all]
Error 2
> [100%] Built target config1
> [100%] Built target config4
> [100%] Built target config7
> [100%] Built target config6
> CMake Error at
/home/kaa/cmake_add_custom_command-target/cmake/config.cmake:3
(CONFIGURE_FILE):
>   CONFIGURE_FILE Problem configuring file
>
> CMake Error at
/home/kaa/cmake_add_custom_command-target/cmake/config.cmake:3
(CONFIGURE_FILE):
>   CONFIGURE_FILE Problem configuring file
>
> make[2]: *** [CMakeFiles/config0.dir/build.make:61: config] Error 1
> make[2]: *** Deleting file 'config'
> make[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/config0.dir/all]
Error 2
> make[2]: *** [CMakeFiles/config3.dir/build.make:61: config] Error 1
> make[1]: *** [CMakeFiles/Makefile2:327: CMakeFiles/config3.dir/all]
Error 2
> make: *** [Makefile:84: all] Error 2

--

Best regards,
Oleh Kravchenko

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_add_custom_command-target.tar.bz2
Type: application/x-bzip
Size: 34462 bytes
Desc: not available
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20180704/76714699/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20180704/76714699/attachment-0001.sig>


More information about the cmake-developers mailing list