From 691af922ae24212cdd1973113f9df6923f4a4ba2 Mon Sep 17 00:00:00 2001 From: Florent Pruvost <florent.pruvost@inria.fr> Date: Fri, 6 Feb 2015 17:54:37 +0000 Subject: [PATCH] avoid to compare to 1 when a simple if on the variable is enough --> was causing strange behaviors in FindSTARPU.cmake for example (without MPI, STARPU_starpu_mpi.h_INCLUDE_DIRS-NOTFOUND was appending in the list of STARPU_INCLUDE_DIRS even if mpi was not required) --- cmake_modules/morse/find/FindCBLAS.cmake | 2 +- cmake_modules/morse/find/FindCHAMELEON.cmake | 8 ++++---- cmake_modules/morse/find/FindLAPACKE.cmake | 2 +- cmake_modules/morse/find/FindMAGMA.cmake | 4 ++-- cmake_modules/morse/find/FindPARMETIS.cmake | 2 +- cmake_modules/morse/find/FindPASTIX.cmake | 8 ++++---- cmake_modules/morse/find/FindPTSCOTCH.cmake | 2 +- cmake_modules/morse/find/FindQUARK.cmake | 2 +- cmake_modules/morse/find/FindSCOTCH.cmake | 2 +- cmake_modules/morse/find/FindSTARPU.cmake | 12 ++++++------ cmake_modules/morse/find/FindTMG.cmake | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cmake_modules/morse/find/FindCBLAS.cmake b/cmake_modules/morse/find/FindCBLAS.cmake index 748651359..534effce8 100644 --- a/cmake_modules/morse/find/FindCBLAS.cmake +++ b/cmake_modules/morse/find/FindCBLAS.cmake @@ -62,7 +62,7 @@ endif() # try to find it specified as COMPONENTS during the call if (CBLAS_FIND_COMPONENTS) foreach( component ${CBLAS_FIND_COMPONENTS} ) - if(${CBLAS_FIND_REQUIRED_${component}} STREQUAL 1) + if(CBLAS_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) diff --git a/cmake_modules/morse/find/FindCHAMELEON.cmake b/cmake_modules/morse/find/FindCHAMELEON.cmake index 98abd1387..78607b2b5 100644 --- a/cmake_modules/morse/find/FindCHAMELEON.cmake +++ b/cmake_modules/morse/find/FindCHAMELEON.cmake @@ -58,7 +58,7 @@ endif() # Try to find CHAMELEON dependencies if specified as COMPONENTS during the call if( CHAMELEON_FIND_COMPONENTS ) foreach( component ${CHAMELEON_FIND_COMPONENTS} ) - if(${CHAMELEON_FIND_REQUIRED_${component}} STREQUAL 1) + if(CHAMELEON_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) @@ -105,7 +105,7 @@ if(PKG_CONFIG_EXECUTABLE) endif() endif() - if (CHAMELEON_FIND_VERSION_EXACT STREQUAL 1) + if (CHAMELEON_FIND_VERSION_EXACT) if( NOT (CHAMELEON_FIND_VERSION_MAJOR STREQUAL CHAMELEON_VERSION_MAJOR) OR NOT (CHAMELEON_FIND_VERSION_MINOR STREQUAL CHAMELEON_VERSION_MINOR) ) if(NOT CHAMELEON_FIND_QUIETLY) @@ -278,12 +278,12 @@ if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES) set(MPI_C_COMPILER mpicc) endif() if (CHAMELEON_FIND_REQUIRED_MPI) - if(${CHAMELEON_FIND_REQUIRED_MPI} STREQUAL 1) + if(CHAMELEON_FIND_REQUIRED_MPI) list(APPEND STARPU_COMPONENT_LIST "MPI") endif() endif() if (CHAMELEON_FIND_REQUIRED_CUDA) - if(${CHAMELEON_FIND_REQUIRED_CUDA} STREQUAL 1) + if(CHAMELEON_FIND_REQUIRED_CUDA) list(APPEND STARPU_COMPONENT_LIST "CUDA") endif() endif() diff --git a/cmake_modules/morse/find/FindLAPACKE.cmake b/cmake_modules/morse/find/FindLAPACKE.cmake index fe79fc8f0..3a4a29c96 100644 --- a/cmake_modules/morse/find/FindLAPACKE.cmake +++ b/cmake_modules/morse/find/FindLAPACKE.cmake @@ -60,7 +60,7 @@ endif() # try to find it specified as COMPONENTS during the call if (LAPACKE_FIND_COMPONENTS) foreach( component ${LAPACKE_FIND_COMPONENTS} ) - if(${LAPACKE_FIND_REQUIRED_${component}} STREQUAL 1) + if(LAPACKE_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) diff --git a/cmake_modules/morse/find/FindMAGMA.cmake b/cmake_modules/morse/find/FindMAGMA.cmake index 2ea5d48a8..d1bcddcc8 100644 --- a/cmake_modules/morse/find/FindMAGMA.cmake +++ b/cmake_modules/morse/find/FindMAGMA.cmake @@ -55,7 +55,7 @@ endif(NOT MAGMA_FOUND) # try to find it specified as COMPONENTS during the call if( MAGMA_FIND_COMPONENTS ) foreach( component ${MAGMA_FIND_COMPONENTS} ) - if(${MAGMA_FIND_REQUIRED_${component}} STREQUAL 1) + if(MAGMA_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) @@ -130,7 +130,7 @@ if(PKG_CONFIG_EXECUTABLE) endif() endif() - if (MAGMA_FIND_VERSION_EXACT STREQUAL 1) + if (MAGMA_FIND_VERSION_EXACT) if( NOT (MAGMA_FIND_VERSION_MAJOR STREQUAL MAGMA_VERSION_MAJOR) OR NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) ) if(NOT MAGMA_FIND_QUIETLY) diff --git a/cmake_modules/morse/find/FindPARMETIS.cmake b/cmake_modules/morse/find/FindPARMETIS.cmake index f599725ce..44a6f847e 100644 --- a/cmake_modules/morse/find/FindPARMETIS.cmake +++ b/cmake_modules/morse/find/FindPARMETIS.cmake @@ -54,7 +54,7 @@ endif() # try to find it specified as COMPONENTS during the call if( PARMETIS_FIND_COMPONENTS ) foreach( component ${PARMETIS_FIND_COMPONENTS} ) - if(${PARMETIS_FIND_REQUIRED_${component}} STREQUAL 1) + if(PARMETIS_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) diff --git a/cmake_modules/morse/find/FindPASTIX.cmake b/cmake_modules/morse/find/FindPASTIX.cmake index c42553d75..00eab7efd 100644 --- a/cmake_modules/morse/find/FindPASTIX.cmake +++ b/cmake_modules/morse/find/FindPASTIX.cmake @@ -60,7 +60,7 @@ endif() # Try to find PASTIX dependencies if specified as COMPONENTS during the call if( PASTIX_FIND_COMPONENTS ) foreach( component ${PASTIX_FIND_COMPONENTS} ) - if(${PASTIX_FIND_REQUIRED_${component}} STREQUAL 1) + if(PASTIX_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) @@ -107,7 +107,7 @@ if(PKG_CONFIG_EXECUTABLE) endif() endif() - if (PASTIX_FIND_VERSION_EXACT STREQUAL 1) + if (PASTIX_FIND_VERSION_EXACT) if( NOT (PASTIX_FIND_VERSION_MAJOR STREQUAL PASTIX_VERSION_MAJOR) OR NOT (PASTIX_FIND_VERSION_MINOR STREQUAL PASTIX_VERSION_MINOR) ) if(NOT PASTIX_FIND_QUIETLY) @@ -278,12 +278,12 @@ if(NOT PASTIX_FOUND OR NOT PASTIX_LIBRARIES) set(MPI_C_COMPILER mpicc) endif() if (PASTIX_FIND_REQUIRED_MPI) - if(${PASTIX_FIND_REQUIRED_MPI} STREQUAL 1) + if(PASTIX_FIND_REQUIRED_MPI) list(APPEND STARPU_COMPONENT_LIST "MPI") endif() endif() if (PASTIX_FIND_REQUIRED_CUDA) - if(${PASTIX_FIND_REQUIRED_CUDA} STREQUAL 1) + if(PASTIX_FIND_REQUIRED_CUDA) list(APPEND STARPU_COMPONENT_LIST "CUDA") endif() endif() diff --git a/cmake_modules/morse/find/FindPTSCOTCH.cmake b/cmake_modules/morse/find/FindPTSCOTCH.cmake index edda37090..10ab86564 100644 --- a/cmake_modules/morse/find/FindPTSCOTCH.cmake +++ b/cmake_modules/morse/find/FindPTSCOTCH.cmake @@ -55,7 +55,7 @@ endif() # try to find it specified as COMPONENTS during the call if( PTSCOTCH_FIND_COMPONENTS ) foreach( component ${PTSCOTCH_FIND_COMPONENTS} ) - if(${PTSCOTCH_FIND_REQUIRED_${component}} STREQUAL 1) + if(PTSCOTCH_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake index 59757448e..379c52ad6 100644 --- a/cmake_modules/morse/find/FindQUARK.cmake +++ b/cmake_modules/morse/find/FindQUARK.cmake @@ -55,7 +55,7 @@ endif() # try to find it specified as COMPONENTS during the call if( QUARK_FIND_COMPONENTS ) foreach( component ${QUARK_FIND_COMPONENTS} ) - if(${QUARK_FIND_REQUIRED_${component}} STREQUAL 1) + if(QUARK_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) diff --git a/cmake_modules/morse/find/FindSCOTCH.cmake b/cmake_modules/morse/find/FindSCOTCH.cmake index 0fdee25dd..0a6af6c1f 100644 --- a/cmake_modules/morse/find/FindSCOTCH.cmake +++ b/cmake_modules/morse/find/FindSCOTCH.cmake @@ -55,7 +55,7 @@ endif() # try to find it specified as COMPONENTS during the call if( SCOTCH_FIND_COMPONENTS ) foreach( component ${SCOTCH_FIND_COMPONENTS} ) - if(${SCOTCH_FIND_REQUIRED_${component}} STREQUAL 1) + if(SCOTCH_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) diff --git a/cmake_modules/morse/find/FindSTARPU.cmake b/cmake_modules/morse/find/FindSTARPU.cmake index 376ee95f3..5b7b184d8 100644 --- a/cmake_modules/morse/find/FindSTARPU.cmake +++ b/cmake_modules/morse/find/FindSTARPU.cmake @@ -74,7 +74,7 @@ if( STARPU_FIND_COMPONENTS ) elseif(${component} STREQUAL "MAGMA") set(STARPU_LOOK_FOR_MAGMA TRUE) endif() - if(${STARPU_FIND_REQUIRED_${component}} STREQUAL 1) + if(STARPU_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) @@ -157,7 +157,7 @@ if(PKG_CONFIG_EXECUTABLE) endif() endif() - if (STARPU_FIND_VERSION_EXACT STREQUAL 1) + if (STARPU_FIND_VERSION_EXACT) if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) ) if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) @@ -277,7 +277,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR if (STARPU_starpu_config.h_INCLUDE_DIRS) GET_VERSION("STARPU" "${STARPU_starpu_config.h_INCLUDE_DIRS}/starpu_config.h") if (STARPU_VERSION_MAJOR AND STARPU_VERSION_MINOR) - if (STARPU_FIND_VERSION_EXACT STREQUAL 1) + if (STARPU_FIND_VERSION_EXACT) if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR) if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) ) @@ -368,7 +368,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR message(STATUS "Looking for starpu -- ${starpu_hdr} not found") endif() if(starpu_hdr STREQUAL "starpu_mpi.h") - if(NOT ${STARPU_FIND_REQUIRED_MPI} STREQUAL 1) + if(NOT STARPU_FIND_REQUIRED_MPI) if (NOT STARPU_FIND_QUIETLY) message(STATUS "Looking for starpu -- ${starpu_hdr} not required") endif() @@ -376,7 +376,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) endif() elseif( (starpu_hdr STREQUAL "starpu_cuda.h") OR (starpu_hdr STREQUAL "starpu_scheduler.h") ) - if(NOT ${STARPU_FIND_REQUIRED_CUDA} STREQUAL 1) + if(NOT STARPU_FIND_REQUIRED_CUDA) if (NOT STARPU_FIND_QUIETLY) message(STATUS "Looking for starpu -- ${starpu_hdr} not required") endif() @@ -496,7 +496,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR message(STATUS "Looking for starpu -- lib ${starpu_lib} not found") endif() if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION_STRING}" AND - NOT ${STARPU_FIND_REQUIRED_MPI} STREQUAL 1) + NOT STARPU_FIND_REQUIRED_MPI) # if MPI optional, not a problem: no NOTFOUND in list of MPI LIBRARIES if(NOT STARPU_FIND_QUIETLY) message(STATUS "Looking for starpu -- lib ${starpu_lib} not required") diff --git a/cmake_modules/morse/find/FindTMG.cmake b/cmake_modules/morse/find/FindTMG.cmake index 3b3f532d2..1ae899dc2 100644 --- a/cmake_modules/morse/find/FindTMG.cmake +++ b/cmake_modules/morse/find/FindTMG.cmake @@ -64,7 +64,7 @@ endif (NOT _LANGUAGES_ MATCHES Fortran) # try to find it specified as COMPONENTS during the call if (TMG_FIND_COMPONENTS) foreach( component ${TMG_FIND_COMPONENTS} ) - if(${TMG_FIND_REQUIRED_${component}} STREQUAL 1) + if(TMG_FIND_REQUIRED_${component}) find_package(${component} REQUIRED) else() find_package(${component}) -- GitLab