From 857d236e2aa6ee832edf6c75cf3967a61da97cd8 Mon Sep 17 00:00:00 2001 From: Jim Wittig Date: Thu, 20 Aug 2026 10:44:33 -0600 Subject: [PATCH] Use the file() CREATE_LINK command to create symlinks when running cmake. Using execute_process to make symlinks is expensive; it spawns a new cmake process. The file() command is more efficient; it makes the symlink in the currently executing cmake process. --- CMakeLists.txt | 3 ++- src/core_atmosphere/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7e010394d..45e793a26f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ ## MPAS-Model -cmake_minimum_required(VERSION 3.12) +# cmake version in ncarenv/23.06 +cmake_minimum_required(VERSION 3.26) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Functions/MPAS_Functions.cmake) get_mpas_version(MPAS_VERSION) diff --git a/src/core_atmosphere/CMakeLists.txt b/src/core_atmosphere/CMakeLists.txt index 7fdbe66992..b13de5cd18 100644 --- a/src/core_atmosphere/CMakeLists.txt +++ b/src/core_atmosphere/CMakeLists.txt @@ -388,8 +388,8 @@ set(PHYSICS_WRF_DATA_DIR ${mpas_data_SOURCE_DIR}/atmosphere/physics_wrf/files) file(GLOB PHYSICS_WRF_DATA RELATIVE ${PHYSICS_WRF_DATA_DIR} "${PHYSICS_WRF_DATA_DIR}/*") file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere) foreach (data_file IN LISTS PHYSICS_WRF_DATA) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${PHYSICS_WRF_DATA_DIR}/${data_file} - ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere/${data_file}) + file(CREATE_LINK ${PHYSICS_WRF_DATA_DIR}/${data_file} + ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere/${data_file} SYMBOLIC) endforeach () install(DIRECTORY ${PHYSICS_WRF_DATA_DIR}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/core_atmosphere)