CMakeLists.txt: add ENABLE_STATIC option

parent 656563e2
......@@ -36,7 +36,7 @@ set(VERSION "${PACKAGE_VERSION}")
option(ENABLE_TESTS "Enable compilation of the tests." No)
option(ENABLE_MSPLUGIN "Enable compilation of the mediastreamer2 plugin." Yes)
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
if(ENABLE_MSPLUGIN)
find_package(Mediastreamer2)
......
......@@ -20,7 +20,7 @@
#
############################################################################
set(BCG729_SOURCE_FILES
set(SOURCE_FILES
adaptativeCodebookSearch.c
codebooks.c
computeAdaptativeCodebookGain.c
......@@ -46,9 +46,12 @@ set(BCG729_SOURCE_FILES
utils.c
)
add_library(bcg729 SHARED ${BCG729_SOURCE_FILES})
set_target_properties(bcg729 PROPERTIES VERSION 0)
if(MSVC)
if (ENABLE_STATIC)
add_library(bcg729 STATIC ${SOURCE_FILES})
else()
add_library(bcg729 SHARED ${SOURCE_FILES})
set_target_properties(bcg729 PROPERTIES VERSION 0)
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libbcg729.pdb
DESTINATION bin
......@@ -56,6 +59,7 @@ if(MSVC)
)
endif()
set_target_properties(bcg729 PROPERTIES PREFIX "lib")
endif()
endif()
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
)
set(ABS_BCG729_SOURCE_FILES )
foreach(elem ${BCG729_SOURCE_FILES})
list(APPEND ABS_BCG729_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${elem}")
set(ABS_SOURCE_FILES )
foreach(elem ${SOURCE_FILES})
list(APPEND ABS_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${elem}")
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