Skip to content

Commit 49c329e

Browse files
committed
Build samples and tests with AV_ENABLE_SHARED disabled
Define avcpp::avcpp target always: - If AV_ENABLE_SHARED defined, target points to the Shared version - If AV_ENABLE_SHARED not defined, target points to the Static version On the end system, if target avcpp::avcpp-static present, it points to the static version and avcpp::avcpp points to the shared versions. If avcpp::avcpp-static not present, avcpp::avcpp points to the static version. Fix #81
1 parent f150c61 commit 49c329e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ set(AV_NAMESPACE avcpp)
77
set(AV_BASENAME avcpp)
88

99
# This is a little gross as it compiles everything twice, but it's good enough for my needs.
10-
if (AV_ENABLE_SHARED)
11-
list (APPEND AV_TARGETS ${AV_BASENAME})
12-
endif()
10+
list (APPEND AV_TARGETS ${AV_BASENAME})
1311

14-
if (AV_ENABLE_STATIC)
12+
if (AV_ENABLE_STATIC AND AV_ENABLE_SHARED)
1513
list (APPEND AV_TARGETS ${AV_BASENAME}-static)
1614
endif()
1715

1816
foreach(TARGET ${AV_TARGETS})
19-
set(TYPE SHARED)
17+
2018
if (${TARGET} MATCHES "-static")
2119
set(TYPE STATIC)
20+
else()
21+
if (AV_ENABLE_SHARED)
22+
set(TYPE SHARED)
23+
else()
24+
set(TYPE STATIC)
25+
endif()
2226
endif()
2327

2428
add_library(${TARGET} ${TYPE} ${AV_SOURCES} ${AV_HEADERS})

0 commit comments

Comments
 (0)