Merge topic 'top-level-command-order'

59573bf5b9 project: Warn at top-level if `cmake_minimum_required` wasn't called
23f3dd9f7c RunCMake/project: Ignore exact line number in stderr checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7902
This commit is contained in:
Brad King
2022-11-15 13:51:12 +00:00
committed by Kitware Robot
16 changed files with 37 additions and 9 deletions
@@ -1,3 +1,5 @@
set(CMAKE_MINIMUM_REQUIRED_VERSION "" CACHE STRING "")
# Used to verify that the values match what is passed via -S and -B, and are retained in cache.
set(INITIAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "defined in initial.cmake")
set(INITIAL_BINARY_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "defined in initial.cmake")
@@ -1,4 +1,4 @@
CMake Error at CMP0048-OLD-VERSION.cmake:1 \(project\):
VERSION not allowed unless CMP0048 is set to NEW
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists.txt:[0-9]+ \(include\)$
@@ -7,4 +7,4 @@
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists.txt:[0-9]+ \(include\)$
@@ -8,5 +8,5 @@ CMake Warning \(dev\) at CMP0048-WARN.cmake:3 \(project\):
PROJECT_VERSION
MyProject_VERSION_TWEAK
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
+3 -1
View File
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 2.8.12)
if(NOT "x${RunCMake_TEST}" STREQUAL "xNoMinimumRequired")
cmake_minimum_required(VERSION 2.8.12)
endif()
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
@@ -1,4 +1,4 @@
CMake Error at LanguagesTwice.cmake:1 \(project\):
LANGUAGES may be specified at most once.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists.txt:[0-9]+ \(include\)$
@@ -0,0 +1,5 @@
CMake Warning \(dev\) at CMakeLists\.txt:[0-9]+ \(project\):
cmake_minimum_required\(\) should be called prior to this top-level project\(\)
call\. Please see the cmake-commands\(7\) manual for usage documentation of
both commands\.
This warning is for project developers\. Use -Wno-dev to suppress it\.$
@@ -52,3 +52,5 @@ run_cmake(CMP0048-NEW)
run_cmake(CMP0096-WARN)
run_cmake(CMP0096-OLD)
run_cmake(CMP0096-NEW)
run_cmake(NoMinimumRequired)
@@ -1,4 +1,4 @@
CMake Error at VersionInvalid.cmake:2 \(project\):
VERSION "NONE" format invalid.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists.txt:[0-9]+ \(include\)$
@@ -2,4 +2,4 @@ CMake Error at VersionMissingLanguages.cmake:2 \(project\):
project with VERSION, DESCRIPTION or HOMEPAGE_URL must use LANGUAGES before
language names.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists.txt:[0-9]+ \(include\)$
@@ -1,4 +1,4 @@
CMake Error at VersionTwice.cmake:2 \(project\):
VERSION may be specified at most once.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists.txt:[0-9]+ \(include\)$
@@ -1,6 +1,7 @@
include(RunCMake)
set(RunCMake_TEST_OPTIONS
-DCMAKE_MINIMUM_REQUIRED_VERSION:STATIC=
# Simulate a previous CMake run that used `project(... VERSION ...)`
# in a non-injected call site.
-DCMAKE_PROJECT_VERSION:STATIC=1.2.3