@@ -427,10 +427,21 @@ function _get_configs_for_generic(package, configs, opt)
427427 if not package :use_external_includes () then
428428 table.insert (configs , " -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON" )
429429 end
430+ local has_already_debugflag = opt ._configs_str and opt ._configs_str :find (" CMAKE_BUILD_TYPE" , 1 , true )
430431 if package :is_debug () then
431- table.insert (configs , " -DCMAKE_BUILD_TYPE=Debug" )
432+ if not has_already_debugflag then
433+ table.insert (configs , " -DCMAKE_BUILD_TYPE=Debug" )
434+ end
432435 else
433- table.insert (configs , " -DCMAKE_BUILD_TYPE=Release" )
436+ if not has_already_debugflag then
437+ table.insert (configs , " -DCMAKE_BUILD_TYPE=Release" )
438+ end
439+ end
440+ if package :is_library () then
441+ local has_already_libflag = opt ._configs_str and opt ._configs_str :find (" BUILD_SHARED_LIBS" , 1 , true )
442+ if not has_already_libflag then
443+ table.insert (configs , " -DBUILD_SHARED_LIBS=" .. (package :config (" shared" ) and " ON" or " OFF" ))
444+ end
434445 end
435446end
436447
@@ -644,6 +655,8 @@ function _get_configs_for_cross(package, configs, opt)
644655 opt = opt or {}
645656 opt .cross = true
646657 local envs = {}
658+ envs .CMAKE_BUILD_TYPE = package :is_debug () and " Debug" or " Release"
659+ envs .BUILD_SHARED_LIBS = package :config (" shared" ) and " ON" or " OFF"
647660 local sdkdir = _translate_paths (package :build_getenv (" sdk" ))
648661 envs .CMAKE_C_COMPILER = _translate_bin_path (package :build_getenv (" cc" ))
649662 envs .CMAKE_CXX_COMPILER = _translate_bin_path (package :build_getenv (" cxx" ))
0 commit comments