Skip to content

Commit fb5b043

Browse files
committed
bug#30468214 NOT POSSIBLE TO BUILD WITH NINJA
Limitation: When using Ninja, it is not possible to build static connector on windows (BUILD_STATIC must be disabled).
1 parent 3846551 commit fb5b043

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

cmake/libutils.cmake

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function(merge_libraries TARGET)
180180
# by merge_archives script is appended to that file.
181181
#
182182

183-
if(NOT MSBUILD OR NOT TYPE STREQUAL "SHARED")
183+
if(NOT MSVC OR NOT TYPE STREQUAL "SHARED")
184184

185185
set(log_name "${TARGET}.log")
186186
set(log_file
@@ -194,6 +194,7 @@ function(merge_libraries TARGET)
194194
-DTYPE=${TYPE}
195195
-DBUILD_LOG=${log_file}.${TYPE}
196196
-DMSBUILD=${MSBUILD}
197+
-DMSVC=${MSVC}
197198
-DINFO=${INFO}
198199
-DINFO_PREFIX=${INFO_PREFIX}
199200
-P ${LIBUTILS_BIN_DIR}/merge_archives.cmake
@@ -212,7 +213,7 @@ function(merge_libraries TARGET)
212213
# differs for different build tools.
213214
#
214215

215-
if(NOT MSBUILD)
216+
if(NOT MSVC)
216217

217218
# TODO: Will it work with XCode?
218219

@@ -250,7 +251,7 @@ function(merge_libraries TARGET)
250251
RULE_LAUNCH_LINK "${LIBUTILS_BIN_DIR}/save_linker_opts ${log_file}.SHARED "
251252
)
252253

253-
else(NOT MSBUILD)
254+
else(NOT MSVC)
254255

255256
# TODO: macOS case
256257

@@ -283,6 +284,13 @@ function(merge_libraries TARGET)
283284

284285
endif()
285286

287+
if(NOT MSBUILD)
288+
message(FATAL_ERROR
289+
"Sorry but building static connector on Windows using MSVC toolset"
290+
" works only with msbuild at the moment."
291+
)
292+
endif()
293+
286294
#
287295
# Merging into static library on Windows is done by merge_archives script
288296
# and in this case we need the build log with dependency information.
@@ -298,6 +306,9 @@ function(merge_libraries TARGET)
298306

299307
add_custom_command(TARGET ${TARGET} PRE_BUILD
300308

309+
# TODO: This works only when the build tool is msbuild (as it uses
310+
# msbuild cmd line options), fails with ninja for example.
311+
301312
COMMAND ${CMAKE_COMMAND}
302313
--build .
303314
--target ${TARGET}-deps
@@ -310,7 +321,7 @@ function(merge_libraries TARGET)
310321
COMMENT "Extracting dependency info for target ${TARGET}"
311322
)
312323

313-
endif(NOT MSBUILD)
324+
endif(NOT MSVC)
314325

315326
endfunction(merge_libraries)
316327

cmake/libutils/merge_archives.cmake.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,11 @@ function(main)
174174
endforeach()
175175
message("Merge options: ${LINK_OPTIONS}")
176176

177-
if(MSBUILD)
177+
if(MSVC)
178+
message("- using MSVC tools")
178179
merge_libraries_win()
179180
elseif(APPLE)
181+
message("- using Mac tools")
180182
merge_libraries_apple()
181183
else()
182184

@@ -185,6 +187,7 @@ function(main)
185187
# "<LIBS>" entry. This is used to construct the same linker invocation as
186188
# would be used by cmake but with special handling of the merged libraries.
187189

190+
message("- using gcc tools")
188191
merge_libraries_gcc()
189192

190193
endif()

0 commit comments

Comments
 (0)