mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 12:19:54 -05:00
04dadd0138
Add a unit test to ensure that various project-related variables are set to empty when values are not provided in the project() call.
25 lines
680 B
CMake
25 lines
680 B
CMake
function(_expect_empty NAME)
|
|
if(NOT DEFINED ${NAME})
|
|
message(SEND_ERROR "Variable '${NAME}' is not defined")
|
|
elseif(NOT "${${NAME}}" STREQUAL "")
|
|
message(SEND_ERROR
|
|
"Variable '${NAME}' has value '${${NAME}}' (expected: empty)")
|
|
endif()
|
|
endfunction()
|
|
|
|
function(expect_empty SUFFIX)
|
|
_expect_empty(PROJECT_${SUFFIX})
|
|
_expect_empty(CMAKE_PROJECT_${SUFFIX})
|
|
_expect_empty(${PROJECT_NAME}_${SUFFIX})
|
|
endfunction()
|
|
|
|
project(Omissions LANGUAGES)
|
|
expect_empty(VERSION)
|
|
expect_empty(VERSION_MAJOR)
|
|
expect_empty(VERSION_MINOR)
|
|
expect_empty(VERSION_PATCH)
|
|
expect_empty(VERSION_TWEAK)
|
|
expect_empty(COMPAT_VERSION)
|
|
expect_empty(DESCRIPTION)
|
|
expect_empty(HOMEPAGE_URL)
|