Dear list,
The manual says:
https://cmake.org/cmake/help/latest/command/add_custom_target.html
Reference files and outputs of custom commands created with 
add_custom_command() command calls in the same directory (CMakeLists.txt file). 
They will be brought up to date when the target is built.
Use the add_dependencies() command to add dependencies on other targets.

This is different from what the manual of add_custom_command says, and would be 
surprising for all users who only read the manual of add_custom_command and 
then think they know what the parameter means for add_custom_target.

But on the other hand, when I test with this:
--------------------------------------------------
cmake_minimum_required (VERSION 3.14)
project(dependency_test LANGUAGES)

add_custom_target(T1
                  COMMAND echo T1
                  )
add_custom_target(T2
                  COMMAND echo T2
                  DEPENDS T1
                  )

# cmake -GNinja -B build .
# ninja T2
--------------------------------------------------
Then T1 and T2 are built, so contrary to what the manual says, it seems to work.

Is the manual just outdated (Maybe behavior has changed and only manual for 
add_custom_command has been updated)?
Should it be the same as for add_custom_command, or are there really some 
differences?

Regards,
Sebastian
-- 

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 via email to