diff --git a/CMakeLists.txt b/CMakeLists.txt index c3e3ae3baf5d..b657271f69d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,10 @@ add_library(sof_options INTERFACE) target_link_libraries(sof_options INTERFACE sof_public_headers) +# interface library that is used only as container for sof statically +# linked libraries +add_library(sof_static_libraries INTERFACE) + # get compiler name and version execute_process( COMMAND ${CMAKE_C_COMPILER} --version @@ -117,6 +121,7 @@ target_include_directories(sof_public_headers INTERFACE ${GENERATED_DIRECTORY}/i if(BUILD_LIBRARY) add_library(sof SHARED "") target_link_libraries(sof PRIVATE sof_options) + target_link_libraries(sof PRIVATE sof_static_libraries) install(TARGETS sof DESTINATION lib) add_subdirectory(src) @@ -166,9 +171,8 @@ add_executable(sof "") target_link_libraries(sof PRIVATE sof_options) target_link_libraries(sof PRIVATE sof_ld_scripts) target_link_libraries(sof PRIVATE sof_ld_flags) +target_link_libraries(sof PRIVATE sof_static_libraries) sof_add_build_counter_rule() add_subdirectory(src) - -target_link_libraries(sof PRIVATE sof_lib) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index 832d0fe39eda..1e23bb4cfce8 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -154,24 +154,21 @@ add_local_sources(sof exc-dump.S ) -add_library(sof_lib INTERFACE) -target_link_libraries(sof_lib INTERFACE sof_options) - # TODO: order of these libraries does matter, what is bad, # we should switch to building with thin archives without symbols index # and made it before final link so dependencies won't matter -target_link_libraries(sof_lib INTERFACE xtos) -target_link_libraries(sof_lib INTERFACE hal) +target_link_libraries(sof_static_libraries INTERFACE xtos) +target_link_libraries(sof_static_libraries INTERFACE hal) -target_link_libraries(sof_lib INTERFACE xlevel2) -target_link_libraries(sof_lib INTERFACE xlevel3) -target_link_libraries(sof_lib INTERFACE xlevel4) -target_link_libraries(sof_lib INTERFACE xlevel5) +target_link_libraries(sof_static_libraries INTERFACE xlevel2) +target_link_libraries(sof_static_libraries INTERFACE xlevel3) +target_link_libraries(sof_static_libraries INTERFACE xlevel4) +target_link_libraries(sof_static_libraries INTERFACE xlevel5) if(build_bootloader) add_local_sources(sof main-entry.S) else() - target_link_libraries(sof_lib INTERFACE reset) + target_link_libraries(sof_static_libraries INTERFACE reset) endif() target_link_libraries(sof_ld_flags INTERFACE "-lgcc")