diff --git a/CMakeLists.txt b/CMakeLists.txt index f940151f4..85a948242 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,16 +300,17 @@ if(NOT WIN32) add_subdirectory(vendor) endif(NOT WIN32) +function(add_log_tag target) + get_target_property(TARGET_SRCS ${target} SOURCES) + foreach(F ${TARGET_SRCS}) + set_source_files_properties(${F} PROPERTIES COMPILE_FLAGS -DLOG_TAG=\\\"${F}\\\") + endforeach(F) +endfunction() + add_subdirectory(crypto) add_subdirectory(libutp) add_subdirectory(llarp) -set(ALL_SRC ${EXE_SRC} ${LIB_PLATFORM_SRC} ${LIB_SRC}) - -foreach(F ${ALL_SRC}) - set_source_files_properties(${F} PROPERTIES COMPILE_FLAGS -DLOG_TAG=\\\"${F}\\\") -endforeach(F) - if(SHADOW) add_shadow_plugin(shadow-plugin-${SHARED_LIB} ${EXE_SRC} ${LIB_SRC} ${UTP_SRC} ${LIB_PLATFORM_SRC} ${CPP_BACKPORT_SRC} ${ABYSS_SRC} ${CRYPTOGRAPHY_SRC}) target_link_libraries(shadow-plugin-${SHARED_LIB} ${LIBS}) @@ -321,6 +322,8 @@ else() add_executable(${EXE} ${EXE_SRC} llarp/win32/version.rc) endif(NOT WIN32) + add_log_tag(${EXE}) + install(TARGETS ${EXE} RUNTIME DESTINATION bin) if(WIN32) install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap.exe DESTINATION bin) @@ -341,6 +344,7 @@ else() if(ANDROID) add_library(${ANDROID_LIB} SHARED jni/lokinet_android.cpp) + add_log_tag(${ANDROID_LIB}) target_link_libraries(${ANDROID_LIB} ${STATIC_LIB} ${LIBS}) endif(ANDROID) endif(SHADOW) @@ -357,7 +361,6 @@ if(USE_LIBABYSS) ${ABYSS}/src/json.cpp) add_library(${ABYSS_LIB} STATIC ${ABYSS_SRC}) target_link_libraries(${ABYSS_LIB} PUBLIC ${PLATFORM_LIB}) - list(APPEND ALL_SRC ${ABYSS_SRC} ${ABYSS}/main.cpp) if (NOT WIN32) add_executable(${ABYSS_EXE} ${ABYSS}/main.cpp) @@ -367,6 +370,9 @@ if(USE_LIBABYSS) target_link_libraries(${ABYSS_EXE} PUBLIC ${ABYSS_LIB} ${STATIC_LIB} ws2_32) endif(NOT WIN32) + add_log_tag(${ABYSS_EXE}) + add_log_tag(${ABYSS_LIB}) + target_include_directories(${UTIL_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include") target_include_directories(${ABYSS_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include") target_include_directories(${ABYSS_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include") diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index ce36e2651..6eadc39d4 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -112,4 +112,5 @@ set(CRYPTOGRAPHY_SRC ${NTRU_SRC}) add_library(${CRYPTOGRAPHY_LIB} STATIC ${CRYPTOGRAPHY_SRC}) +add_log_tag(${CRYPTOGRAPHY_LIB}) target_include_directories (${CRYPTOGRAPHY_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") diff --git a/libutp/CMakeLists.txt b/libutp/CMakeLists.txt index 81ea83a0b..e089e94ec 100644 --- a/libutp/CMakeLists.txt +++ b/libutp/CMakeLists.txt @@ -15,4 +15,5 @@ add_library(libutp STATIC ${UTP_SRC}) if(WIN32) target_link_libraries(libutp ws2_32) endif(WIN32) -target_include_directories(libutp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CORE_INCLUDE}) \ No newline at end of file +target_include_directories(libutp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CORE_INCLUDE}) +add_log_tag(libutp) diff --git a/llarp/CMakeLists.txt b/llarp/CMakeLists.txt index 24bee59db..7a27a43c7 100644 --- a/llarp/CMakeLists.txt +++ b/llarp/CMakeLists.txt @@ -220,4 +220,9 @@ if(WITH_SHARED) target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} libutp ${PLATFORM_LIB} Threads::Threads) install(TARGETS ${SHARED_LIB} LIBRARY DESTINATION lib) endif() + add_log_tag(${SHARED_LIB}) endif() + +add_log_tag(${UTIL_LIB}) +add_log_tag(${PLATFORM_LIB}) +add_log_tag(${STATIC_LIB})