file dependency not working in external projects

classic Classic list List threaded Threaded
3 messages Options
Hex
Reply | Threaded
Open this post in threaded view
|

file dependency not working in external projects

Hex
hello,

I have a problem with a build step.

The following command is run every time somefile changes:

add_custom_command( OUTPUT out.put
     COMMAND touch out.put
     DEPENDS somefile.txt
)

add_custom_target( sometarget DEPENDS out.put )


I move this snippet inside an external project (with
ExternalProject_Add) and the custom command is only run once at build.

I am using absolute path to somefile, the command is not rebuild
changing somefile.

I am using Gnu make generator and build with make all


What am I missing?

--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: file dependency not working in external projects

Eric Dönges

You're probably missing the BUILD_ALWAYS option to ExternalProject_Add:

BUILD_ALWAYS <bool>
Enabling this option forces the build step to always be run. This can be the easiest way to robustly ensure that the external project’s own build dependencies are evaluated rather than relying on the default success timestamp-based method. This option is not normally needed unless developers are expected to modify something the external project’s build depends on in a way that is not detectable via the step target dependencies (e.g. SOURCE_DIR is used without a download method and developers might modify the sources in SOURCE_DIR).

Am 24.09.19 um 15:23 schrieb hex:
hello,

I have a problem with a build step.

The following command is run every time somefile changes:

add_custom_command( OUTPUT out.put
    COMMAND touch out.put
    DEPENDS somefile.txt
)

add_custom_target( sometarget DEPENDS out.put )


I move this snippet inside an external project (with ExternalProject_Add) and the custom command is only run once at build.

I am using absolute path to somefile, the command is not rebuild changing somefile.

I am using Gnu make generator and build with make all


What am I missing?

--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

 

MVTec Software GmbH Logo

--

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:
https://cmake.org/mailman/listinfo/cmake
Hex
Reply | Threaded
Open this post in threaded view
|

Re: file dependency not working in external projects

Hex
In reply to this post by Hex

hello Eric Doenges,

You are correct. This has been given me headaches.

Setting BUILD_ALWAYS to TRUE gives the desired behaviour.


Thank you


On 24/09/2019 14:59, Eric Doenges wrote:

You're probably missing the BUILD_ALWAYS option to ExternalProject_Add:

BUILD_ALWAYS <bool>
Enabling this option forces the build step to always be run. This can be the easiest way to robustly ensure that the external project’s own build dependencies are evaluated rather than relying on the default success timestamp-based method. This option is not normally needed unless developers are expected to modify something the external project’s build depends on in a way that is not detectable via the step target dependencies (e.g. SOURCE_DIR is used without a download method and developers might modify the sources in SOURCE_DIR).
Am 24.09.19 um 15:23 schrieb hex:
hello,

I have a problem with a build step.

The following command is run every time somefile changes:

add_custom_command( OUTPUT out.put
    COMMAND touch out.put
    DEPENDS somefile.txt
)

add_custom_target( sometarget DEPENDS out.put )


I move this snippet inside an external project (with ExternalProject_Add) and the custom command is only run once at build.

I am using absolute path to somefile, the command is not rebuild changing somefile.

I am using Gnu make generator and build with make all


What am I missing?

--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

 

MVTec Software GmbH Logo


--

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:
https://cmake.org/mailman/listinfo/cmake