From c0bee34d423f96845af9520dd2180158ae504b72 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Mon, 23 Mar 2015 15:09:04 +0100 Subject: [PATCH] FindSFML.cmake: Ignored environment variables to find library paths Environment variables (e.g. PATH on Windows) are looked up early by CMake, and libraries found there are prioritized over those in SFML's own folder. To avoid paths to wrong libraries, this commit modifies the CMake find_library() call, such that environment variables are no longer considered as suitable paths. --- cmake/Modules/FindSFML.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindSFML.cmake b/cmake/Modules/FindSFML.cmake index 1bd711825..c8f9414f3 100644 --- a/cmake/Modules/FindSFML.cmake +++ b/cmake/Modules/FindSFML.cmake @@ -240,7 +240,8 @@ if(SFML_STATIC_LIBRARIES) # macro that searches for a 3rd-party library macro(find_sfml_dependency output friendlyname) - find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib) + # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions + find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH) if(${${output}} STREQUAL "${output}-NOTFOUND") unset(output) set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")