From 8c75983cbb3b021832e35fa63ebbb2375c57ad6d Mon Sep 17 00:00:00 2001 From: Pansysk75 Date: Thu, 3 Oct 2024 15:57:23 -0500 Subject: [PATCH] Fix CMake conditionals checking ENV varriables --- cmake/FindAmplifier.cmake | 2 +- cmake/FindAsio.cmake | 2 +- cmake/FindHwloc.cmake | 2 +- cmake/FindJemalloc.cmake | 4 ++-- cmake/FindLibSigSegv.cmake | 2 +- cmake/FindLibfabric.cmake | 2 +- cmake/FindMSR.cmake | 2 +- cmake/FindOrangeFS.cmake | 2 +- cmake/FindPWR.cmake | 2 +- cmake/FindPapi.cmake | 4 ++-- cmake/FindQThreads.cmake | 2 +- cmake/FindTBBmalloc.cmake | 2 +- cmake/FindTCMalloc.cmake | 2 +- cmake/HPX_SetupApex.cmake | 2 +- cmake/HPX_SetupBoost.cmake | 2 +- cmake/HPX_SetupGasnet.cmake | 2 +- cmake/templates/HPXConfig.cmake.in | 4 ++-- libs/full/parcelport_libfabric/cmake/FindPMI.cmake | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmake/FindAmplifier.cmake b/cmake/FindAmplifier.cmake index 41ffbf74434e..7b5e450726fb 100644 --- a/cmake/FindAmplifier.cmake +++ b/cmake/FindAmplifier.cmake @@ -37,7 +37,7 @@ if(NOT TARGET Amplifier::amplifier) if(Amplifier_ROOT) # The call to file is for compatibility for windows paths file(TO_CMAKE_PATH ${Amplifier_ROOT} Amplifier_ROOT) - elseif("$ENV{AMPLIFIER_ROOT}") + elseif(DEFINED ENV{AMPLIFIER_ROOT}) file(TO_CMAKE_PATH $ENV{AMPLIFIER_ROOT} Amplifier_ROOT) else() file(TO_CMAKE_PATH "${Amplifier_INCLUDE_DIR}" Amplifier_INCLUDE_DIR) diff --git a/cmake/FindAsio.cmake b/cmake/FindAsio.cmake index 76fea2033ddd..8141b020cb88 100644 --- a/cmake/FindAsio.cmake +++ b/cmake/FindAsio.cmake @@ -33,7 +33,7 @@ if(NOT TARGET Asio::asio) if(Asio_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Asio_ROOT} Asio_ROOT) - elseif("$ENV{ASIO_ROOT}") + elseif(DEFINED ENV{ASIO_ROOT}) file(TO_CMAKE_PATH $ENV{ASIO_ROOT} Asio_ROOT) else() file(TO_CMAKE_PATH "${Asio_INCLUDE_DIR}" Asio_INCLUDE_DIR) diff --git a/cmake/FindHwloc.cmake b/cmake/FindHwloc.cmake index 42d331e65f70..a69971059741 100644 --- a/cmake/FindHwloc.cmake +++ b/cmake/FindHwloc.cmake @@ -51,7 +51,7 @@ if(NOT TARGET Hwloc::hwloc) if(Hwloc_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Hwloc_ROOT} Hwloc_ROOT) - elseif("$ENV{HWLOC_ROOT}") + elseif(DEFINED ENV{HWLOC_ROOT}) file(TO_CMAKE_PATH $ENV{HWLOC_ROOT} Hwloc_ROOT) else() file(TO_CMAKE_PATH "${Hwloc_INCLUDE_DIR}" Hwloc_INCLUDE_DIR) diff --git a/cmake/FindJemalloc.cmake b/cmake/FindJemalloc.cmake index c6e111ede3a2..c5778013a08f 100644 --- a/cmake/FindJemalloc.cmake +++ b/cmake/FindJemalloc.cmake @@ -53,7 +53,7 @@ endif() if(Jemalloc_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Jemalloc_ROOT} Jemalloc_ROOT) -elseif("$ENV{JEMALLOC_ROOT}") +elseif(DEFINED ENV{JEMALLOC_ROOT}) file(TO_CMAKE_PATH $ENV{JEMALLOC_ROOT} Jemalloc_ROOT) else() file(TO_CMAKE_PATH "${Jemalloc_INCLUDE_DIR}" Jemalloc_INCLUDE_DIR) @@ -75,7 +75,7 @@ find_library( ) # Set Jemalloc_ROOT in case the other hints are used -if(NOT Jemalloc_ROOT AND "$ENV{JEMALLOC_ROOT}") +if(NOT Jemalloc_ROOT AND DEFINED ENV{JEMALLOC_ROOT}) set(Jemalloc_ROOT $ENV{JEMALLOC_ROOT}) elseif(NOT Jemalloc_ROOT) string(REPLACE "/include" "" Jemalloc_ROOT "${Jemalloc_INCLUDE_DIR}") diff --git a/cmake/FindLibSigSegv.cmake b/cmake/FindLibSigSegv.cmake index e37bac02a0b6..979f461a00f7 100644 --- a/cmake/FindLibSigSegv.cmake +++ b/cmake/FindLibSigSegv.cmake @@ -45,7 +45,7 @@ find_library( if(Libsigsegv_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Libsigsegv_ROOT} Libsigsegv_ROOT) -elseif("$ENV{LIBSIGSEGV_ROOT}") +elseif(DEFINED ENV{LIBSIGSEGV_ROOT}) file(TO_CMAKE_PATH $ENV{LIBSIGSEGV_ROOT} Libsigsegv_ROOT) else() file(TO_CMAKE_PATH "${Libsigsegv_INCLUDE_DIR}" Libsigsegv_INCLUDE_DIR) diff --git a/cmake/FindLibfabric.cmake b/cmake/FindLibfabric.cmake index ce6a3a247835..a0e969c64365 100644 --- a/cmake/FindLibfabric.cmake +++ b/cmake/FindLibfabric.cmake @@ -33,7 +33,7 @@ find_library( if(Libfabric_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Libfabric_ROOT} Libfabric_ROOT) -elseif("$ENV{LIBFABRIC_ROOT}") +elseif(DEFINED ENV{LIBFABRIC_ROOT}) file(TO_CMAKE_PATH $ENV{LIBFABRIC_ROOT} Libfabric_ROOT) else() file(TO_CMAKE_PATH "${Libfabric_INCLUDE_DIR}" Libfabric_INCLUDE_DIR) diff --git a/cmake/FindMSR.cmake b/cmake/FindMSR.cmake index fb7c2a41526c..7e16aae1138a 100644 --- a/cmake/FindMSR.cmake +++ b/cmake/FindMSR.cmake @@ -37,7 +37,7 @@ find_library( if(Msr_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Msr_ROOT} Msr_ROOT) -elseif("$ENV{MSR_ROOT}") +elseif(DEFINED ENV{MSR_ROOT}) file(TO_CMAKE_PATH $ENV{MSR_ROOT} Msr_ROOT) else() file(TO_CMAKE_PATH "${Msr_INCLUDE_DIR}" Msr_INCLUDE_DIR) diff --git a/cmake/FindOrangeFS.cmake b/cmake/FindOrangeFS.cmake index 36caaaaa0f26..ac5ab29d8b69 100644 --- a/cmake/FindOrangeFS.cmake +++ b/cmake/FindOrangeFS.cmake @@ -37,7 +37,7 @@ find_library( if(Orangefs_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Orangefs_ROOT} Orangefs_ROOT) -elseif("$ENV{ORANGEFS_ROOT}") +elseif(DEFINED ENV{ORANGEFS_ROOT}) file(TO_CMAKE_PATH $ENV{ORANGEFS_ROOT} Orangefs_ROOT) else() file(TO_CMAKE_PATH "${Orangefs_INCLUDE_DIR}" Orangefs_INCLUDE_DIR) diff --git a/cmake/FindPWR.cmake b/cmake/FindPWR.cmake index 0007fa6008dc..6e6e1eeca357 100644 --- a/cmake/FindPWR.cmake +++ b/cmake/FindPWR.cmake @@ -54,7 +54,7 @@ if(NOT TARGET PWR::pwr) if(Pwr_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Pwr_ROOT} Pwr_ROOT) - elseif("$ENV{PWR_ROOT}") + elseif(DEFINED ENV{PWR_ROOT}) file(TO_CMAKE_PATH $ENV{PWR_ROOT} Pwr_ROOT) else() file(TO_CMAKE_PATH "${Pwr_INCLUDE_DIR}" Pwr_INCLUDE_DIR) diff --git a/cmake/FindPapi.cmake b/cmake/FindPapi.cmake index b0a4dbf4cf2e..5f0592f5a258 100644 --- a/cmake/FindPapi.cmake +++ b/cmake/FindPapi.cmake @@ -36,7 +36,7 @@ if(NOT TARGET Papi::papi) ) # Set Papi_ROOT in case the other hints are used - if(NOT Papi_ROOT AND "$ENV{PAPI_ROOT}") + if(NOT Papi_ROOT AND DEFINED ENV{PAPI_ROOT}) set(Papi_ROOT $ENV{PAPI_ROOT}) elseif(NOT Papi_ROOT) string(REPLACE "/include" "" Papi_ROOT "${Papi_INCLUDE_DIR}") @@ -46,7 +46,7 @@ if(NOT TARGET Papi::papi) if(Papi_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Papi_ROOT} Papi_ROOT) - elseif("$ENV{PAPI_ROOT}") + elseif(DEFINED ENV{PAPI_ROOT}) file(TO_CMAKE_PATH $ENV{PAPI_ROOT} Papi_ROOT) else() file(TO_CMAKE_PATH "${Papi_INCLUDE_DIR}" Papi_INCLUDE_DIR) diff --git a/cmake/FindQThreads.cmake b/cmake/FindQThreads.cmake index 08e2342521fb..1e555ce48aa1 100644 --- a/cmake/FindQThreads.cmake +++ b/cmake/FindQThreads.cmake @@ -36,7 +36,7 @@ find_library( if(Qthreads_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Qthreads_ROOT} Qthreads_ROOT) -elseif("$ENV{QTHREADS_ROOT}") +elseif(DEFINED ENV{QTHREADS_ROOT}) file(TO_CMAKE_PATH $ENV{QTHREADS_ROOT} Qthreads_ROOT) else() file(TO_CMAKE_PATH "${Qthreads_INCLUDE_DIR}" Qthreads_INCLUDE_DIR) diff --git a/cmake/FindTBBmalloc.cmake b/cmake/FindTBBmalloc.cmake index 9b029ac51068..fa796dbb717f 100644 --- a/cmake/FindTBBmalloc.cmake +++ b/cmake/FindTBBmalloc.cmake @@ -53,7 +53,7 @@ find_library( ) # Set Tbbmalloc_ROOT in case the other hints are used -if(NOT Tbbmalloc_ROOT AND "$ENV{TBBMALLOC_ROOT}") +if(NOT Tbbmalloc_ROOT AND DEFINED ENV{TBBMALLOC_ROOT}) set(Tbbmalloc_ROOT $ENV{TBBMALLOC_ROOT}) elseif(NOT Tbbmalloc_ROOT) string(REPLACE "/include" "" Tbbmalloc_ROOT "${Tbbmalloc_INCLUDE_DIR}") diff --git a/cmake/FindTCMalloc.cmake b/cmake/FindTCMalloc.cmake index 8503410b8d94..55bd5e3d0c25 100644 --- a/cmake/FindTCMalloc.cmake +++ b/cmake/FindTCMalloc.cmake @@ -48,7 +48,7 @@ find_library( ) # Set Tcmalloc_ROOT in case the other hints are used -if(NOT Tcmalloc_ROOT AND "$ENV{TCMALLOC_ROOT}") +if(NOT Tcmalloc_ROOT AND DEFINED ENV{TCMALLOC_ROOT}) set(Tcmalloc_ROOT $ENV{TCMALLOC_ROOT}) elseif(NOT Tcmalloc_ROOT) string(REPLACE "/include" "" Tcmalloc_ROOT "${Tcmalloc_INCLUDE_DIR}") diff --git a/cmake/HPX_SetupApex.cmake b/cmake/HPX_SetupApex.cmake index 2b3d071e50c5..9723a7d1c8ac 100644 --- a/cmake/HPX_SetupApex.cmake +++ b/cmake/HPX_SetupApex.cmake @@ -39,7 +39,7 @@ if(HPX_WITH_APEX AND NOT TARGET APEX::apex) endif() if(NOT HPX_FIND_PACKAGE) - if(NOT "${Apex_ROOT}" AND "$ENV{APEX_ROOT}") + if(NOT "${Apex_ROOT}" AND DEFINED ENV{APEX_ROOT}) set(Apex_ROOT "$ENV{APEX_ROOT}") endif() diff --git a/cmake/HPX_SetupBoost.cmake b/cmake/HPX_SetupBoost.cmake index 14aa36c25df8..43360e5571db 100644 --- a/cmake/HPX_SetupBoost.cmake +++ b/cmake/HPX_SetupBoost.cmake @@ -153,7 +153,7 @@ if(NOT TARGET hpx_dependencies_boost) endif() # We are assuming that there is only one Boost Root - if(NOT Boost_ROOT AND "$ENV{BOOST_ROOT}") + if(NOT Boost_ROOT AND DEFINED ENV{BOOST_ROOT}) set(Boost_ROOT $ENV{BOOST_ROOT}) elseif(NOT Boost_ROOT) string(REPLACE "/include" "" Boost_ROOT "${Boost_INCLUDE_DIRS}") diff --git a/cmake/HPX_SetupGasnet.cmake b/cmake/HPX_SetupGasnet.cmake index 61690c08ddae..a63cbc7980a0 100644 --- a/cmake/HPX_SetupGasnet.cmake +++ b/cmake/HPX_SetupGasnet.cmake @@ -171,7 +171,7 @@ macro(hpx_setup_gasnet) elseif(${MPI_CC}) set(MPI_CC ${CMAKE_C_COMPILER}) set(ENV{MPI_CC} ${CMAKE_C_COMPILER}) - elseif($ENV{MPI_CC}) + elseif(DEFINED ENV{MPI_CC}) set(MPI_CC ${CMAKE_C_COMPILER}) set(ENV{MPI_CC} ${CMAKE_C_COMPILER}) else() diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in index 3c5161690bde..59f4d2cad8b5 100644 --- a/cmake/templates/HPXConfig.cmake.in +++ b/cmake/templates/HPXConfig.cmake.in @@ -149,7 +149,7 @@ set(HPX_TBBMALLOC_ROOT "@Tbbmalloc_ROOT@") # Special handle for mimalloc cause we can't specify HPX_MIMALLOC_ROOT as a HINT # to find_package set(HPX_MIMALLOC_ROOT "@Mimalloc_ROOT@") -if(NOT Mimalloc_ROOT AND NOT "$ENV{MIMALLOC_ROOT}") +if(NOT Mimalloc_ROOT AND NOT DEFINED ENV{MIMALLOC_ROOT}) set(Mimalloc_ROOT ${HPX_MIMALLOC_ROOT}) endif() include(HPX_SetupAllocator) @@ -160,7 +160,7 @@ include(HPX_SetupThreads) set(HPX_BOOST_ROOT "@Boost_ROOT@") # By default Boost_ROOT is set to HPX_BOOST_ROOT (not necessary for PAPI or # HWLOC cause we are specifying HPX__ROOT as an HINT to find_package) -if(NOT Boost_ROOT AND NOT "$ENV{BOOST_ROOT}") +if(NOT Boost_ROOT AND NOT DEFINED ENV{BOOST_ROOT}) set(Boost_ROOT ${HPX_BOOST_ROOT}) endif() include(HPX_SetupBoost) diff --git a/libs/full/parcelport_libfabric/cmake/FindPMI.cmake b/libs/full/parcelport_libfabric/cmake/FindPMI.cmake index ef7073ab1262..3e3a45da1a15 100644 --- a/libs/full/parcelport_libfabric/cmake/FindPMI.cmake +++ b/libs/full/parcelport_libfabric/cmake/FindPMI.cmake @@ -55,7 +55,7 @@ find_library( if(Pmi_ROOT) # The call to file is for compatibility with windows paths file(TO_CMAKE_PATH ${Pmi_ROOT} Pmi_ROOT) -elseif("$ENV{PMI_ROOT}") +elseif(DEFINED ENV{PMI_ROOT}) file(TO_CMAKE_PATH $ENV{PMI_ROOT} Pmi_ROOT) else() file(TO_CMAKE_PATH "${Pmi_INCLUDE_DIR}" Pmi_INCLUDE_DIR)