mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-09 00:29:55 -06:00
INTERFACE libraries were created with the intention of collecting usage requirements for use by other targets via `target_link_libraries`. Therefore they were not allowed to have SOURCES and were not included in the generated buildsystem. In practice, this has become limiting: * Header-only libraries do have sources, they just do not compile. Developers should be able to edit those sources (the header files) in their IDE. * Header-only libraries may need to generate some of their header files via custom commands. Some projects work around these limitations by pairing each interface library with an `add_custom_target` that makes the header files and custom commands appear in the generated buildsystem and in IDEs. Lift such limitations by allowing INTERFACE libraries to have SOURCES. For those with sources, add a corresponding build target to the generated buildsystem. Fixes: #19145
21 lines
638 B
CMake
21 lines
638 B
CMake
|
|
|
|
add_library(iface3 STATIC INTERFACE)
|
|
add_library(iface4 STATIC INTERFACE empty.cpp)
|
|
add_library(iface5 SHARED INTERFACE)
|
|
add_library(iface6 MODULE INTERFACE)
|
|
add_library(iface7 OBJECT INTERFACE)
|
|
add_library(iface8 UNKNOWN INTERFACE)
|
|
add_library(iface9 INTERFACE STATIC)
|
|
add_library(iface10 INTERFACE SHARED)
|
|
add_library(iface11 INTERFACE MODULE)
|
|
add_library(iface12 INTERFACE OBJECT)
|
|
add_library(iface13 INTERFACE UNKNOWN)
|
|
add_library(iface14 INTERFACE ALIAS)
|
|
add_library(iface15 ALIAS INTERFACE)
|
|
add_library(iface16 INTERFACE INTERFACE)
|
|
|
|
|
|
# add_library(iface19 GLOBAL INTERFACE) Tested separately
|
|
add_library(iface20 INTERFACE GLOBAL)
|