From 7bec82f49e00b89a7f0c52e1a0c653138a2a77b1 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 26 Sep 2022 04:27:26 +0800 Subject: [PATCH] cmake: check if NIX_CC exists before using it --- .../build-managers/cmake/001-search-path.diff | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/development/tools/build-managers/cmake/001-search-path.diff b/pkgs/development/tools/build-managers/cmake/001-search-path.diff index 607668b131556..0fd8e381186cf 100644 --- a/pkgs/development/tools/build-managers/cmake/001-search-path.diff +++ b/pkgs/development/tools/build-managers/cmake/001-search-path.diff @@ -12,7 +12,7 @@ index b9381c3d7d..5e944640b5 100644 # CMake install location "${_CMAKE_INSTALL_DIR}" ) -@@ -47,48 +44,48 @@ endif() +@@ -47,48 +44,50 @@ endif() # Non "standard" but common install prefixes list(APPEND CMAKE_SYSTEM_PREFIX_PATH @@ -22,14 +22,16 @@ index b9381c3d7d..5e944640b5 100644 ) # List common include file locations not under the common prefixes. -+if(IS_DIRECTORY $ENV{NIX_CC} -+ AND EXISTS $ENV{NIX_CC}/nix-support/orig-libc -+ AND EXISTS $ENV{NIX_CC}/nix-support/orig-libc-dev) -+ file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc" _nix_cmake_libc) -+ file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc-dev" _nix_cmake_libc_dev) -+else() -+ set(_nix_cmake_libc @libc_lib@) -+ set(_nix_cmake_libc_dev @libc_dev@) ++if(DEFINED ENV{NIX_CC}) ++ if(IS_DIRECTORY $ENV{NIX_CC} ++ AND EXISTS $ENV{NIX_CC}/nix-support/orig-libc ++ AND EXISTS $ENV{NIX_CC}/nix-support/orig-libc-dev) ++ file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc" _nix_cmake_libc) ++ file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc-dev" _nix_cmake_libc_dev) ++ else() ++ set(_nix_cmake_libc @libc_lib@) ++ set(_nix_cmake_libc_dev @libc_dev@) ++ endif() +endif() + list(APPEND CMAKE_SYSTEM_INCLUDE_PATH