add_library: Fix INTERFACE on platforms with no shared libs (#14561)

This commit is contained in:
Stephen Kelly 2013-11-12 10:13:15 +01:00 committed by Brad King
parent 13da9f0024
commit 64f73b0fb6
4 changed files with 8 additions and 0 deletions

View File

@ -229,6 +229,7 @@ bool cmAddLibraryCommand
yet its linker language. */ yet its linker language. */
if ((type != cmTarget::STATIC_LIBRARY) && if ((type != cmTarget::STATIC_LIBRARY) &&
(type != cmTarget::OBJECT_LIBRARY) && (type != cmTarget::OBJECT_LIBRARY) &&
(type != cmTarget::INTERFACE_LIBRARY) &&
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool( (this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false)) "TARGET_SUPPORTS_SHARED_LIBS") == false))
{ {

View File

@ -2,3 +2,4 @@ include(RunCMake)
run_cmake(invalid_name) run_cmake(invalid_name)
run_cmake(target_commands) run_cmake(target_commands)
run_cmake(no_shared_libs)

View File

@ -0,0 +1 @@
^$

View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.8.12.20131009)
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
add_library(foo INTERFACE)
target_compile_definitions(foo INTERFACE FOO_DEFINE)