diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 5cc4272ab..0d2080978 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -42,9 +42,9 @@ add_library(commissioner-app target_link_libraries(commissioner-app PUBLIC commissioner - commissioner-common + commissioner-common-headers PRIVATE - fmt::fmt + fmt::fmt-header-only mdns nlohmann_json::nlohmann_json ) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index f6222b4f5..134d679eb 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -26,7 +26,19 @@ # POSSIBILITY OF SUCH DAMAGE. # -add_library(commissioner-common +add_library(commissioner-common-headers INTERFACE) + +target_link_libraries(commissioner-common-headers + INTERFACE fmt::fmt-header-only +) + +target_include_directories(commissioner-common-headers + INTERFACE + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/src +) + +add_library(commissioner-common-objects OBJECT address.cpp address.hpp error.cpp @@ -37,23 +49,10 @@ add_library(commissioner-common utils.hpp ) -target_link_libraries(commissioner-common - PUBLIC fmt::fmt +target_link_libraries(commissioner-common-objects + PUBLIC commissioner-common-headers ) -target_include_directories(commissioner-common - PRIVATE - ${PROJECT_SOURCE_DIR}/include - ${PROJECT_SOURCE_DIR}/src -) - -if (BUILD_SHARED_LIBS) - install(TARGETS commissioner-common - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - ) -endif() - if (OT_COMM_TEST) add_library(commissioner-common-test OBJECT address.hpp diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt index 57c9edf39..96341087a 100644 --- a/src/java/CMakeLists.txt +++ b/src/java/CMakeLists.txt @@ -57,7 +57,6 @@ swig_add_library(commissioner-java swig_link_libraries(commissioner-java commissioner - commissioner-common ) ## GCC is too strict on this in optimization mode, see http://www.swig.org/Doc3.0/Java.html#Java_compiling_dynamic diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index 9087a154c..6fbf44f08 100644 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -80,11 +80,11 @@ target_link_libraries(commissioner mbedtls mbedx509 mbedcrypto - fmt::fmt + fmt::fmt-header-only event_core event_pthreads $<$>:pthread> - commissioner-common + $ ) target_compile_definitions(commissioner @@ -121,7 +121,6 @@ if (BUILD_SHARED_LIBS) $ $ $ - $ $ $ DESTINATION lib @@ -165,12 +164,11 @@ if (OT_COMM_TEST) mbedtls mbedx509 mbedcrypto - fmt::fmt + fmt::fmt-header-only event_core event_pthreads commissioner $<$:commissioner-app> - commissioner-common ) target_compile_definitions(commissioner-test