diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a3ff1ee..101fa40f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,3 +42,4 @@ unset(BUILDTESTER CACHE) unset(BUILDAPIEMULTESTER CACHE) unset(BUILD_TEST_LIB CACHE) unset(BUILD_HOST_HELPER CACHE) +unset(CREATE_SHARED_LIB CACHE) diff --git a/Makefile b/Makefile index 1ab6509e..eb03586c 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ TUV_SYSTEMROOT ?= default TUV_BUILDTESTER ?= yes TUV_BUILDAPIEMULTESTER ?= no TUV_BUILDHOSTHELPER ?= no +TUV_CREATE_SHARED_LIB ?= no OUTPUT_ROOT := build BUILD_FOLDER := ./$(OUTPUT_ROOT)/$(TUV_PLATFORM)/$(TUV_BUILD_TYPE) @@ -38,7 +39,8 @@ CMAKE_DEFINES := \ -DCMAKE_BUILD_TYPE=$(TUV_BUILD_TYPE) \ -DTARGET_PLATFORM=$(TUV_PLATFORM) \ -DBUILDTESTER=${TUV_BUILDTESTER} \ - -DBUILD_HOST_HELPER=${TUV_BUILDHOSTHELPER} + -DBUILD_HOST_HELPER=${TUV_BUILDHOSTHELPER} \ + -DCREATE_SHARED_LIB=${TUV_CREATE_SHARED_LIB} ifneq ($(TUV_BOARD),unknown) CMAKE_DEFINES += -DTARGET_BOARD=${TUV_BOARD} diff --git a/cmake/libtuv.cmake b/cmake/libtuv.cmake index 435b7a4c..00ae515b 100644 --- a/cmake/libtuv.cmake +++ b/cmake/libtuv.cmake @@ -59,14 +59,16 @@ set_target_properties(${TARGETLIBNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BIN_OUT}") # build tuv shared library -set(TARGETSHAREDLIBNAME tuv_shared) -add_library(${TARGETSHAREDLIBNAME} SHARED ${LIB_TUV_SRCFILES}) -target_include_directories(${TARGETSHAREDLIBNAME} SYSTEM PRIVATE ${TARGET_INC}) -target_include_directories(${TARGETSHAREDLIBNAME} PUBLIC ${LIB_TUV_INCDIRS}) -set_target_properties(${TARGETSHAREDLIBNAME} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${LIB_OUT}" - COMPILE_FLAGS -fPIC - OUTPUT_NAME tuv) +if (DEFINED CREATE_SHARED_LIB AND CREATE_SHARED_LIB STREQUAL "yes") + set(TARGETSHAREDLIBNAME tuv_shared) + add_library(${TARGETSHAREDLIBNAME} SHARED ${LIB_TUV_SRCFILES}) + target_include_directories(${TARGETSHAREDLIBNAME} SYSTEM PRIVATE ${TARGET_INC}) + target_include_directories(${TARGETSHAREDLIBNAME} PUBLIC ${LIB_TUV_INCDIRS}) + set_target_properties(${TARGETSHAREDLIBNAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${LIB_OUT}" + COMPILE_FLAGS -fPIC + OUTPUT_NAME tuv) +endif() if(DEFINED COPY_TARGET_LIB) add_custom_command(TARGET ${TARGETLIBNAME} POST_BUILD