[cmake-developers] CheckStructHasMember does not support C++ only structs

Brad King brad.king at kitware.com
Wed Sep 25 08:16:50 EDT 2013


On 09/24/2013 05:28 PM, Daniele E. Domenichelli wrote:
> You mean something like this?
> 
>    if("${ARGN}" STREQUAL "")
>       set(_lang C)
>    elseif("${ARGN}" MATCHES "^LANGUAGE;([a-zA-Z]+)$")
>       set(_lang "${CMAKE_MATCH_1}")
>    else()
>       message(FATAL_ERROR "Unknown arguments:\n  ${ARGN}\n")
>    endif()

That should work, though I suggest using the 'x' trick:

  if("x${ARGN}" STREQUAL "x")
    set(_lang C)
  elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$")

to avoid possible collision of ${ARGN} with other if tests.

-Brad



More information about the cmake-developers mailing list