From: Juan Ramos Date: Wed, 25 Oct 2023 17:33:59 +0000 (-0600) Subject: cmake: Fixing unsecure environment warnings for MinGW/Apple X-Git-Tag: upstream/1.3.296~185 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3eed5b11704ed938de8c1b2db62cbdb1ec932bd;p=platform%2Fupstream%2FVulkan-Loader.git cmake: Fixing unsecure environment warnings for MinGW/Apple WIN32/Apple doesn't support these functions --- diff --git a/CMakeLists.txt b/CMakeLists.txt index be09539a..d36ea844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,21 +219,23 @@ endif() # Add git branch and tag info in debug mode target_compile_definitions(loader_common_options INTERFACE $<$:DEBUG;GIT_BRANCH_NAME="${GIT_BRANCH_NAME}";GIT_TAG_INFO="${GIT_TAG_INFO}">) -# Check for the existance of the secure_getenv or __secure_getenv commands -include(CheckFunctionExists) -include(CheckIncludeFile) +if (NOT (WIN32 OR APPLE)) + # Check for the existance of the secure_getenv or __secure_getenv commands + include(CheckFunctionExists) + include(CheckIncludeFile) -check_function_exists(secure_getenv HAVE_SECURE_GETENV) -check_function_exists(__secure_getenv HAVE___SECURE_GETENV) + check_function_exists(secure_getenv HAVE_SECURE_GETENV) + check_function_exists(__secure_getenv HAVE___SECURE_GETENV) -if (HAVE_SECURE_GETENV) - target_compile_definitions(loader_common_options INTERFACE HAVE_SECURE_GETENV) -endif() -if (HAVE___SECURE_GETENV) - target_compile_definitions(loader_common_options INTERFACE HAVE___SECURE_GETENV) -endif() -if(NOT MSVC AND NOT (HAVE_SECURE_GETENV OR HAVE___SECURE_GETENV)) - message(WARNING "Using non-secure environmental lookups. This loader will not properly disable environent variables when run with elevated permissions.") + if (HAVE_SECURE_GETENV) + target_compile_definitions(loader_common_options INTERFACE HAVE_SECURE_GETENV) + endif() + if (HAVE___SECURE_GETENV) + target_compile_definitions(loader_common_options INTERFACE HAVE___SECURE_GETENV) + endif() + if (NOT (HAVE_SECURE_GETENV OR HAVE___SECURE_GETENV)) + message(WARNING "Using non-secure environmental lookups. This loader will not properly disable environent variables when run with elevated permissions.") + endif() endif() option(LOADER_CODEGEN "Enable vulkan loader code generation")