Skip to content

Commit 7664c6f

Browse files
authored
feature: Add control flag for static compile (#21635)
1 parent e275826 commit 7664c6f

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ include(PreTarget.cmake OPTIONAL)
9191
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
9292

9393
# Add library with project file with project name as library name
94-
add_library(${pkgName} ${SRCS} ${HDRS})
94+
if(NOT BUILD_STATIC_LIBS)
95+
add_library(${pkgName} ${SRCS} ${HDRS})
96+
else()
97+
add_library(${pkgName} STATIC ${SRCS} ${HDRS})
98+
endif()
9599
# Link dependent libraries
96100
if(NOT CMAKE_VERSION VERSION_LESS 3.4)
97101
target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto)

samples/client/others/c/bearerAuth/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ include(PreTarget.cmake OPTIONAL)
6969
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
7070

7171
# Add library with project file with project name as library name
72-
add_library(${pkgName} ${SRCS} ${HDRS})
72+
if(NOT BUILD_STATIC_LIBS)
73+
add_library(${pkgName} ${SRCS} ${HDRS})
74+
else()
75+
add_library(${pkgName} STATIC ${SRCS} ${HDRS})
76+
endif()
7377
# Link dependent libraries
7478
if(NOT CMAKE_VERSION VERSION_LESS 3.4)
7579
target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto)

samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ include(PreTarget.cmake OPTIONAL)
9393
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
9494

9595
# Add library with project file with project name as library name
96-
add_library(${pkgName} ${SRCS} ${HDRS})
96+
if(NOT BUILD_STATIC_LIBS)
97+
add_library(${pkgName} ${SRCS} ${HDRS})
98+
else()
99+
add_library(${pkgName} STATIC ${SRCS} ${HDRS})
100+
endif()
97101
# Link dependent libraries
98102
if(NOT CMAKE_VERSION VERSION_LESS 3.4)
99103
target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto)

samples/client/petstore/c/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ include(PreTarget.cmake OPTIONAL)
9393
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
9494

9595
# Add library with project file with project name as library name
96-
add_library(${pkgName} ${SRCS} ${HDRS})
96+
if(NOT BUILD_STATIC_LIBS)
97+
add_library(${pkgName} ${SRCS} ${HDRS})
98+
else()
99+
add_library(${pkgName} STATIC ${SRCS} ${HDRS})
100+
endif()
97101
# Link dependent libraries
98102
if(NOT CMAKE_VERSION VERSION_LESS 3.4)
99103
target_link_libraries(${pkgName} PRIVATE OpenSSL::SSL OpenSSL::Crypto)

0 commit comments

Comments
 (0)