Hi, We were testing CMake3.0-rc3 and observed the following problem with policy CMP0046: - even when policy is set to NEW behaviour, it warns about not setting policy (upon finding a missing dependency).
It is currently warning:
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
The dependency target "missingtarget" of target "ctarget2" does not exist.
When in fact it should just warn about the missing target:
The dependency target "missingtarget" of target "ctarget2" does not exist.
I attach a minimal CMakeLists.txt file that illustrates the issue.
I also attach a patch for review, which I believe solves the problem.
sincerely,
Alex Ciobanu
cmake_minimum_required ( VERSION 2.8 ) if ( POLICY CMP0025 ) cmake_policy ( SET CMP0025 NEW ) # Apple clang policy. endif ( ) if ( POLICY CMP0046 ) cmake_policy ( SET CMP0046 NEW ) # Missing dependencies policy. endif ( ) project ( UnitTest ) add_custom_target ( ctarget1 ALL pwd ) add_custom_target ( ctarget2 ALL uname ) ## No missing target -> all good. #add_dependencies ( ctarget2 ctarget1 ) # With missing target -> warning that CMP0046 not set. add_dependencies ( ctarget2 ctarget1 missingtarget )
0001-Fixed-CMP0046-policy-warning-message-problem.patch
Description: Binary data
-- 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/cgi-bin/mailman/listinfo/cmake-developers
