diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b110377..b1fb9bb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -461,7 +461,9 @@ if(ENABLE_PLAYER AND ENABLE_FFMPEG) endif() #MediaServer主程序 -add_subdirectory(server) +if(ENABLE_SERVER) + add_subdirectory(server) +endif() # Android 会 add_subdirectory 并依赖该变量 if(ENABLE_SERVER_LIB) diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index c7962a0f..851bb3c5 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -74,8 +74,6 @@ generate_export_header(mk_api STATIC_DEFINE MediaKitApi_STATIC EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/mk_export.h") -add_subdirectory(tests) - file(GLOB API_HEADER_LIST include/*.h ${CMAKE_CURRENT_BINARY_DIR}/*.h) install(FILES ${API_HEADER_LIST} DESTINATION ${INSTALL_PATH_INCLUDE}) @@ -83,3 +81,7 @@ install(TARGETS mk_api ARCHIVE DESTINATION ${INSTALL_PATH_LIB} LIBRARY DESTINATION ${INSTALL_PATH_LIB} RUNTIME DESTINATION ${INSTALL_PATH_RUNTIME}) + +if (ENABLE_TESTS) + add_subdirectory(tests) +endif() diff --git a/api/tests/CMakeLists.txt b/api/tests/CMakeLists.txt index f2875ff6..8108b71b 100644 --- a/api/tests/CMakeLists.txt +++ b/api/tests/CMakeLists.txt @@ -43,15 +43,3 @@ foreach(TEST_SRC ${TEST_SRC_LIST}) target_link_libraries(${exe_name} mk_api) target_compile_options(${exe_name} PRIVATE ${COMPILE_OPTIONS_DEFAULT}) endforeach() - - - - - - - - - - - - diff --git a/api/tests/pusher.c b/api/tests/pusher.c index a6f3cd2d..2014fd09 100644 --- a/api/tests/pusher.c +++ b/api/tests/pusher.c @@ -9,6 +9,7 @@ */ #include +#include #include "mk_mediakit.h" typedef struct { diff --git a/api/tests/server.c b/api/tests/server.c index 8b283b6b..d331519c 100644 --- a/api/tests/server.c +++ b/api/tests/server.c @@ -9,6 +9,7 @@ */ #include +#include #include "mk_mediakit.h" #define LOG_LEV 4