View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015788CMakeCMakepublic2015-10-13 11:472016-03-07 09:12
ReporterSunBlack 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSWindowsOS Version8.1
Product VersionCMake 3.3.2 
Target VersionFixed in Version 
Summary0015788: Error during export target, which has additional defined include directories with target_include_directories
DescriptionIf you have a static library and want to add necessary include directories with target_include_directories so users of this library just need to add library with target_link_libraries (and don't need to add includes with include_directories), I currently got

%%Configuring done
CMake Error in CMakeLists.txt:
  Target "myProject" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "D:/myProjectDir/myIncludeDir"

  which is prefixed in the source directory.


Generating done%%

Source code:
%%cmake_minimum_required(VERSION 3.3)

project(myProject)

add_library(${PROJECT_NAME}
    mySourceDir/test.cpp
    myIncludeDir/test.h
)

target_include_directories(${PROJECT_NAME} PUBLIC "myIncludeDir")

install(TARGETS ${PROJECT_NAME}
    EXPORT MyTargets
    ARCHIVE DESTINATION lib
)

install(EXPORT MyTargets DESTINATION cmake)%%

This message don't occurs, if I remove install.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0039594)
Brad King (manager)
2015-10-13 11:52

This is a feature. CMake is preventing you from adding a public dependency on your source tree for users of your install tree. See the $<BUILD_INTERFACE:...> and $<INSTALL_INTERFACE:...> expressions and the example here:

 https://cmake.org/cmake/help/v3.4/manual/cmake-buildsystem.7.html#include-directories-and-usage-requirements [^]
(0040616)
Robert Maynard (manager)
2016-03-07 09:12

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-10-13 11:47 SunBlack New Issue
2015-10-13 11:52 Brad King Note Added: 0039594
2015-10-13 11:52 Brad King Status new => resolved
2015-10-13 11:52 Brad King Resolution open => no change required
2016-03-07 09:12 Robert Maynard Note Added: 0040616
2016-03-07 09:12 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team