Commit 5ec9d84f authored by Manuel Grizonnet's avatar Manuel Grizonnet

Merge branch 'bug-1656' into 'develop'

BUG fix issue 1656 related to eratic behavior of cmake configuration

Closes #1656

See merge request !156
parents b3e93bf9 c392b77b
......@@ -50,13 +50,16 @@ if ( OTB_WRAP_PYTHON )
endif()
macro(swap_cache_variable var1 var2)
set(_backup ${${var1}})
get_property(_var1_type CACHE ${var1} PROPERTY TYPE)
get_property(_var1_help CACHE ${var1} PROPERTY HELPSTRING)
get_property(_var2_type CACHE ${var2} PROPERTY TYPE)
get_property(_var2_help CACHE ${var2} PROPERTY HELPSTRING)
set(${var1} ${${var2}} CACHE ${_var1_type} "${_var1_help}" FORCE)
set(${var2} ${_backup} CACHE ${_var2_type} "${_var2_help}" FORCE)
# Only swap variable if var1 exists in the cmake cache
if (${var1})
set(_backup ${${var1}})
get_property(_var1_type CACHE ${var1} PROPERTY TYPE)
get_property(_var1_help CACHE ${var1} PROPERTY HELPSTRING)
get_property(_var2_type CACHE ${var2} PROPERTY TYPE)
get_property(_var2_help CACHE ${var2} PROPERTY HELPSTRING)
set(${var1} ${${var2}} CACHE ${_var1_type} "${_var1_help}" FORCE)
set(${var2} ${_backup} CACHE ${_var2_type} "${_var2_help}" FORCE)
endif()
endmacro()
macro(swap_variable var1 var2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment