export: Error when exporting a target without a language
First, it prevents a NULL dereference and second it reiterates that targets without languages are not supported by CMake. Add a RunCMake.ExportWithoutLanguage test exporting a library without a languages.
This commit is contained in:
parent
2f8dace125
commit
5837f19690
|
@ -349,6 +349,16 @@ void getCompatibleInterfaceProperties(cmTarget *target,
|
||||||
{
|
{
|
||||||
cmComputeLinkInformation *info = target->GetLinkInformation(config);
|
cmComputeLinkInformation *info = target->GetLinkInformation(config);
|
||||||
|
|
||||||
|
if (!info)
|
||||||
|
{
|
||||||
|
cmMakefile* mf = target->GetMakefile();
|
||||||
|
cmOStringStream e;
|
||||||
|
e << "Exporting the target \"" << target->GetName() << "\" is not "
|
||||||
|
"allowed since its linker language cannot be determined";
|
||||||
|
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
|
const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
|
||||||
|
|
||||||
for(cmComputeLinkInformation::ItemVector::const_iterator li =
|
for(cmComputeLinkInformation::ItemVector::const_iterator li =
|
||||||
|
|
|
@ -115,4 +115,5 @@ if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_RunCMake_test(File_Generate)
|
add_RunCMake_test(File_Generate)
|
||||||
|
add_RunCMake_test(ExportWithoutLanguage)
|
||||||
add_RunCMake_test(target_link_libraries)
|
add_RunCMake_test(target_link_libraries)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,6 @@
|
||||||
|
CMake Error: CMake can not determine linker language for target: NoLanguage
|
||||||
|
CMake Error at NoLanguage.cmake:2 \(export\):
|
||||||
|
Exporting the target "NoLanguage" is not allowed since its linker language
|
||||||
|
cannot be determined
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
add_library(NoLanguage header.h)
|
||||||
|
export(TARGETS NoLanguage FILE "${CMAKE_CURRENT_BINARY_DIR}/export.cmake")
|
|
@ -0,0 +1,3 @@
|
||||||
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(NoLanguage)
|
Loading…
Reference in New Issue