cmTarget: Enable convenient include dir handling for INTERFACE_LIBRARY.
Make the CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE variable affect INTERFACE_LIBRARY targets.
This commit is contained in:
parent
7fc6e3d607
commit
7461d67cf3
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
#define IFACE_HEADER_SRCDIR
|
Loading…
Reference in New Issue