Merge topic 'export-no-custom-target'
7e9f908e
export: Reject custom target exports earlier (#15657)3b09398a
Tests: Teach RunCMake.export to enable languages only when needed
This commit is contained in:
commit
e00e8713de
|
@ -177,6 +177,12 @@ bool cmExportCommand
|
|||
this->SetError(e.str());
|
||||
return false;
|
||||
}
|
||||
if (target->GetType() == cmTarget::UTILITY)
|
||||
{
|
||||
this->SetError("given custom target \"" + *currentTarget
|
||||
+ "\" which may not be exported.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CMake Error at AppendExport.cmake:8 \(export\):
|
||||
CMake Error at AppendExport.cmake:[0-9]+ \(export\):
|
||||
export EXPORT signature does not recognise the APPEND option.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
enable_language(CXX)
|
||||
add_library(foo empty.cpp)
|
||||
export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
|
||||
install(TARGETS foo EXPORT fooExport
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.8.4)
|
||||
project(${RunCMake_TEST})
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,4 @@
|
|||
^CMake Error at CustomTarget.cmake:[0-9]+ \(export\):
|
||||
export given custom target "CustomTarget" which may not be exported.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)$
|
|
@ -0,0 +1,2 @@
|
|||
add_custom_target(CustomTarget)
|
||||
export(TARGETS CustomTarget FILE somefile.cmake)
|
|
@ -1,4 +1,4 @@
|
|||
CMake Error at OldIface.cmake:8 \(export\):
|
||||
CMake Error at OldIface.cmake:[0-9]+ \(export\):
|
||||
export EXPORT signature does not recognise the
|
||||
EXPORT_LINK_INTERFACE_LIBRARIES option.
|
||||
Call Stack \(most recent call first\):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
enable_language(CXX)
|
||||
add_library(foo empty.cpp)
|
||||
export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
|
||||
install(TARGETS foo EXPORT fooExport
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
include(RunCMake)
|
||||
|
||||
run_cmake(CustomTarget)
|
||||
run_cmake(TargetNotFound)
|
||||
run_cmake(AppendExport)
|
||||
run_cmake(OldIface)
|
||||
|
|
Loading…
Reference in New Issue