From 04532aaa3cf5713ac7644aa2077c765bae27d85f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 10 Sep 2021 16:14:29 +0200 Subject: cmake: Fix issues with static builds and CMRC Adds uhd_rc as a link target to static builds of libuhd. This fixes build errors like this: ``` uhd/lib/cal/database.cpp:12:10: fatal error: cmrc/cmrc.hpp: No such file or directory #include ``` This also adds uhd_rc as to $libuhd_libs instead of just listing it separately, and target objects from uhd_rc to $libuhd_sources. --- host/lib/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'host/lib/CMakeLists.txt') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index fd316221c..78cce3e97 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -136,6 +136,7 @@ endif(ENABLE_C_API) # Add common resource compiler subdirectory ######################################################################## add_subdirectory(rc) +LIBUHD_APPEND_LIBS(uhd_rc) ######################################################################## # Add DLL resource file to Windows build @@ -179,7 +180,7 @@ if(ENABLE_MPMD) list(APPEND libuhd_sources $) endif() add_library(uhd SHARED ${libuhd_sources}) -target_link_libraries(uhd ${Boost_LIBRARIES} ${libuhd_libs} uhd_rc) +target_link_libraries(uhd ${Boost_LIBRARIES} ${libuhd_libs}) set_target_properties(uhd PROPERTIES DEFINE_SYMBOL "UHD_DLL_EXPORTS") if(NOT LIBUHDDEV_PKG) set_target_properties(uhd PROPERTIES SOVERSION "${UHD_ABI_VERSION}") @@ -221,9 +222,10 @@ endif(NOT UHDHOST_PKG) # Setup libuhd library (static) ####################################################### if(ENABLE_STATIC_LIBS) - add_library(uhd_static STATIC ${libuhd_sources}) + add_library(uhd_static STATIC ${libuhd_sources} $) set_target_properties(uhd_static PROPERTIES OUTPUT_NAME uhd) set_target_properties(uhd_static PROPERTIES COMPILE_DEFINITIONS UHD_STATIC_LIB) + target_link_libraries(uhd_static uhd_rc) install(TARGETS uhd_static ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib or .a file ) -- cgit v1.2.3