From 099c0d24e67dbb9f77157180a2b12fe817276c93 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Wed, 3 Jan 2024 13:59:53 +0000 Subject: [PATCH 1/3] Explicitly set CMP0144 policy behavior Re ECFLOW-1936 --- CMakeLists.txt | 1 + cmake/Policies.cmake | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 cmake/Policies.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c038fd6..7b7c61b19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,7 @@ option( ENABLE_HTTP "Enable HTTP server (experimental)" ON ) option( ENABLE_UDP "Enable UDP server (experimental)" ON ) option( ENABLE_DOCS "Enable Documentation" OFF ) +include(Policies NO_POLICY_SCOPE) # ========================================================================================= # Dependency: Qt diff --git a/cmake/Policies.cmake b/cmake/Policies.cmake new file mode 100644 index 000000000..b736aec6c --- /dev/null +++ b/cmake/Policies.cmake @@ -0,0 +1,27 @@ +# +# Copyright 2009- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +# ========================================================================================= +# Setup project-wide CMake Policies +# ========================================================================================= + +# +# CMake Policy CMP0144 (CMake >=3.27) +# +# OLD behaviour: +# find_package(PackageName) used only case-preserved _ROOT variables +# +# NEW behaviour: +# find_package(PackageName) uses upper-case _ROOT variables, +# in addition to _ROOT variables. +# +if(POLICY CMP0144) + cmake_policy(SET CMP0144 NEW) +endif() From b09f9add77b6019b5fe8989ea271837cb10d393b Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Wed, 3 Jan 2024 14:07:03 +0000 Subject: [PATCH 2/3] Silence CMake warning regarding CMP0148 Re ECFLOW-1936 --- Pyext/CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Pyext/CMakeLists.txt b/Pyext/CMakeLists.txt index 18e5d594d..517ea9472 100644 --- a/Pyext/CMakeLists.txt +++ b/Pyext/CMakeLists.txt @@ -196,6 +196,7 @@ else() find_package( Boost ${ECFLOW_BOOST_VERSION} COMPONENTS ${ECFLOW_BOOST_PYTHON_COMPONENT} ) if (Boost_PYTHON_FOUND OR Boost_PYTHON${Python2_VERSION_MAJOR}${Python2_VERSION_MINOR}_FOUND) + # Indicate that both Python and Boost.Python have been found set(ECF_PYTHON_FOUND "ECF_PYTHON_FOUND") add_subdirectory( python2 ) else() @@ -226,6 +227,11 @@ else() message( STATUS " Python3_VERSION_MINOR : ${Python3_VERSION_MINOR}" ) message( STATUS " Python3_VERSION_PATCH : ${Python3_VERSION_PATCH}" ) + # Set (deprecated) FindPython variables + # These need to be available, as they are used by `ecbuild_add_test(... TYPE PYTHON ...)` + set(PYTHONINTERP_FOUND "${Python3_Interpreter_FOUND}") + set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") + if ( Boost_MINOR_VERSION GREATER 66 ) # cmake 3.15 # see: https://gitlab.kitware.com/cmake/cmake/issues/19656 @@ -235,15 +241,11 @@ else() set(ECFLOW_BOOST_PYTHON_COMPONENT python3) endif() find_package( Boost ${ECFLOW_BOOST_VERSION} COMPONENTS ${ECFLOW_BOOST_PYTHON_COMPONENT} ) - + if (Boost_PYTHON3_FOUND OR Boost_PYTHON${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}_FOUND) - if ( Python3_LIBRARIES ) - ecbuild_find_python( VERSION ${Python3_VERSION} REQUIRED ) - set(ECF_PYTHON_FOUND "ECF_PYTHON_FOUND") - add_subdirectory( python3 ) - else() - message( STATUS " python3 libraries *NOT* found" ) - endif() + # Indicate that both Python and Boost.Python have been found + set(ECF_PYTHON_FOUND "ECF_PYTHON_FOUND") + add_subdirectory( python3 ) else() message( STATUS " Boost python3 libraries *NOT* found" ) endif() From c742571fc9e01f81154db31fbd78d07294ce2543 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Wed, 3 Jan 2024 14:45:38 +0000 Subject: [PATCH 3/3] Silence CMake warning regarding CMP0046 Re ECFLOW-1936 --- Viewer/CMakeLists.txt | 15 --------------- Viewer/ecflowUI/src/CMakeLists.txt | 3 +-- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/Viewer/CMakeLists.txt b/Viewer/CMakeLists.txt index f747db85f..e1184d4fb 100644 --- a/Viewer/CMakeLists.txt +++ b/Viewer/CMakeLists.txt @@ -8,20 +8,5 @@ # nor does it submit to any jurisdiction. # -# avoid warning about dependency targets that don't exist -# -# CMake Warning (dev) at Viewer/src/CMakeLists.txt:261 (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 -# "/tmp/ma0/workspace/ecflow/Viewer/src/../images/zombie_dock.svg" of target -# "Qt_resource_cpp" does not exist. - -if (POLICY CMP0046) - cmake_policy(SET CMP0046 OLD) -endif() - add_subdirectory( libViewer) add_subdirectory( ecflowUI) diff --git a/Viewer/ecflowUI/src/CMakeLists.txt b/Viewer/ecflowUI/src/CMakeLists.txt index 68fa17114..7f4441a5f 100644 --- a/Viewer/ecflowUI/src/CMakeLists.txt +++ b/Viewer/ecflowUI/src/CMakeLists.txt @@ -795,8 +795,7 @@ endif() # add all the images as dependencies of the resource file so that it is # automatically recompiled when an image changes file(GLOB image_files "${CMAKE_CURRENT_SOURCE_DIR}/../images/*.*") -add_custom_target(Qt_resource_cpp DEPENDS ${VIEWER_RES}) -add_dependencies(Qt_resource_cpp ${image_files}) +add_custom_target(Qt_resource_cpp DEPENDS ${VIEWER_RES} ${image_files}) ecbuild_add_executable( TARGET