diff --git a/config/component/lite_component.gni b/config/component/lite_component.gni index ffff2b3266a2d374e07362b271c8149dc8699f58..cda9ed46bac18a461e0716a731aa9ec802389f33 100644 --- a/config/component/lite_component.gni +++ b/config/component/lite_component.gni @@ -19,7 +19,7 @@ template("lite_library") { target_type = invoker.target_type shared_lib = target_type == "shared_library" - if (shared_lib && ohos_kernel_type == "liteos_m") { + if (shared_lib && defined(ohos_kernel_type) && ohos_kernel_type == "liteos_m") { group(target_name) { if (defined(invoker.sources)) { assert(invoker.sources != "") @@ -54,7 +54,7 @@ template("lite_library") { if (shared_lib) { cflags += [ "-fPIC" ] cflags_cc += [ "-fPIC" ] - } else if (!shared_lib && ohos_kernel_type != "liteos_m") { + } else if (!shared_lib && defined(ohos_kernel_type) && ohos_kernel_type != "liteos_m") { cflags += [ "-fPIE" ] cflags_cc += [ "-fPIE" ] } diff --git a/ndk/ndk.gni b/ndk/ndk.gni index f3739fbb7bb855e0c9d1547ffa0fc5975f4385d0..c79d4660f816a916a7080cdfaad01bbb89b3b8f9 100644 --- a/ndk/ndk.gni +++ b/ndk/ndk.gni @@ -29,8 +29,10 @@ windows_system = "windows-x86_64" linux_system = "linux-x86_64" ndk_toolchain = "gcc" -if (ohos_build_compiler == "clang") { - ndk_toolchain = "llvm" +if (defined(ohos_build_compiler)){ + if (ohos_build_compiler == "clang") { + ndk_toolchain = "llvm" + } } ndk_windows_specific_out_dir = "${ndk_out_dir}/$ndk_toolchain" ndk_linux_specific_out_dir = "${ndk_out_dir}/$ndk_toolchain"