可以自定义选择编译某特性

This commit is contained in:
xiongziliang
2019-04-04 11:30:57 +08:00
parent 8169e57d1a
commit 87afd61616
7 changed files with 62 additions and 177 deletions

View File

@@ -5,7 +5,7 @@ find_package(SDL2 QUIET)
if (SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${SDL2_LIBRARY})
message(STATUS "found SDL2:${SDL2_INCLUDE_DIR},${SDL2_LIBRARY}")
message(STATUS "found library:${SDL2_LIBRARY}")
endif (SDL2_FOUND)
#查找ffmpeg/libutil是否安装
@@ -13,7 +13,7 @@ find_package(AVUTIL QUIET)
if(AVUTIL_FOUND)
include_directories(${AVUTIL_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${AVUTIL_LIBRARIES})
message(STATUS "found libutil ${AVUTIL_LIBRARIES}")
message(STATUS "found library:${AVUTIL_LIBRARIES}")
endif()
#查找ffmpeg/libavcodec是否安装
@@ -21,13 +21,12 @@ find_package(AVCODEC QUIET)
if(AVCODEC_FOUND)
include_directories(${AVCODEC_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${AVCODEC_LIBRARIES})
message(STATUS "found libavcodec ${AVCODEC_LIBRARIES}")
message(STATUS "found library:${AVCODEC_LIBRARIES}")
endif()
aux_source_directory(. TEST_SRC_LIST)
#如果ffmpeg/libavcodec ffmpeg/libavcodec SDL 都安装了则编译 test_player
if(SDL2_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND)
message(STATUS "test_player will be compiled")
else()
message(STATUS "test_player ingored, please install sdl2 ffmpeg/libavcodec ffmpeg/libavutil")
list(REMOVE_ITEM TEST_SRC_LIST ./test_player.cpp)