[cmake-developers] Possible regression in cmake_parse_arguments in CMake v3.5.0-rc2

Daniele E. Domenichelli ddomenichelli at drdanz.it
Fri Feb 12 03:59:04 EST 2016


>From (at least) CMake 2.8.9 to CMake 3.4, this CMakeLists.txt

---
  cmake_minimum_required(VERSION 2.8.9)
  project(bar)

  include(CMakeParseArguments)

  macro(foo)
    set(_options )
    set(_oneValueArgs FOO)
    set(_multiValueArgs )
    cmake_parse_arguments(_FOO1 "${_options}"
                                "${_oneValueArgs}"
                                "${_multiValueArgs}"
                                "${ARGN}")
    cmake_parse_arguments(_FOO2 "${_options}"
                                "${_oneValueArgs}"
                                "${_multiValueArgs}"
                                ${ARGN})

    message("_FOO1_FOO=${_FOO1_FOO}")
    message("_FOO2_FOO=${_FOO2_FOO}")

  endmacro()

  foo(FOO foo)
---


would produce this output:

  _FOO1_FOO=foo
  _FOO2_FOO=foo


In CMake v3.5.0-rc2 the output is the following:

  _FOO1_FOO=
  _FOO2_FOO=foo


This means that the last argument is no longer handled in the same way
as it was before.


Is this an intended change? If it is, I think this is worth a policy,
since I believe it will break a lot of code...



Cheers,
 Daniele



More information about the cmake-developers mailing list