From 523c648e5d388f2528661d0c71f0621e3810c13d Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Mon, 23 Oct 2023 10:20:29 +0100 Subject: [PATCH] CMake: Don't add uninstall target and CPack config if not top-level Fixes #2597 --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0191f1454c..ac0326d119 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,7 @@ # Set Project Properties ################################## -#Minimum required CMake Version -cmake_minimum_required(VERSION 3.12.0) -# CMake 3.12: Use libraries specified in CMAKE_REQUIRED_LIBRARIES for check include macros +cmake_minimum_required(VERSION 3.21.0) #Project Name project(netCDF @@ -2789,5 +2787,6 @@ install( #### # CPack inclusion must come last. -# INCLUDE(CPack) -INCLUDE(CMakeInstallation.cmake) +if (PROJECT_IS_TOP_LEVEL) + include(CMakeInstallation.cmake) +endif()