summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-12-30 14:35:08 +0100
committerStephen Kelly <steveire@gmail.com>2014-01-06 17:25:10 +0100
commit7461d67cf37a40ce5a6c20e8eaf4cbfff1c7d27e (patch)
treee09a7efebac382478ed1392cec6c59c2bd391a79
parent7fc6e3d607c79c1124b2ac93fac0dcddc326ef66 (diff)
downloadcmake-7461d67cf37a40ce5a6c20e8eaf4cbfff1c7d27e.tar.gz
cmTarget: Enable convenient include dir handling for INTERFACE_LIBRARY.
Make the CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE variable affect INTERFACE_LIBRARY targets.
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt4
-rw-r--r--Tests/InterfaceLibrary/definetestexe.cpp12
-rw-r--r--Tests/InterfaceLibrary/headerdir/CMakeLists.txt8
-rw-r--r--Tests/InterfaceLibrary/headerdir/iface_header.h1
6 files changed, 27 insertions, 3 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3b858afd4b..0b58a45e88 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1337,13 +1337,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
cmTarget* t = &ti->second;
+ t->AppendBuildInterfaceIncludes();
+
if (t->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
- t->AppendBuildInterfaceIncludes();
-
for (std::vector<cmValueWithOrigin>::const_iterator it
= noconfig_compile_definitions.begin();
it != noconfig_compile_definitions.end(); ++it)
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b51ea2a04f..91bd90fa59 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1606,6 +1606,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
if(this->GetType() != cmTarget::SHARED_LIBRARY &&
this->GetType() != cmTarget::STATIC_LIBRARY &&
this->GetType() != cmTarget::MODULE_LIBRARY &&
+ this->GetType() != cmTarget::INTERFACE_LIBRARY &&
!this->IsExecutableWithExports())
{
return;
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index 8154cedad7..396a84af95 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -6,8 +6,10 @@ project(InterfaceLibrary)
add_library(iface_nodepends INTERFACE)
target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE)
+add_subdirectory(headerdir)
+
add_executable(InterfaceLibrary definetestexe.cpp)
-target_link_libraries(InterfaceLibrary iface_nodepends)
+target_link_libraries(InterfaceLibrary iface_nodepends headeriface)
add_subdirectory(libsdir)
diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp
index decd37c51d..e7a10c171f 100644
--- a/Tests/InterfaceLibrary/definetestexe.cpp
+++ b/Tests/InterfaceLibrary/definetestexe.cpp
@@ -3,6 +3,18 @@
#error Expected IFACE_DEFINE
#endif
+#include "iface_header.h"
+
+#ifndef IFACE_HEADER_SRCDIR
+#error Expected IFACE_HEADER_SRCDIR
+#endif
+
+#include "iface_header_builddir.h"
+
+#ifndef IFACE_HEADER_BUILDDIR
+#error Expected IFACE_HEADER_BUILDDIR
+#endif
+
int main(int,char**)
{
return 0;
diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
new file mode 100644
index 0000000000..98f521e8ce
--- /dev/null
+++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
@@ -0,0 +1,8 @@
+
+set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+
+add_library(headeriface INTERFACE)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h"
+ "#define IFACE_HEADER_BUILDDIR\n"
+)
diff --git a/Tests/InterfaceLibrary/headerdir/iface_header.h b/Tests/InterfaceLibrary/headerdir/iface_header.h
new file mode 100644
index 0000000000..82dd157492
--- /dev/null
+++ b/Tests/InterfaceLibrary/headerdir/iface_header.h
@@ -0,0 +1 @@
+#define IFACE_HEADER_SRCDIR