Skip to content

Commit 8efa2ea

Browse files
cchampetClement Champetier
authored andcommitted
CMake avplay: do not build the app if OpenGL or GLUT are not found
* Print a warning if avplay app can't be built. * Allow the user to build avTranscoder library even if dependencies of this app are not found. * fix #94
1 parent e325ae9 commit 8efa2ea

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

app/cpp/avplay/CMakeLists.txt

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,32 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
55
include(AvTranscoderMacros)
66

77
# Build app
8-
find_package(OpenGL REQUIRED)
9-
find_package(GLUT REQUIRED)
8+
find_package(OpenGL)
9+
if(OPENGL_FOUND)
10+
find_package(GLUT)
11+
if(GLUT_FOUND)
12+
include_directories(${AVTRANSCODER_SRC_PATH} ${FFMPEG_INCLUDE_DIR})
13+
include_directories( ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} )
1014

11-
include_directories(${AVTRANSCODER_SRC_PATH} ${FFMPEG_INCLUDE_DIR})
12-
include_directories( ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} )
15+
file(GLOB AVPLAY_SRC_FILES "*.cpp" "*.hpp")
16+
add_executable(avplay ${AVPLAY_SRC_FILES})
17+
set_target_properties(avplay PROPERTIES VERSION ${AVTRANSCODER_VERSION})
18+
target_link_libraries(avplay avtranscoder-shared ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
1319

14-
file(GLOB AVPLAY_SRC_FILES "*.cpp" "*.hpp")
15-
add_executable(avplay ${AVPLAY_SRC_FILES})
16-
set_target_properties(avplay PROPERTIES VERSION ${AVTRANSCODER_VERSION})
17-
target_link_libraries(avplay avtranscoder-shared ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
18-
19-
# Install app
20-
install(
21-
FILES "${CMAKE_CURRENT_BINARY_DIR}/avplay" "${CMAKE_CURRENT_BINARY_DIR}/avplay-${AVTRANSCODER_VERSION}"
22-
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
23-
DESTINATION "bin/"
24-
)
25-
install(
26-
FILES ${CMAKE_CURRENT_SOURCE_DIR}/avplayer.man
27-
RENAME avplayer.1
28-
DESTINATION "share/man/man1/"
29-
)
20+
# Install app
21+
install(
22+
FILES "${CMAKE_CURRENT_BINARY_DIR}/avplay" "${CMAKE_CURRENT_BINARY_DIR}/avplay-${AVTRANSCODER_VERSION}"
23+
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
24+
DESTINATION "bin/"
25+
)
26+
install(
27+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/avplayer.man
28+
RENAME avplayer.1
29+
DESTINATION "share/man/man1/"
30+
)
31+
else()
32+
message("GLUT not found, will not build avplay app.")
33+
endif()
34+
else()
35+
message("OpenGL not found, will not build avplay app.")
36+
endif()

0 commit comments

Comments
 (0)