You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ab...@apache.org on 2021/02/01 14:48:24 UTC

[nifi-minifi-cpp] 04/04: MINIFICPP-1375 more robust UCRT search

This is an automated email from the ASF dual-hosted git repository.

aboda pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 8f8136afb8fc3c8ec21e1ca7a98e63e8461d4437
Author: Marton Szasz <sz...@gmail.com>
AuthorDate: Fri Jan 29 23:11:22 2021 +0100

    MINIFICPP-1375 more robust UCRT search
    
    On some systems, the UCRT redistributable DLLs are not under
    "$ENV{WindowsSdkDir}Redist\\ucrt\\DLLs\\$ENV{Platform}", but
    at "$ENV{WindowsSdkDir}Redist\\$ENV{WindowsSDKVersion}ucrt\\DLLs\\$ENV{Platform}",
    contrary to MS docs. This commit tries the documented place
    first, then falls back to the observed one.
    
    Signed-off-by: Marton Szasz <sz...@gmail.com>
    
    MINIFICPP-1375 not finding ucrt is now a fatal error
    
    Signed-off-by: Arpad Boda <ab...@apache.org>
    
    This closes #985
---
 CMakeLists.txt | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6f81d3..ff0024f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -650,13 +650,21 @@ if(WIN32)
 	if (MSI_REDISTRIBUTE_UCRT_NONASL)
 		set(UCRT_DIR_NAT "$ENV{WindowsSdkDir}Redist\\ucrt\\DLLs\\$ENV{Platform}")
 		file(TO_CMAKE_PATH "${UCRT_DIR_NAT}" UCRT_DIR)
-		message("Using UCRT from ${UCRT_DIR}")
-		file(GLOB UCRT_DLLS "${UCRT_DIR}/*.dll")
-		file(COPY ${UCRT_DLLS} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/ucrt")
-		install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ucrt/"
-			DESTINATION bin
-			COMPONENT bin
-		)
+		if (NOT EXISTS "${UCRT_DIR}")
+			set(UCRT_DIR_NAT "$ENV{WindowsSdkDir}Redist\\$ENV{WindowsSDKVersion}ucrt\\DLLs\\$ENV{Platform}")
+			file(TO_CMAKE_PATH "${UCRT_DIR_NAT}" UCRT_DIR)
+		endif()
+		if (NOT EXISTS "${UCRT_DIR}")
+			message(FATAL_ERROR "Couldn't find UCRT")
+		else()
+			message("Using UCRT from ${UCRT_DIR}")
+			file(GLOB UCRT_DLLS "${UCRT_DIR}/*.dll")
+			file(COPY ${UCRT_DLLS} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/ucrt")
+			install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ucrt/"
+					DESTINATION bin
+					COMPONENT bin
+					)
+		endif()
 	endif()
 
 	if (INSTALLER_MERGE_MODULES)