diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache index 97a44e46443..31a3c22a95c 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache @@ -91,7 +91,11 @@ include(PreTarget.cmake OPTIONAL) set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") # Add library with project file with project name as library name -add_library(${pkgName} ${SRCS} ${HDRS}) +if(NOT BUILD_STATIC_LIBS) + add_library(${pkgName} ${SRCS} ${HDRS}) +else() + add_library(${pkgName} STATIC ${SRCS} ${HDRS}) +endif() # Link dependent libraries if(NOT CMAKE_VERSION VERSION_LESS 3.4) target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto) diff --git a/samples/client/others/c/bearerAuth/CMakeLists.txt b/samples/client/others/c/bearerAuth/CMakeLists.txt index 30076da6c6e..6f6c5586649 100644 --- a/samples/client/others/c/bearerAuth/CMakeLists.txt +++ b/samples/client/others/c/bearerAuth/CMakeLists.txt @@ -69,7 +69,11 @@ include(PreTarget.cmake OPTIONAL) set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") # Add library with project file with project name as library name -add_library(${pkgName} ${SRCS} ${HDRS}) +if(NOT BUILD_STATIC_LIBS) + add_library(${pkgName} ${SRCS} ${HDRS}) +else() + add_library(${pkgName} STATIC ${SRCS} ${HDRS}) +endif() # Link dependent libraries if(NOT CMAKE_VERSION VERSION_LESS 3.4) target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto) diff --git a/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt b/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt index 5ad5652ad3a..eca42ccb016 100644 --- a/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt +++ b/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt @@ -93,7 +93,11 @@ include(PreTarget.cmake OPTIONAL) set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") # Add library with project file with project name as library name -add_library(${pkgName} ${SRCS} ${HDRS}) +if(NOT BUILD_STATIC_LIBS) + add_library(${pkgName} ${SRCS} ${HDRS}) +else() + add_library(${pkgName} STATIC ${SRCS} ${HDRS}) +endif() # Link dependent libraries if(NOT CMAKE_VERSION VERSION_LESS 3.4) target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto) diff --git a/samples/client/petstore/c/CMakeLists.txt b/samples/client/petstore/c/CMakeLists.txt index 5ad5652ad3a..eca42ccb016 100644 --- a/samples/client/petstore/c/CMakeLists.txt +++ b/samples/client/petstore/c/CMakeLists.txt @@ -93,7 +93,11 @@ include(PreTarget.cmake OPTIONAL) set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") # Add library with project file with project name as library name -add_library(${pkgName} ${SRCS} ${HDRS}) +if(NOT BUILD_STATIC_LIBS) + add_library(${pkgName} ${SRCS} ${HDRS}) +else() + add_library(${pkgName} STATIC ${SRCS} ${HDRS}) +endif() # Link dependent libraries if(NOT CMAKE_VERSION VERSION_LESS 3.4) target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto)