diff options
author | Brad King <brad.king@kitware.com> | 2012-03-12 19:02:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-16 14:12:30 (GMT) |
commit | db7ef82402bed3d941bea73d266ac5919f4eee15 (patch) | |
tree | cb4092b57ba538940c6e5ba20843176e6e39c3eb /Tests | |
parent | 5683101669e677b5b8d7b50d817da54156afd626 (diff) | |
download | CMake-db7ef82402bed3d941bea73d266ac5919f4eee15.zip CMake-db7ef82402bed3d941bea73d266ac5919f4eee15.tar.gz CMake-db7ef82402bed3d941bea73d266ac5919f4eee15.tar.bz2 |
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.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake | 15 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/a.cxx | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake b/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake new file mode 100644 index 0000000..0796c21 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake @@ -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() diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index a74eaa8..55db14d 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -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) diff --git a/Tests/RunCMake/ObjectLibrary/a.cxx b/Tests/RunCMake/ObjectLibrary/a.cxx new file mode 100644 index 0000000..ae9c87c --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/a.cxx @@ -0,0 +1 @@ +extern "C" int acxx(void) { return 0; } |