Skip to content

configure_new errors with minimum required CMake version #2124

Closed
@Quba1

Description

@Quba1

CMakeLists.txt specifies minimum CMake version as 3.20

https://github.com/wrf-model/WRF/blob/c21d571d625286369212424810af300ca27495c6/CMakeLists.txt#L1C1-L1C39

However running configure_new with CMake version <3.23 fails with several errors like this:

CMake Error at cmake/target_source_properties.cmake:41 (define_property):
  define_property not given a BRIEF_DOCS <brief-doc> argument.
Call Stack (most recent call first):
  CMakeLists.txt:323 (define_target_source_properties)

This is because target_source_properties.cmake doesn't have BRIEF_DOCS and FULL_DOCS arguments in define_property():

foreach( PROPERTY ${FUNC_PROP_PROPERTIES} )
define_property(
SOURCE
PROPERTY ${PROPERTY}
# INHERITED # they will be "inherited" via target to source
)
define_property(
TARGET
PROPERTY ${PROPERTY}
# INHERITED # they will be "inherited" via target to source
)
endforeach()

Those arguments have been changed to optional in Cmake 3.23 (see docs).

With Cmake <3.23 I have found this workaround to solve the issue:

  foreach( PROPERTY ${FUNC_PROP_PROPERTIES} )
    define_property(
                    SOURCE
                    PROPERTY   ${PROPERTY}
                    # INHERITED # they will be "inherited" via target to source
                    BRIEF_DOCS "dummy docs"
                    FULL_DOCS "dummy docs"
                    )

    define_property(
                    TARGET
                    PROPERTY   ${PROPERTY}
                    # INHERITED # they will be "inherited" via target to source
                    BRIEF_DOCS "dummy docs"
                    FULL_DOCS "dummy docs"
                    )
  endforeach()

Thus to solve this issue either minimum Cmake version should be raised to 3.23 or a workaround similar to mine should be used. I'm happy to create PR for either solution when a decision is reached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions