Skip to content

Commit

Permalink
Add policy to detect invalid indices
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Jun 10, 2024
1 parent 441e967 commit 8caa641
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cmake/ecbuild_policies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@ if( POLICY CMP0074 )
cmake_policy( SET CMP0074 NEW )
endif()

# Detect invalid indices in the ``list()`` command, new in version 3.21
if( POLICY CMP0121 )
cmake_policy( SET CMP0121 NEW )
endif()

endif()
2 changes: 0 additions & 2 deletions tests/ecbuild_add_option/test_project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
find_package( ecbuild REQUIRED )
project( test_add_option VERSION 0.1.0 LANGUAGES NONE )

list(INSERT 0 CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

ecbuild_add_option(FEATURE TEST_A) # should default to ON
ecbuild_add_option(FEATURE TEST_B DEFAULT ON)
ecbuild_add_option(FEATURE TEST_C DEFAULT OFF)
Expand Down

0 comments on commit 8caa641

Please sign in to comment.