UCL/GreatCMakeCookOff

GTest related warnings in recent versions of Cookoff

jenshnielsen opened this issue · 3 comments

With commits from 82b7b24 onwards we see warnings like

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_likelihood" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:40 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_asymptotes" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:36 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_recursion" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:28 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_determinant_equation" does
  not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:27 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_laplace_survivor" does not
  exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:26 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_brentq" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:37 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_time_filter" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:25 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_exact_survivor" does not
  exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:29 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_idealG" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:21 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_occupancies" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:24 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_idealG_laplacian" does not
  exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:23 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_root_finder_intervals" does
  not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:30 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_root_finder_lower_bound" does
  not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:33 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_idealG_exponentials" does not
  exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:22 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at build/external/src/GreatCMakeCookOff/scripts/AddGTest.cmake:31 (add_dependencies):
  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 "GTest" of target "test_qmatrix" does not exist.
Call Stack (most recent call first):
  likelihood/tests/CMakeLists.txt:20 (add_gtest)
This warning is for project developers.  Use -Wno-dev to suppress it.

When building HJCFIT which is using the add_gtest macro

Changing the dependency to be on Lookup-GTest does seem to resolve the issue

diff --git a/scripts/AddGTest.cmake b/scripts/AddGTest.cmake
index b2a113f..dc3fa12 100644
--- a/scripts/AddGTest.cmake
+++ b/scripts/AddGTest.cmake
@@ -28,7 +28,7 @@ macro(add_gtest name source)
       target_link_libraries(test_${name} ${CMAKE_THREAD_LIBS_INIT})
     endif(CMAKE_THREAD_LIBS_INIT)

-    add_dependencies(test_${name} GTest)
+    add_dependencies(test_${name} Lookup-GTest)
     if(NOT "${ARGN}" STREQUAL "")
       target_link_libraries(test_${name} ${ARGN})
     endif(NOT "${ARGN}" STREQUAL "")

@mdavezac Does that change make sense to you

Yes, that's my fault. And that's the right correction.
You may want to have Lookup-GreatCMakeCookOff.cmake point towards a tagged version rather than the master branch