Test OBJECT library language propagation

Teach the RunCMake.ObjectLibrary test to verify that languages used in
an OBJECT library are propagated to targets that use it so that the
languages can be included in link analysis.
This commit is contained in:
Brad King 2012-03-12 15:02:42 -04:00
parent 5683101669
commit db7ef82402
3 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,15 @@
enable_language(CXX)
add_library(A OBJECT a.cxx)
add_library(B STATIC a.c $<TARGET_OBJECTS:A>)
# Verify that object library languages are propagated.
export(TARGETS B NAMESPACE Exp FILE BExport.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/BExport.cmake)
get_property(configs TARGET ExpB PROPERTY IMPORTED_CONFIGURATIONS)
foreach(c ${configs})
get_property(langs TARGET ExpB PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES_${c})
list(FIND langs CXX pos)
if(${pos} LESS 0)
message(FATAL_ERROR "Target export does not list object library languages.")
endif()
endforeach()

View File

@ -6,6 +6,7 @@ run_cmake(BadSourceExpression3)
run_cmake(BadObjSource1)
run_cmake(BadObjSource2)
run_cmake(Export)
run_cmake(ExportLanguages)
run_cmake(Import)
run_cmake(Install)
run_cmake(LinkObjLHS)

View File

@ -0,0 +1 @@
extern "C" int acxx(void) { return 0; }