I would like to merge several static lib files into one single lib using CMake and Visual Studio (lib.exe). I would like to pass a file list to the linker by setting
set_target_properties(biglib PROPERTIES STATIC_LIBRARY_FLAGS "/unknown/path/lib1.lib /unknown/path/lib2.lib") However, the path is unknown at configure time. So I tried to use generator expressions:
set_target_properties(biglib PROPERTIES STATIC_LIBRARY_FLAGS "$<TARGET_FILE:lib1> $<TARGET_FILE:lib2>") lib1 and lib2 are internal library targets defined somewhere else. The expression don't seem to be evaluated since the linker is searching for $<TARGET_FILE:lib1> which of course is not found.
I don't know if what I'm trying to do is going to work. Maybe someone can explain how to actually use generator expressions in such a case. Do I need to use add_custom_command somehow?
add_custom_commandwould be more appropriate here: merging libraries is differs from building them.