summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-11-12 09:13:15 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-12 14:07:10 (GMT)
commit64f73b0fb630f3ecc2f94e3e5b4ab2d1cc117f50 (patch)
tree4216d47789b5c834db0beb6a1db68aa8cccbf8cc
parent13da9f00245694d3dee9f4c9b245f0e3941284c5 (diff)
downloadCMake-64f73b0fb630f3ecc2f94e3e5b4ab2d1cc117f50.zip
CMake-64f73b0fb630f3ecc2f94e3e5b4ab2d1cc117f50.tar.gz
CMake-64f73b0fb630f3ecc2f94e3e5b4ab2d1cc117f50.tar.bz2
add_library: Fix INTERFACE on platforms with no shared libs (#14561)
-rw-r--r--Source/cmAddLibraryCommand.cxx1
-rw-r--r--Tests/RunCMake/interface_library/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/interface_library/no_shared_libs-stderr.txt1
-rw-r--r--Tests/RunCMake/interface_library/no_shared_libs.cmake5
4 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 4c591b6..e9c5d6b 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -229,6 +229,7 @@ bool cmAddLibraryCommand
yet its linker language. */
if ((type != cmTarget::STATIC_LIBRARY) &&
(type != cmTarget::OBJECT_LIBRARY) &&
+ (type != cmTarget::INTERFACE_LIBRARY) &&
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{
diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
index 56caf68..7375888 100644
--- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
@@ -2,3 +2,4 @@ include(RunCMake)
run_cmake(invalid_name)
run_cmake(target_commands)
+run_cmake(no_shared_libs)
diff --git a/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt b/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/interface_library/no_shared_libs.cmake b/Tests/RunCMake/interface_library/no_shared_libs.cmake
new file mode 100644
index 0000000..ed81878
--- /dev/null
+++ b/Tests/RunCMake/interface_library/no_shared_libs.cmake
@@ -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)