Skip to content
  • Andreas Beckmann's avatar
    use consistent style in cmake conditionals · 1418cf60
    Andreas Beckmann authored
    Consistently use e.g.
      if (VARIABLE)
    instead of
      if (${VARIABLE})
    because the latter causes the variable to be expanded twice (if the
    first expansion yields the name of a defined variable).
    This is usually not wanted and it also causes the following cmake
    snippet
    
    	if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
    		message("This is a GNU compiler")
    	else()
    		message("This is not a GNU compiler")
    	endif()
    
    	set(GNU "foo")
    
    	if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
    		message("This is a GNU compiler")
    	else()
    		message("This is not a GNU compiler")
    	endif()
    
    	if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
    		message("This is a GNU compiler")
    	else()
    		message("This is not a GNU compiler")
    	endif()
    
    to produce the rather confusing
    
    	This is a GNU compiler
    	This is not a GNU compiler
    	This is a GNU compiler
    1418cf60