On 24/09/13 16:44, Brad King wrote:
> On 09/24/2013 09:46 AM, Daniele E. Domenichelli wrote:
>> I pushed a commit to the CheckStructHasMember_CXX topic, can you review
>> it?
> You can simplify the implementation using ${ARGN} to get the arguments
> beyond those explicitly named in the signature.

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()

   [...]

   if("${_lang}" STREQUAL "C")
      [...]
   elseif("${_lang}" STREQUAL "CXX")
      [...]
   else()
      message(FATAL_ERROR "Unknown language:\n  ${_lang}\nSupported languages: 
C, CXX.\n")
   endif()



Is the "MATCHES" using a list as a string "safe"? Or is there another way to
simplify it?
Otherwise I can do the same using list(LENGTH) and list(GET) instead of ARGC
and ARGV4/5, but it looks more complicated.


Cheers,
 Daniele
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to