Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake conditionals checking ENV variables #6549

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/FindAmplifier.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindAsio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindHwloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindJemalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindLibSigSegv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindLibfabric.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindMSR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindOrangeFS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindPWR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindPapi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindQThreads.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindTBBmalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindTCMalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/HPX_SetupApex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmake/HPX_SetupBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/HPX_SetupGasnet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions cmake/templates/HPXConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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_<lib>_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)
Expand Down
2 changes: 1 addition & 1 deletion libs/full/parcelport_libfabric/cmake/FindPMI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading