GEOS icon indicating copy to clipboard operation
GEOS copied to clipboard

[Bug] CMake: `GEOSX_USE_${DEP}` can be erroneuosly altered due to TPL discovery

Open wrtobin opened this issue 3 years ago • 0 comments

Describe the bug GEOSX_USE_${DEP} is set in GeosxConfig.hpp which is a cmake configured file, and each term in the file is set to true using the following snippet from src/cmake/GeosxConfig.cmake:

    if( ${DEP}_FOUND OR ENABLE_${DEP} OR GEOSX_ENABLE_${DEP} )
        set( USE_${DEP} TRUE )
        set( GEOSX_USE_${DEP} TRUE )
    endif()

This occurs after we configure our TPLs (necessarily), so it is possible for a CACHE variable set or overwritten by one of our TPL discovery calls can erroneously set ${DEP}_FOUND or ENABLE_${DEP} to differ from either their default or the value they are set to in a host-config file.

Practically this will probably only occur in packages where we haven't written our own find_package discovery scripts and are using instead the packages own packageConfig.cmake config.

In particular, on crusher we're currently building without openmp until HIP-offload is fully functional for simplicity, but depending on a TPL which sets OPENMP_FOUND erroneously causes GEOSX to attempt to configure with openmp active despite the host-config set(ENABLE_OPENMP FALSE BOOL CACHE "" FORCE ).

wrtobin avatar Mar 07 '22 17:03 wrtobin