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

Question #4

Closed
pzz2011 opened this issue Jul 13, 2016 · 0 comments
Closed

Question #4

pzz2011 opened this issue Jul 13, 2016 · 0 comments

Comments

@pzz2011
Copy link

pzz2011 commented Jul 13, 2016

感觉对unset的行为有点困惑。

An option that the user can select. Can accept condition to control when option is available for user.

Usage:

mxnet_option(<option_variable> "doc string" [IF ])

function(mxnet_option variable description value)
set(__value ${value})
set(__condition "")
set(__varname "__value")
foreach(arg ${ARGN})
if(arg STREQUAL "IF" OR arg STREQUAL "if")
set(__varname "__condition")
else()
list(APPEND ${__varname} ${arg})
endif()
endforeach()
unset(__varname) ==========>这里为什么要unset() unset之后这个变量不是不起作用?
if("${__condition}" STREQUAL "")
set(__condition 2 GREATER 1)
endif()

if(${__condition})
if("${__value}" MATCHES ";")
if(${__value})
option(${variable} "${description}" ON)
else()
option(${variable} "${description}" OFF)
endif()
elseif(DEFINED ${__value})
if(${__value})
option(${variable} "${description}" ON)
else()
option(${variable} "${description}" OFF)
endif()
else()
option(${variable} "${description}" ${__value})
endif()
else()
unset(${variable} CACHE)
endif()
endfunction()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants