vector-of-bool / cmrc

A Resource Compiler in a Single CMake Script
MIT License
674 stars 74 forks source link

Generate `OBJECT` library instead of `STATIC` #28

Closed drdanz closed 3 years ago

drdanz commented 3 years ago

When installing a STATIC library that includes files using cmrc_add_resource_library, it is necessary to export and install the library generated by CMakeRC as well. This shouldn't be necessary. An option would be to generate an OBJECT library instead of a STATIC library, and to use it with target_sources and target_include_directories instead of linking it with target_link_libraries

drdanz commented 3 years ago

Actually after a few tests, I think that instead of

target_link_libraries(my-program PRIVATE foo::rc)

it is already possible to use

target_sources(my-program PRIVATE $<TARGET_OBJECTS:foo::rc>)
target_include_directories(my-program PRIVATE $<TARGET_PROPERTY:foo::rc,INTERFACE_INCLUDE_DIRECTORIES>)

even if this is a static library.

If I understand correctly, the only difference is that using OBJECT will not create an actual static library.