diff --git a/CMLibCommonLibraryTarget.cmake b/CMLibCommonLibraryTarget.cmake index 2a7642d..5c78973 100644 --- a/CMLibCommonLibraryTarget.cmake +++ b/CMLibCommonLibraryTarget.cmake @@ -16,13 +16,15 @@ function(add_common_library) $) set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) - add_library(${LIBNAME}_shared SHARED $) - set_target_properties(${LIBNAME}_shared - PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - OUTPUT_NAME ${LIBNAME} - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) + if(BUILD_SHARED_LIBS) + add_library(${LIBNAME}_shared SHARED $) + set_target_properties(${LIBNAME}_shared + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + OUTPUT_NAME ${LIBNAME} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) + endif() add_library(${LIBNAME}_static STATIC $) set_target_properties(${LIBNAME}_static