From 9abbff92c081ee66fd818e0019893481df30895d Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 10 Aug 2022 23:06:47 -0500 Subject: [PATCH 1/3] Adding warnings for use of old CMake build options. --- CMakeLists.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85dcd7084d..a0e788c133 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,32 @@ option(OPENMC_USE_DAGMC "Enable support for DAGMC (CAD) geometry" option(OPENMC_USE_LIBMESH "Enable support for libMesh unstructured mesh tallies" OFF) option(OPENMC_USE_MPI "Enable MPI" OFF) +# Warnings for deprecated options +foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh") + if(DEFINED ${OLD_OPT}) + string(TOUPPER ${OLD_OPT} OPT_UPPER) + message(WARNING "The OpenMC CMake option '${OLD_OPT}' has been deprecated. " + "Its value will be ignored. " + "Please use '-DOPENMC_USE_${OPT_UPPER}=${${OLD_OPT}}' instead.") + unset(${OLD_OPT} CACHE) + endif() +endforeach() + +foreach(OLD_BLD in ITEMS "debug" "optimize") + if(DEFINED ${OLD_BLD}) + if("${OLD_BLD}" EQUAL "debug") + set(BLD_VAR "Deubg") + else() + set(BLD_VAR "Release") + endif() + message(WARNING "The OpenMC CMake option '${OLD_BLD}' has been deprecated. " + "Its value will be ignored. " + "OpenMC now uses the CMAKE_BUILD_TYPE variable to set the build mode. " + "Please use '-DCMAKE_BUILD_TYPE=${BLD_VAR}' instead.") + unset(${OLD_BLD} CACHE) + endif() +endforeach() + #=============================================================================== # Set a default build configuration if not explicitly specified #=============================================================================== From 97236d7c56fde45ca653f3e7f7354206f603badf Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 11 Aug 2022 08:05:33 -0500 Subject: [PATCH 2/3] Correcting suggested CMake variable names --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0e788c133..72986ea2c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,9 +41,14 @@ option(OPENMC_USE_MPI "Enable MPI" foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh") if(DEFINED ${OLD_OPT}) string(TOUPPER ${OLD_OPT} OPT_UPPER) + if ("${OLD_OPT}" STREQUAL "profile" OR "${OLD_OPT}" STREQUAL "coverage") + set(NEW_OPT_PREFIX "OPENMC_ENABLE") + else() + set(NEW_OPT_PREFIX "OPENMC_USE") + endif() message(WARNING "The OpenMC CMake option '${OLD_OPT}' has been deprecated. " "Its value will be ignored. " - "Please use '-DOPENMC_USE_${OPT_UPPER}=${${OLD_OPT}}' instead.") + "Please use '-D${NEW_OPT_PREFIX}_${OPT_UPPER}=${${OLD_OPT}}' instead.") unset(${OLD_OPT} CACHE) endif() endforeach() From a753a44d9e10994485a0d8615041789a155a9c75 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 11 Aug 2022 09:06:32 -0400 Subject: [PATCH 3/3] Apply suggestions from @paulromano Co-authored-by: Paul Romano --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72986ea2c8..5e949070cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,8 +55,8 @@ endforeach() foreach(OLD_BLD in ITEMS "debug" "optimize") if(DEFINED ${OLD_BLD}) - if("${OLD_BLD}" EQUAL "debug") - set(BLD_VAR "Deubg") + if("${OLD_BLD}" STREQUAL "debug") + set(BLD_VAR "Debug") else() set(BLD_VAR "Release") endif()