diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-09-10 16:14:29 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-09-16 11:26:56 -0700 |
commit | 04532aaa3cf5713ac7644aa2077c765bae27d85f (patch) | |
tree | 3473c405ee69f44597ecf76dfe2225cc60e9c64c | |
parent | dc44bfa53ea0a2854ce640d700af8543fc55c795 (diff) | |
download | uhd-04532aaa3cf5713ac7644aa2077c765bae27d85f.tar.gz uhd-04532aaa3cf5713ac7644aa2077c765bae27d85f.tar.bz2 uhd-04532aaa3cf5713ac7644aa2077c765bae27d85f.zip |
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 <cmrc/cmrc.hpp>
```
This also adds uhd_rc as to $libuhd_libs instead of just listing it
separately, and target objects from uhd_rc to $libuhd_sources.
-rw-r--r-- | host/lib/CMakeLists.txt | 6 |
1 files changed, 4 insertions, 2 deletions
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 $<TARGET_OBJECTS:uhd_rpclib>) 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} $<TARGET_OBJECTS:uhd_rc>) 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 ) |