INTERFACE library not getting installed and no error reported

After INTERFACE (header only library) is added with add_library and setting of INTERFACE for BUILD_INTERFACE and INSTALL_INTERFACE with target_include_directories, followed by install(TARGETS EXPORT and install(EXPORTS (see details below), the INTERFACE library is not installed. There were generated and configuration and generation phases completed successfully. Then make install passed fine but INTERFACE library was not installed.
It could be installed directly via install(DIRECTORY but that is not acceptable method. Attempts to get it installed as a dependent library to main mylib SHARED library also did not succeed.
Could you please advise how this should be done.
EXPECTED RESULTS:
${ARCHITECTURE}/myintlib/include DIR is created
ACTUAL RESULTS
no ${ARCHITECTURE}/myintlib/include DIR is created
CODE FLOW:
add_library(myintlib INTERFACE)
target_include_directories(myintlib
INTERFACE
$<BUILD_INTERFACE:${IMPORTED_LOCATION_ROOT}/include>
$<INSTALL_INTERFACE:${ARCHITECTURE}/myintlib/include>
)

target_link_libraries(mylib …
myintlib
)

install(TARGETS myintlib
EXPORT ${proj_targets_export_name}
CONFIGURATIONS ${CMAKE_BUILD_TYPE}
INCLUDES DESTINATION ${CMAKE_INSTALL_PREFIX}/myintlib/include
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(EXPORT ${proj_targets_export_name}
DESTINATION “${CONFIG_INSTALL_DIR}”
FILE ${proj_targets_export_filename}
COMPONENT ${PROJECT_NAME}_Development

)
Note: the builtTargets obtained as get_directory_property(builtTargets BUILDSYSTEM_TARGETS) lists mintlib

What are you expecting to happen vs. what you’re seeing? Is myintlib mentioned in the installed -targets.cmake file?

expected results- ${ARCHITECTURE}/myintlib/include DIR is created and this is not happening.
Other non-INTERFACE (SHARED or STATIC) libraries (e.g. add_library(xyzlib SHARED) and main mylib) are installed properly. The myTarget.cmake (proj_targets_export_name) file does contain commands to import myintlib:

# Create imported target myintlib
 add_library(myintlib INTERFACE IMPORTED) , set_target_properties(myintlib PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/.../myintlib/;....myintlib/include"
)

and lists myintlib in INTERFACE_LINK_LIBRARIES property of mylib as normal

Hmm. I’ve not used HEADERS DESTINATION myself. Maybe this is an oversight?

Cc: @kyle.edwards @craig.scott

What do you mean by that? Do you call “headers-only-library” as HEADERS? That would correspond to cmake INTERFACE library. So are you doubting that cmake 3.17 I use actually supports installation of INTERFACE library despite documentation indications?

I’ve used INTERFACE libraries, but I haven’t used HEADERS DESTINATION to install the headers. I’ve used install(FILES) for a while (mainly out of habit).

I have not used “HEADERS DESTINATION” either so I assume you meant INCLUDES DESTINATION ${CMAKE_INSTALL_PREFIX}/myintlib/include. Or maybe you meant " PUBLIC_HEADER DESTINATION …include" ? Then would not I need to use PUBLIC, not INTERFAC Ein the add_library? The approach with install(FILES…) works but I want to use modern cmake approach with referencing only targets and setting their properties. So could you please check with Craig?

D’oh. Yes, INCLUDES DESTINATION. Sorry. Obviously I haven’t used this codepath myself much :slight_smile: .

NP, is theere a way to to contact other cmake developers on this? Thank you.

I’ve pinged them above. I don’t know their schedules though.

You aren’t specifying an install rule to copy the include folder. You can take this project for a working example: KonanM/tser

Thank you for looking into this, but the install rule for include folder is specified in the statement “INCLUDES DESTINATION” see lines above

Blockquote

install(TARGETS myintlib

INCLUDES DESTINATION ${CMAKE_INSTALL_PREFIX}/myintlib/include

Blockquote
The sample project you referring to uses the same statement, so the question is why the installation got blocked

INCLUDES DESTINATION is a special form that populates the INTERFACE_INCLUDE_DIRECTORIES property of the target(s) in the generated targets file. Obviously, there has to be something where that path is pointing to. See lines 55 and 56.

Yes it is and it is present as per my issue description and path ${CMAKE_INSTALL_PREFIX}/myintlib/include is a valid path. Again as I mentioned before when installing from the same path using install(DIRECTORY ) it gets installed fine.Your example KonnaM/tser illustrate the problem as it uses install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${tser_include_directory}") direct install instead of modern cmake approach using targets only. install(TARGETS …), install(EXPORTS…) should be sufficient to install target with its INCLUDE directory. This works fine for non INTERFACE targets (SHARED or STATIC) and should be working without use of install(DIRECTORY). So could you please use your own example to investigate the issue? Thanks

You seem to be mixing things up a lot. The repository in question is using modern CMake techniques.
You might want to either sink your teeth into the documentation or buy Craig Scott’s book.