Merge topic 'include-command-empty-filename'

2e99949 include: Ignore empty string as file name (#13388)
This commit is contained in:
David Cole 2012-07-12 16:00:18 -04:00 committed by CMake Topic Stage
commit 7a3a5eb458
8 changed files with 27 additions and 0 deletions

View File

@ -70,6 +70,13 @@ bool cmIncludeCommand
}
}
if(fname.empty())
{
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
"include() given empty file name (ignored).");
return true;
}
if(!cmSystemTools::FileIsFullPath(fname.c_str()))
{
// Not a path. Maybe module.

View File

@ -50,6 +50,7 @@ add_RunCMake_test(ObjectLibrary)
add_RunCMake_test(build_command)
add_RunCMake_test(find_package)
add_RunCMake_test(include)
add_RunCMake_test(list)
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -0,0 +1,5 @@
CMake Warning \(dev\) at EmptyString.cmake:1 \(include\):
include\(\) given empty file name \(ignored\).
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@ -0,0 +1 @@
include("")

View File

@ -0,0 +1,5 @@
CMake Warning \(dev\) at EmptyStringOptional.cmake:1 \(include\):
include\(\) given empty file name \(ignored\).
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@ -0,0 +1 @@
include("" OPTIONAL)

View File

@ -0,0 +1,4 @@
include(RunCMake)
run_cmake(EmptyString)
run_cmake(EmptyStringOptional)