CMakeLists.txt: add ENABLE_STATIC option

parent 656563e2
...@@ -36,7 +36,7 @@ set(VERSION "${PACKAGE_VERSION}") ...@@ -36,7 +36,7 @@ set(VERSION "${PACKAGE_VERSION}")
option(ENABLE_TESTS "Enable compilation of the tests." No) option(ENABLE_TESTS "Enable compilation of the tests." No)
option(ENABLE_MSPLUGIN "Enable compilation of the mediastreamer2 plugin." Yes) option(ENABLE_MSPLUGIN "Enable compilation of the mediastreamer2 plugin." Yes)
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
if(ENABLE_MSPLUGIN) if(ENABLE_MSPLUGIN)
find_package(Mediastreamer2) find_package(Mediastreamer2)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
# #
############################################################################ ############################################################################
set(BCG729_SOURCE_FILES set(SOURCE_FILES
adaptativeCodebookSearch.c adaptativeCodebookSearch.c
codebooks.c codebooks.c
computeAdaptativeCodebookGain.c computeAdaptativeCodebookGain.c
...@@ -46,16 +46,20 @@ set(BCG729_SOURCE_FILES ...@@ -46,16 +46,20 @@ set(BCG729_SOURCE_FILES
utils.c utils.c
) )
add_library(bcg729 SHARED ${BCG729_SOURCE_FILES}) if (ENABLE_STATIC)
set_target_properties(bcg729 PROPERTIES VERSION 0) add_library(bcg729 STATIC ${SOURCE_FILES})
if(MSVC) else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_library(bcg729 SHARED ${SOURCE_FILES})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libbcg729.pdb set_target_properties(bcg729 PROPERTIES VERSION 0)
DESTINATION bin if(MSVC)
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE if(CMAKE_BUILD_TYPE STREQUAL "Debug")
) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libbcg729.pdb
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
set_target_properties(bcg729 PROPERTIES PREFIX "lib")
endif() endif()
set_target_properties(bcg729 PROPERTIES PREFIX "lib")
endif() endif()
install(TARGETS bcg729 EXPORT Bcg729Targets install(TARGETS bcg729 EXPORT Bcg729Targets
...@@ -65,8 +69,8 @@ install(TARGETS bcg729 EXPORT Bcg729Targets ...@@ -65,8 +69,8 @@ install(TARGETS bcg729 EXPORT Bcg729Targets
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
set(ABS_BCG729_SOURCE_FILES ) set(ABS_SOURCE_FILES )
foreach(elem ${BCG729_SOURCE_FILES}) foreach(elem ${SOURCE_FILES})
list(APPEND ABS_BCG729_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${elem}") list(APPEND ABS_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${elem}")
endforeach() endforeach()
set(BCG729_SOURCE_FILES ${ABS_BCG729_SOURCE_FILES} PARENT_SCOPE) set(SOURCE_FILES ${ABS_SOURCE_FILES} PARENT_SCOPE)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment